hi guys!
I got a problem when I want to display the array from the database and rank it. can someone fixed this problem:-
<?php
session_start();
include "mysql.php";
// you have already opened your db connection
$report_status = isset($_REQUEST['reportTotal']) ? $_REQUEST['reportTotal'] :"";
//$query = mysql_query("SELECT * FROM `supplier_report` "
//. "WHERE `report_value` = '" . $_SESSION['reportTotal'] ."'";
$q= "select * from supplier_report where report_value='" .$_SESSION['reportTotal']."'" "order by report_value desc";
$result=mysql_query($q) or die(mysql_error());
$rank = 0;
$points = 0;
$rankIncrement = 1;
while ($user=mysql_fetch_array($result))
{
if ($user['report_value'] == $points)
{
$rankIncrement;
}
else
{
$rank += $rankIncrement;
$rankIncrement = 1;
}
echo "$rank";
echo "<br>{$user['report_value']}</br>";
}
mysql_close();
?>
I got the error message which is:-
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''Array order by report_value desc' at line 1.
is it because I used array? but I notice this problem when I put the session. can someone give me the right syntax include the session?