sam06 Posted July 8, 2008 Share Posted July 8, 2008 Any reason why? It says on Line 32, which is $referpoints = mysql_result ($check2, 0, 'totalpoints'); Entire Code: <? $clickid = $_POST['number']; mysql_connect("l****************") or die(mysql_error()); mysql_select_db("***********") or die(mysql_error()); // Change the offer to completed mysql_query("UPDATE clicks SET complete='yes' WHERE clickid='$clickid'") or die(mysql_error()); // Get the value of the offer completed $check = mysql_query("SELECT value FROM clicks WHERE clickid='$clickid'") or die(mysql_error()); $offervalue = mysql_result ($check, 0, 'value'); //gets the username $check123 = mysql_query("SELECT username FROM clicks WHERE clickid='$clickid'") or die(mysql_error()); $username = mysql_result ($check123, 0, 'username'); //gets the points the user has $check1 = mysql_query("SELECT totalpoints FROM usertable WHERE username='$username'") or die(mysql_error()); $userpoints = mysql_result ($check1, 0, 'totalpoints'); $newtotal = $offervalue + $userpoints; // updates the new total score mysql_query("UPDATE usertable SET totalpoints='$newtotal' WHERE username='$username'") or die(mysql_error()); //finds who reffered the person $check6 = mysql_query("SELECT referrer FROM usertable WHERE username='$username'") or die(mysql_error()); $referrer = mysql_result ($check6, 0, 'referrer'); //gets the points the referrer has $check2 = mysql_query("SELECT totalpoints FROM usertable WHERE username='$referrer'") or die(mysql_error()); $referpoints = mysql_result ($check2, 0, 'totalpoints'); $refvalue = $offervalue * 0.1; $newpoints = $referpoints + $refvalue; mysql_query("UPDATE usertable SET totalpoints='$newpoints' WHERE username='$referrer'") or die(mysql_error()); ?> Link to comment https://forums.phpfreaks.com/topic/113784-unable-to-jump-to-row-0-on-mysql-result-index-6/ Share on other sites More sharing options...
dannyb785 Posted July 8, 2008 Share Posted July 8, 2008 I read somewhere that nobody uses mysql_result anymore. Not that they literally dont, but that there are better, easier, and more efficient practices. Can you explain what you're trying to do, then we can suggest a better way of doing it Link to comment https://forums.phpfreaks.com/topic/113784-unable-to-jump-to-row-0-on-mysql-result-index-6/#findComment-584716 Share on other sites More sharing options...
Barand Posted July 8, 2008 Share Posted July 8, 2008 If you can't go to row 0 then no results were found by the query Link to comment https://forums.phpfreaks.com/topic/113784-unable-to-jump-to-row-0-on-mysql-result-index-6/#findComment-584720 Share on other sites More sharing options...
Barand Posted July 8, 2008 Share Posted July 8, 2008 I read somewhere that nobody uses mysql_result anymore. Granted, it is slower than the mysql_fetch_xxxx() functions for looping through results, but I still find it useful in queries with a single value result EG $res = mysql_query ("SELECT COUNT(*) FROM mytable WHERE something"); if (mysql_result($res,0,0) > 0) { // do something if there are records } as it saves having to fetch the row then test the column value. Link to comment https://forums.phpfreaks.com/topic/113784-unable-to-jump-to-row-0-on-mysql-result-index-6/#findComment-584731 Share on other sites More sharing options...
dannyb785 Posted July 8, 2008 Share Posted July 8, 2008 ^ point taken. Just not a practice I see very much at all. Link to comment https://forums.phpfreaks.com/topic/113784-unable-to-jump-to-row-0-on-mysql-result-index-6/#findComment-584733 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.