I have a user level field in my database that contains either 1 or 2. what I want to do is to get the row that has the username that I inputted that contains level 2. Here is my code:
<?php
$con=mysql_connect("localhost","root","");
mysql_select_db("nnx",$con);
$tbl=mysql_query("SELECT * FROM order");
while($row=mysql_fetch_array($tbl))
{
if (($row['level']=='2')&&($row['username']==$_POST['user']))
{
echo $row['username']."".$row['garlique']."".$row['rightcee'];
echo $row['oleia']."<br />";
}
else
{
echo $row['username']."".$row['garlique']."".$row['rightcee'];
echo .$row['oleia']."<br />";
}
}
?>
When I tried to test it, an error "unexpected $end" showed. What I think is wrong in my code is the validation if.. ($row['level']=='2').. I don’t have any idea how to fix this kind of problem. I am a beginner in php, so if you could help me out, I would appreciate it very much. 🙂
Close your
whileloop with}. Syntax error.