help

He has: 23 posts

Joined: Apr 2000

Hello,

Just wondering if i could have some help, im new to php/mysql.. i wanted to ask if somebody could help me learn how to send a value.. eg .. screensaver.php?id=20 .. then select it from a database with the given id..?

thx = rob..

---------------------
Check out my Free Screen Saver Site
robsscreensavers.com
--------------------

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

You've got the first part right. When you pass the value like screensaver.php?id=20, it passes the variable $id to the next screen which in this case would be 20. To pick it up using MySQL, you would just use a simple Select statement:
SELECT fieldnames (or *) from tablename where id='$id'
Which in this case would say SELECT * (all values) from tablename where id='20'.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

He has: 23 posts

Joined: Apr 2000

cheerz i will check it out later tonight

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

Don't forget to build in some error checking incase someone types in the address bar, like "screensaver.php?id=thiswillbreak"

Make sure before you send it to the database that you validate it as proper input.

Have fun!

PJ | Are we there yet?
pjboettcher.com

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.