Member Avatar for seangdy

I write code as below:

<html> <title>Hanuman Database</title> <link href="../style.css" rel="stylesheet" type="text/css" /> <div align="center"> <body> <?php session_start(); $dbhost='localhost'; $dbuser='hanum3_hanumandb'; $dbpass='hanuman2009'; $conn=mysql_connect ($dbhost, $dbuser,$dbpass) or die('Cannot connect to the database because: ' . mysql_error()); $dbname='hanum3_HanumanDB'; mysql_select_db($dbname,$conn) or die('Error, cannot connect to database'); ?> <form id="form1" name="form1" method="post" action="create_user.html"> <div align="center"> <table width="800" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="10"><img src="../images/bg_up_exp_left.GIF" width="20" height="20" /></td> <td width="722" background="../images/bg_up_experience.gif">&nbsp;</td> <td width="10"><img src="../images/bg_up_exp_right.gif" width="20" height="20" /></td> </tr> <tr> <td background="../images/left_bg.gif">&nbsp;</td> <td><table width="758" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="../images/logo_1.jpg" width="96" height="122" /></td> </tr> <tr> <td>&nbsp;</td> </tr> <tr> <td class="navlink11bl">User Information</td> </tr> <tr> <td>&nbsp;</td> </tr> <tr> <td><table width="758" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="25" colspan="2" class="subsans8blue">Create New User</td> </tr> <tr> <td width="124" height="25" class="bodyBold"><div align="right">User Name:&nbsp;</div></td> <td width="634" height="25" class="bodyBold"> <input name="txtUserName" type="text" class="bullet8bkOrdered" id="txtUserName" /> </td> </tr> <tr> <td height="25" class="bodyBold"><div align="right">Password:&nbsp;</div></td> <td height="25" class="bodyBold"><input name="txtPassword" type="password" class="bullet8bkOrdered" id="txtPassword" /></td> </tr> <tr> <td height="25" class="bodyBold"><div align="right">Deletable:&nbsp;</div></td> <td height="25" class="bodyBold"><input name="chkDeletable" type="checkbox" id="chkDeletable" checked="checked" /></td> </tr> <tr> <td height="25" class="bodyBold">&nbsp;</td> <td height="25" class="bodyBold"><input type="submit" name="cmdCreateUser" id="cmdCreateUser" value="Create User"> &nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" name="cmdClear" id="cmdClear" value="Clear"> &nbsp;&nbsp;&nbsp;&nbsp;<input type="button" name="cmdBack" id="cmdBack" value="Main Page" onClick="location.href='main.html'"></td> </tr> <tr> <td height="25" class="bodyBold">&nbsp;</td> <td height="25" class="bodyBold">&nbsp;</td> </tr> <tr> <td height="25" colspan="2" class="bodyBold"><span class="bodyBold8">List of users</span></td> </tr> <tr> <td height="25" colspan="2" class="bodyBold"><table width="400" border="1" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC"> <tr> <td width="53" height="20" bgcolor="#CCCCCC" class="bodyBold8"><div align="center">N&ordm;</div></td> <td width="228" height="20" bgcolor="#CCCCCC" class="bodyBold8"><div align="center">User Name</div></td> <td width="119" height="20" bgcolor="#CCCCCC" class="bodyBold8"><div align="center">&nbsp;</div></td> <td width="119" height="20" bgcolor="#CCCCCC" class="bodyBold8"><div align="center">&nbsp;</div></td> </tr> <tr> <?php $sql="Select * From TblUsers Where UserName<>'Administrator' Order By UserName ASC" $result = mysql_db_query($dbname, $sql) or die("Failed Query of " . $sql); //do the query $i=0; while($row = mysql_fetch_array($result)){ $i++; echo "<td height='20' class='bullet8bkOrdered'><div align='center'>".$i."</div></td>"; echo "<td height='20' class='bullet8bkOrdered'>".$row['UserName']."</td>"; echo "<td height='20' class='bullet8bkOrdered'><input type='submit' name='cmdEdit' id='cmdEdit' value='Edit' onclick='location.href=create_user.php?strAction='Edit'&userID=".$row['UserID']."'></td>"; echo "<td class='bullet8bkOrdered'><input type='submit' name='cmdDelete' id='cmdDelete' value='Delete' onclick='location.href=create_user.php?strAction='Delete'&userID=".$row['UserID']."'></td>"; } ?> </tr> </table></td> </tr> </table></td> </tr> <tr> <td></td> </tr> </table></td> <td background="../images/right_bg.gif">&nbsp;</td> </tr> <tr> <td><img src="../images/coner_down_left.gif" width="20" height="20" /></td> <td background="../images/down_bg.gif">&nbsp;</td> <td><img src="../images/coner_down_right.gif" width="20" height="20" /></td> </tr> </table> </div> </form> <div align="center"> </div> </div> </body> <div align="center"></div> <html>

But it show error "Parse error: syntax error, unexpected T_VARIABLE in /home/hanum3/public_html/tours/create_user.php on line 84"

So please help me!

Member Avatar for leviathan185

try putting single quotes around your variables inside the SQL query

Member Avatar for SimonMayer

The issue is that there is no semi-colon ; at the end of the the line where you declare the variable $sql

$sql="Select * From TblUsers Where UserName<>'Administrator' Order By UserName ASC"

I hope this helps.

Member Avatar for seangdy

Many thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.