Forum Moderators: coopster

Message Too Old, No Replies

Echo results

How to fetch results

         

shaundunne

4:34 pm on Jan 15, 2008 (gmt 0)

10+ Year Member



OK, now i am at the second hurdle. I want to now pull a few rows from my database depending on the selection made from the drop down menu...

The SQL i want to run on submit is

select competition_entry.competition_id, user.user_id, email_address,
first_name, last_name, gender, date_of_birth, telephone_number,
address1, address2, address3, town, county, postcode
from competition_entry, user
WHERE competition_entry.competition_id ='#*$!#*$!#*$!'
ORDER BY RAND() limit 1\G

The #*$!#*$!xx is replaced by the string selected in the drop down menu i made

<option value ="<?=$row['id'];?>"><?=$row['name'];?> </option>

so .competion_id should be $row['id']?

I then want to echo the result. If submit is pushed again, i want the script to run again.

cheers for any help.

eelixduppy

5:13 pm on Jan 15, 2008 (gmt 0)



Hello,

you might want to take a look at this library thread as it pertains to your question and should help you along to solution: basics of extracting data from mysql [webmasterworld.com]. Other than this, the mysql functions [php.net] are another great place to look for information.

Just a security note: Make sure to clean the input data appropriately for what you need it for, and properly escape the data before inserting it into a query string. To do this, it is best to use mysql_real_escape_string [php.net].

good luck :)