Lambneck Posted April 13, 2008 Share Posted April 13, 2008 Hello, I have here, echoed as a link, the subject of my submitted forms. What I am trying to do is make it so each individual subject from a form submission becomes a link to a page displaying the rest of its form entry (ie. name, email, message). The links page: $result = mysql_query("SELECT col_4 FROM {$table} ORDER BY submission_date DESC"); if (!$result) { die("Query to show fields from table failed:".mysql_error()); } while($row = mysql_fetch_array($result)) { echo '<a href="ResumeDisplay.php?id='.$row['id'].'">'.$row['col_4'].'</a>'; echo "<br />"; } mysql_free_result($result); ?> and the display page: $id = (int) $_GET['submission_id']; $sql = "SELECT * FROM {$table} WHERE submission_id=$id, "; $result = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($result) == 1){ $row = mysql_fetch_assoc($sql); //print out information }else{ echo 'That record ID does not exist!'; } ?> the problem is with the code on the display page. I get the error message: 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 '' at line 1 Link to comment https://forums.phpfreaks.com/topic/100858-solved-mysql-select-problem/ Share on other sites More sharing options...
toplay Posted April 13, 2008 Share Posted April 13, 2008 You have a comma at the end. Change this: $sql = "SELECT * FROM {$table} WHERE submission_id=$id, "; to this: $sql = "SELECT * FROM {$table} WHERE submission_id=$id"; Link to comment https://forums.phpfreaks.com/topic/100858-solved-mysql-select-problem/#findComment-515789 Share on other sites More sharing options...
AndyB Posted April 13, 2008 Share Posted April 13, 2008 And please don't double post. Now you have two answers - both the same - and my time was wasted. Link to comment https://forums.phpfreaks.com/topic/100858-solved-mysql-select-problem/#findComment-515791 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.