I'm sure I've done this right, but it doesn't work. I'm trying to make it so if you visit the page with ?user=#&page=#, it searches the table for rows with whatever $user and $page are. If they are both in the same row, then it displays 'title' and 'body' from that row. I hope someone understands what I'm talking about... any help is appreciated.
PS. Sorry my code is probably really messy, I'm not too good with PHP / MySQL.
Last edited by Ady on Fri Feb 17, 2006 7:15 am, edited 1 time in total.
$sql = "SELECT * FROM pages WHERE id='" . mysql_escape_string($_GET['user']) . "'";
That is one thing you should fix. I changed it for you. The variable was inside single qoutes so it would not have worked, and variables in a URL are in the $_GET array unless you have register globals on, which you shouldn't. And then add mysql_escape_string for a little security.
$sql = "SELECT * FROM pages WHERE id='" . mysql_escape_string($_GET['user']) . "'";
That is one thing you should fix. I changed it for you. The variable was inside single qoutes so it would not have worked, and variables in a URL are in the $_GET array unless you have register globals on, which you shouldn't. And then add mysql_escape_string for a little security.
Ah, cheers. I don't know much about PHP, but I'm learning. I've editted my script now, but it still doesn't work lol.