jaku78 Posted April 25, 2007 Share Posted April 25, 2007 I made a MySQL inbox for a game I'm making online... but I'm having some trouble. <html> <head> <LINK href="style.css" rel="stylesheet" type="text/css"> <?php $title="Inbox"; require("navtemp.inc"); require("serverinfo.inc"); if (isset($_COOKIE['userid'])) { $username=$_COOKIE['username']; echo "Welcome ".$username." to your inbox!"; echo "<a href='newPM.html' target='_blank'>Compose a new message</a>"; } else { die("Your not logged in! Log in!"); } $formset= <<<END <form action='deletemsg.php' method='post'> END; $tablehead = <<<END <table> <tr border='1'><td>FROM</td><td>SUBJECT</td><td>CREATED</td><td>DELETE</td></tr> END; $tableend = "</table></div></body></html>"; echo $tablehead; echo $formset; $sql="SELECT pmid FROM myPM WHERE to='$username'"; $query=mysql_query($sql) or die(mysql_error()); $msg=mysql_fetch_assoc($query) or die(mysql_error()); foreach ($msg as $id) { $sql1="SELECT * FROM myPM WHERE pmid='$id'"; $query1=mysql_query($sql) or die(mysql_error()); $msg1=mysql_fetch_assoc($query) or die(mysql_error()); echo "<tr><td>".$msg1['from']."</td><td>".$msg1['title']."</td><td>".$msg1['pmdate']."</td><td><input type=checkbox name='".$msg1['pmid']."'>"; } echo "<input type=submit value='Delete Messages'></form>"; echo $tableend; ?> The only clue that SQL gives me that it's near somewhere near these lines: $sql="SELECT pmid FROM myPM WHERE to='$username'"; $query=mysql_query($sql) or die(mysql_error()); Any ideas? Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/48547-solved-mysql-inbox-help/ Share on other sites More sharing options...
bubblegum.anarchy Posted April 25, 2007 Share Posted April 25, 2007 the to in WHERE to='$username' might be a mySQL keyword... try adding backticks or rename the field. Quote Link to comment https://forums.phpfreaks.com/topic/48547-solved-mysql-inbox-help/#findComment-237697 Share on other sites More sharing options...
jaku78 Posted April 25, 2007 Author Share Posted April 25, 2007 That seemed to work... thank you! Quote Link to comment https://forums.phpfreaks.com/topic/48547-solved-mysql-inbox-help/#findComment-237719 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.