Jodi_the_g
Member
Registered: 7th Aug 01
Location: Washington D.C
User status: Offline
|
I linked to a db run a query now i want to set my varables
how do I set the field name from the db?
$question = feild name
|
Steve
Premium Member
Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
|
$query = sprintf("SELECT field FROM table WHERE firstname='%s' AND lastname='%s'")
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result)) {
$question = $row['fieldname'];
}
[Edited on 26-01-2008 by Steve]
|
Jodi_the_g
Member
Registered: 7th Aug 01
Location: Washington D.C
User status: Offline
|
thanks Steve.
I figured it out just before you posted I did not put it in []
but another quick question
I have $questionnumber then run a form which going to a php script in this form I have
$questionnumber = $questionnumber+1;
but once I run it it does not come back with an increased valve.
|
Steve
Premium Member
Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
|
$questionnumber++;
|
Steve
Premium Member
Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
|
no just what i put
|
Jodi_the_g
Member
Registered: 7th Aug 01
Location: Washington D.C
User status: Offline
|
its ok I did not call it
and to add 2 insteand of one it would be +++
|
Jodi_the_g
Member
Registered: 7th Aug 01
Location: Washington D.C
User status: Offline
|
and also if I wanted to go back to the form I just come from after I rang the checking what command would I use.
then that is all thanks for your help
|
Steve
Premium Member
Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
|
redirect or include
|
Jodi_the_g
Member
Registered: 7th Aug 01
Location: Washington D.C
User status: Offline
|
Thanks
although I fucked up as I set it to 1 on the orginal form so it just resets.
|
Jodi_the_g
Member
Registered: 7th Aug 01
Location: Washington D.C
User status: Offline
|
include will only work once though won't it I need it to count to 10 $questions refreeshing each time
|
Ian
Site Administrator
Registered: 28th Aug 99
Location: Liverpool
User status: Offline
|
Include is for files.
If you want data just read it from the db and print it.
|