Jump to content

[SOLVED] MySQL Query Wont Get info


R4nk3d

Recommended Posts

if($_GET['type'] == "page" && isset($id))
				{
					$sql = "SELECT * FROM links WHERE 'id'='$id'";
					$result = mysql_query($sql,$connection);
					$rows = mysql_num_rows($result);
					if($rows == 1)
					{
						while($r = mysql_fetch_array($result))
						{
							echo "<h1>Edit: News: ID $r[id]</h1>";
							echo "Please use the editor below to format the page. To insert a special type of text, please click the button.";
							echo "<br>";
							echo "<form id=\"pagecode\" name=\"pagecode\" method=\"post\" action=\"edit.php?type=page&id=$id&submitting=1\">";
							echo "<input name=\"header\" type=\"button\" onclick=\"insertCode('<h1></h1>','pagebody');\" value=\"Header\" />";	
							echo "<input name=\"nl\" type=\"button\" onclick=\"insertCode('<br>','pagebody');\" value=\"New Line\" >";	
							echo "<br />";
							echo "<textarea name=\"pagebody\" id=\"pagebody\" cols=\"80\" rows=\"10\">".$r['news']."</textarea>";
							echo "<br />";
							echo "<input name=\"submit\" id=\"submit\" onclick=\"checkconfirm('pagecode'); return false;\" type=\"button\" value=\"Submit\" />";
							echo "</form>";
						}
					}
					else
					{
						echo "<h1>Edit: Page: ID Not Found</h1>";
						echo "The page id you have searched for cannot be found. Please try again.";
					}
				}

I am using this code to make a small cms. But the problem is, even tho the id exists in the database and you can view it on the page that shows its body, it says on this page it does not exist and i cannot figure out why its not working. can anyone help?

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.