Invalid query: Where id = 1

I am having trouble getting my edit page to work. [mod edit - information not needed and a security risk]

This is the code I think I’m having trouble with:
[php]


		<?PHP
				// Get the ID and Table name into variables
				$id = $_GET['id'];
				$table = $_GET['table'];
				$title = $_GET['title'];

				include('includes/dbc_admin.php');
				$sql = "SELECT * FROM $table where id = '$id'";
				$result = mysql_query($sql) or die("Invalid query: ". mysql_error());
				while($row=mysql_fetch_assoc($result)) {
					echo 'iv>ID</div><input style="hidden" name="id" value="'.$id.'"><br/><br/>';
					echo '<div>Table</div><input style="hidden" name="table" value="'.$table.'"><br/><br/>';
					echo '<div>Title</div><textarea name="title" width="500">'.$row['title'].'</textarea><br/><br/>';
						echo '<div>Message</div><textarea name="message" width="500" height="300">'.$row['message'].'</textarea>';
					}
			?>
			<input type="submit" name="Submit_Update" value="Update">
		</form>Check out this Pen!
[/php]

Verify that $_GET[‘id’] contains information since that seems to be the question. Also, please fix the html encoded quotes and <> in your code, very hard to figure out what’s what.

Sponsor our Newsletter | Privacy Policy | Terms of Service