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
https://forums.phpfreaks.com/topic/129395-solved-mysql-query-wont-get-info/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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