justuptime.com - monitor your servers & websites

help

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

He has: 24 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
Moderator

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: 24 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