|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
Different Values
Hi,
i have a page that $sql = "SELECT * FROM skills WHERE skill_from_last_page = $skill"; i have a while ($row = mysql_fetch_array($sql_result)) { $skill2 = $row["skill2"]; } $skill2 Which brings back 9 rows of $skill2. Ok, the next page $sql = "SELECT * FROM skills2 WHERE skill_from_last_page = $skill2"; while ($row = mysql_fetch_array($sql_result)) { $skill3 = $row["skill3"]; } but bcos $skill2 is the same value ($skill2) for each row, it overwrites each row and just selects the last row from the database. Any help of how to set each value a setting so this will work? Adam |
|
#2
|
|||||
|
|||||
|
RE: Different Values
something like this? (untested for bugs/errors)
php Code:
Cheers, Keith. |
|
#3
|
|||
|
|||
|
RE: Different Values
cheers, i know its confusing.
On the first page i have nine rows PULLED/TAKEN from the database. All called $skill while ($row = mysql_fetch_array($sql_result)) { $skill = $row["skill"]; } So it gets how many rows in the database where the column header is skill! Skill_001 Skill_002 Skill_003 Skill_004 Skill_005 Skill_006 Skill_007 Skill_008 Skill_009 The problem is because it is doing it by pulling it from the database, they ALL have ONE (1) value. The next page Select * from skill WHERE last_page_value = "$skill" so they all have 1 value. It seems to be overwriting each row at a time and only passes over the last row, but i need ALL 9 if thats how many are in the database. Hope this helps you understand more. Thank you VERY Much. Adam |
|
#4
|
|||
|
|||
|
RE: Different Values
Well, two things:
1) why are you doing a select * when you want values from one column? If you modify your select to say SELECT skill FROM <blah> then the code I posted should work for you. 2) If you *must* use SELECT * Then change the variable $skill in page one in the while loop to $skill[] and follow the rest of what I posted, except that on the page two stuff I posted you will change any reference to $row into $skill Cheers, Keith. |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Different Values |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|