![]() |
|
#1
|
|||
|
|||
Problems pulling data from tableI'm a little baffled as to why my PHP is not pulling all my data it should from MySQL. Here is my situation.
PHP Code:
Here is what table automaint.vehicles contains id username vehicle 1 hellcat1 2001 Chevrolet S10 2 hellcat1 2001 Dodge Ram 1500 3 hellcat1 1985 Chevrolet S10 Blazer 4 hellcat1 1987 GMC S15 Here is the results username = hellcat1 result2 = Array ( [0] => 1 [id] => 1 [1] => hellcat1 [username] => hellcat1 [2] => 2001 Chevrolet S10 [vehicle] => 2001 Chevrolet S10 ) Any ideas why it's only pulling the first row and stopping? Last edited by JdS : 01-Aug-2004 at 09:48.
Reason: Please insert [php] & [/php] tags between your example PHP codes
|
|||
|
#2
|
||||
|
||||
|
You need to loop through the results/resource ($result2)...
PHP Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#3
|
|||
|
|||
|
Quote:
Great, I changed the code to PHP Code:
And now I'm dynamically building a select box for entering data. |
|
#4
|
|||
|
|||
|
Aha, I see what you're doing there. All set to go?
Conker __________________
You're not supposed to be looking at this. |
|
#5
|
|||
|
|||
|
Quote:
For that issue yes. Now I'm trying to figure the best way to display the data stored in automaint.oil for a user with multiple vehicles (as seen in the above select box). Ideally, I would like to display each vehicles of $username in automaint.vehicles in it's own table with all instances from automaint.oil listed like this. Your Oil Change History as you previously entered on this site. User Name : hellcat1 Date Of Change Vehicle Filter Used Oil Type and Amount Used Milage Changed January 05, 2004 2001 Chevrolet S10 Napa Gold FIL1036 5 Qts of Standard Oil 48000 April 04, 2004 2001 Chevrolet S10 AC Delco PF52 5 Qts of Full Synthetic 51000 July 30, 2004 2001 Chevrolet S10 AC Delco PF52 5 Qts of Full Synthetic 55157 Next Oil Change Due On October 30, 2004 Or @ 60157 Miles. Edit Your Data Submit New Data |
|
#6
|
|||
|
|||
|
If you're looking to put the data into table format, you can use echo statements within the while loop (after executing the query) to generate the table.
Conker __________________
You're not supposed to be looking at this. |
|
#7
|
|||
|
|||
|
Quote:
|
Recent GIDBlog
Accepted for Ph.D. program by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [CONTEST?]Data Structure Test | dsmith | C Programming Language | 2 | 06-Jun-2004 16:13 |
| Search data in table. | eRIC | MySQL / PHP Forum | 2 | 16-May-2004 04:06 |
| some I/O problems...again | cameron | C++ Forum | 3 | 03-Mar-2004 22:39 |
| Automate a data change php form | mjfmn | MySQL / PHP Forum | 4 | 20-Oct-2003 10:37 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The