Jump to content

[SOLVED] mysql select problem


Lambneck

Recommended Posts

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