shirley25 Posted February 26, 2011 Share Posted February 26, 2011 i'm getting this erro "Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /***/***/*****.php on line 278 not an active session, starts new" this is the code: if ($phase = mysql_result(mysql_query("SELECT `phase` FROM `as_support` WHERE `mission` = '$var2'"),0,0)) { if ($phase=='5') { // mysql_query("DELETE FROM `as_support` WHERE `mission` = '$var2'"); // header("Location: https://www.**********/*******/*******.php"); } else { echo date('h:i:s') . ": PHASE is $phase<br />"; echo "\$var1=$var1,\$var2=$var2<br />"; } } else { echo "not an active session, starts new<br />"; echo "\$var1=$var1,\$var2=$var2<br />"; mysql_query("INSERT INTO `as_support` (`mission`, `phase`) VALUES ('$var2', '0')") OR DIE(mysql_error()); the first line is line no. 278 can someone please tell me what to do? tnx shirley Link to comment https://forums.phpfreaks.com/topic/228910-i-think-i-have-a-problem-can-you-help-me/ Share on other sites More sharing options...
Altrozero Posted February 26, 2011 Share Posted February 26, 2011 It probably means that the row and field you are requesting doesn't exist, in other words when no rows are found in your query, mysql_result can't get anything. You can solve this my going... $phase = false; $query_result = mysql_query("SELECT `phase` FROM `as_support` WHERE `mission` = '$var2'"); if(mysql_num_rows($query_result) > 0) $phase = mysql_result($query_result, 0, 0); if($phase !== false) { .... Link to comment https://forums.phpfreaks.com/topic/228910-i-think-i-have-a-problem-can-you-help-me/#findComment-1179993 Share on other sites More sharing options...
shirley25 Posted February 26, 2011 Author Share Posted February 26, 2011 i gess you r right but.. the idea is that have a page with a blank bar that i write a word in it. this word is "mission = var2" . sorry for asking.. what after the "if($phase !== false) { .... ? tnx Link to comment https://forums.phpfreaks.com/topic/228910-i-think-i-have-a-problem-can-you-help-me/#findComment-1179999 Share on other sites More sharing options...
Altrozero Posted February 26, 2011 Share Posted February 26, 2011 Just the rest of your code, I basically replaced the line if ($phase = mysql_result(mysql_query("SELECT `phase` FROM `as_support` WHERE `mission` = '$var2'"),0,0)) with what I posted. It should stop giving you the warning then. Link to comment https://forums.phpfreaks.com/topic/228910-i-think-i-have-a-problem-can-you-help-me/#findComment-1180001 Share on other sites More sharing options...
shirley25 Posted February 26, 2011 Author Share Posted February 26, 2011 now it doesn't work... it runs without an erro for a minet but then stops.. and i don't see that it is updating on mysql. Link to comment https://forums.phpfreaks.com/topic/228910-i-think-i-have-a-problem-can-you-help-me/#findComment-1180014 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.