unemployment Posted May 16, 2011 Share Posted May 16, 2011 I get the unable to jump to row zero mysql error. function is_admin($uid, $cid) { $uid = (int)$uid; $cid = (int)$cid; $sql = "SELECT `users`.`id` AS `uid`, `companies`.`companyid` AS `cid`, `companies`.`adminid` AS `aid` FROM `companies` LEFT JOIN `users` ON `users`.`id` = companies.adminid WHERE `users`.`id` = {$uid} AND `companies`.`companyid` = {$cid}"; $user = mysql_query($sql); return (mysql_result($user, 0) == '1') ? true : false; } Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted May 16, 2011 Share Posted May 16, 2011 Either your query failed due to an error or it matched zero rows. You need to have error checking and error reporting logic on every query to test if the query worked of failed and then you need to test if any row(s) were returned by a successful query, all before you attempt to access the data from a query. Since you are not doing either of those tests, it is not directly possible to tell you why there are no rows. Also, mysql_result() is the only mysql_ data fetch statement that produces an error simply because there were zero rows in a result set. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.