PHP and MySQL Help
Posted: Fri Feb 17, 2006 6:45 am
'pages' Table:

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.

Code: Select all
<?
include("config.php");
$sql="SELECT * FROM pages WHERE id='$user'";
$result3=mysql_query($sql);
$rows2=mysql_fetch_array($result3);
$user2=$rows2['id'];
$key2=$rows2['key'];
$title2=$rows2['title'];
$body2=$rows2['body'];
if($user==$user2 && $page==$key2){ echo ('<b>' . $title2 . '</b><br>' . $body2); };
?>PS. Sorry my code is probably really messy, I'm not too good with PHP / MySQL.