PDA

View Full Version : Mysql Select Query


Nmare
Mon 27th May '02, 2:42am
I want to store reviews for my site in mysql. And when i go to a certain page, it only shows the one review.

So what i wanna do is have something like -the url -

index.php?page=reviews&id=1

id = the review #.

But when i connect to mysql and do a select query like.

Select -column names - WHERE ID = 1 (Being the review #).

Sorry if its a little confusing on the way i say it.

Does anyone know how i can do this?

WingMan
Mon 27th May '02, 8:57pm
Is ID 1 the review post number ? :confused: and should the select statement have a FROM clause?

Dan615
Mon 27th May '02, 10:17pm
$result = @mysql_query("SELECT * FROM reviews WHERE reviewid = $id") or die(mysql_error());

$review = mysql_fetch_array($result);


That's all you gotta do :)

Nmare
Tue 28th May '02, 12:27am
Actually, i figured it out.. I had to put the WHERE before the ORDER.. hehe :) Thanks for ur help though. Sorry for leaving a few things out, cuz i did have the FROM part, and the ORDER part in my code.