corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » Geek Day » quick php question


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author quick php question
Jodi_the_g
Member

Registered: 7th Aug 01
Location: Washington D.C
User status: Offline
26th Jan 08 at 21:52   View User's Profile U2U Member Reply With Quote

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

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
26th Jan 08 at 22:01   View Garage View User's Profile U2U Member Reply With Quote

$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
26th Jan 08 at 22:27   View User's Profile U2U Member Reply With Quote

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

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
26th Jan 08 at 22:29   View Garage View User's Profile U2U Member Reply With Quote

$questionnumber++;
Steve
Premium Member

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
26th Jan 08 at 22:33   View Garage View User's Profile U2U Member Reply With Quote

no just what i put
Jodi_the_g
Member

Registered: 7th Aug 01
Location: Washington D.C
User status: Offline
26th Jan 08 at 22:34   View User's Profile U2U Member Reply With Quote

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
26th Jan 08 at 22:36   View User's Profile U2U Member Reply With Quote

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

Avatar

Registered: 30th Mar 02
Location: Worcestershire Drives: Defender
User status: Offline
26th Jan 08 at 22:52   View Garage View User's Profile U2U Member Reply With Quote

redirect or include
Jodi_the_g
Member

Registered: 7th Aug 01
Location: Washington D.C
User status: Offline
26th Jan 08 at 23:10   View User's Profile U2U Member Reply With Quote

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
26th Jan 08 at 23:21   View User's Profile U2U Member Reply With Quote

include will only work once though won't it I need it to count to 10 $questions refreeshing each time
Ian
Site Administrator

Avatar

Registered: 28th Aug 99
Location: Liverpool
User status: Offline
28th Jan 08 at 00:51   View Garage View User's Profile U2U Member Reply With Quote

Include is for files.

If you want data just read it from the db and print it.

 
New Topic

New Poll

  Related Threads Author Forum Replies Views Last Post
Quick question diddon General Chat 3 1173
14th Oct 03 at 07:15
by LoudandLow
 
quick stupid question.... V-Man General Chat 8 1402
31st Mar 05 at 21:35
by V-Man
 
Quick question (offset) sxibeast Help Zone, Modification and ICE Advice 2 1315
7th Mar 06 at 10:10
by sxibeast
 
Newbie. And also a quick question. Stenner General Chat 2 994
4th Dec 06 at 21:08
by Stenner
 
Quick Question Which Needs Quick Reply Please.. Robbo_Corsa Help Zone, Modification and ICE Advice 8 446
25th Sep 07 at 19:42
by mattk
 

Corsa Sport » Message Board » Off Day » Geek Day » quick php question 29 database queries in 0.0124779 seconds