Jump to content

[SOLVED] Multiple WHERE statements


Clinton

Recommended Posts

Error:

 

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 'Terminated = '0' ORDER BY Position' at line 1

 

<?

// connect to database
include("inc/connect.php");

// include auth and nav
include("inc/auth.php");
include("inc/nav.php");

?>

<?
$rn=("SELECT * FROM users WHERE
username='" . $_SESSION['username']."'");

$rz=mysql_query($rn);

while($row=mysql_fetch_array($rz))
{
if($row["Status"]=="0"){
echo ("<br>Have a great day! <a href='logout.php'>Close</a>");
}else{
?>

<center><h3>Explosive Personnel</h3></center>

<?
$q1=mysql_query("SELECT * FROM roster WHERE Position <= '4' AND Terminated = '0' ORDER BY Position") or die(mysql_error());
$q1rz=mysql_query($q1);

while($row1 = mysql_fetch_array($q1rz)){
?>


<b><font color="orange" size="3"><? echo $row1['Name']; ?></font></b><br>
<i><? echo $row1['Title']; ?></i><br>
Cell: <? echo $row1['CellPhone']; ?> &nbsp &nbsp &nbsp Home: <? echo $row1['HomePhone']; ?><br>
E-Mail: <a href=mailto:<? echo $row1['Email']; ?>><? echo $row1['Email']; ?></a><br>
<? echo $row1['Notes']; ?><p>


<?
}
?>

</body>


</html>

<?
}}
?>

Link to comment
Share on other sites

Interesting. I never thought about doing that but when I do I get an error:

 

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 'Terminated=0 ORDER BY Position DESC' at line 1

 

But if I do it the other way, Position, it works just fine. And yes, i'm not a complete idiot. ;-) LoL THe columns do exist. I've checked and rechecked my PHPAdmin and everything looks good.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.