Jump to content

Php mysql problem


antonyjohn

Recommended Posts

hi,

i keep getting an error while executing the code below

 

<?

include("includes/db.php");

 

$sql = "SET @rank=0; SELECT @rank := @rank +1 AS rank, fname, pointbalance FROM vs_userprofile ORDER BY pointbalance";

$query = mysql_query($sql) or die(mysql_error("FAiled"));

while($row = mysql_fetch_object($query))

{

echo "<br>".$rank = $row->rank;

    $name = $row->fname;

}

 

?>

the error i got is ::Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /usr/local/www/sites/myofficerivalry/testrank.php on line 5

 

i need to get the result like this

+------+--------+--------+

| rank | fruit  | amount |

+------+--------+--------+

|    1 | cherry |    124 |

|    2 | plum  |    23 |

|    3 | pear  |    19 |

|    4 | apple  |    13 |

|    5 | banana |      4 |

|    6 | orange |      2 |

+------+--------+--------+

 

Plz help

Link to comment
https://forums.phpfreaks.com/topic/119121-php-mysql-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.