Mysql

maddude

overall phsyco
Messages
256
Reaction score
0
Points
0
heres my problem i have a database with a table named thingys when you do a database query that has mulitple results does it put it into an array of them or just the first one it has that matches the query :blink:
 

Chris

New Member
Messages
1,538
Reaction score
0
Points
0
I think alot of people close the window or tab of this when they see no punctuation... Care to add some? I can barely understand you.
 

Chris

New Member
Messages
1,538
Reaction score
0
Points
0
maddude said:
heres my problem...

i have a database with a table named thingys. when you do a database query that has mulitple results, does it put it into an array of all of the results or just the first one it has that matches the query? :blink:

Maybe I'm not understanding the question, but can't you find that out yourself by trying it?
 

maddude

overall phsyco
Messages
256
Reaction score
0
Points
0
OH FOR HECKS SAKE, IF THERE ARE MORE THAN ONE POSSIBLE RESULTS FOR A MYSQL QUERY E.G . THE FIELD POSSESS ONE ,OF THE SAME PROPERTYS. WHEN YOU GO TO PRINT IT IT JUST DISPLAYS THE ONE AND THE OTHERS DONT APPEAR HOW DO I USE MYSQL TO SELECT ALL RESULTS MAT :devil: :devil: :devil: :devil: CHING THAT QUERRY AND PUT THEM INTO AN ARRAY.
 

Jimbob

New Member
Messages
320
Reaction score
0
Points
0
I don't think that yelling is the right way to go about getting an answer, if you aren't clear its really hard to answer you, In fact. I still don't know what you want..
 

bigguy

Retired
Messages
10,984
Reaction score
10
Points
38
maddude said:
HOW DO I USE MYSQL TO SELECT ALL RESULTS MATCHING THAT QUERRY AND PUT THEM INTO AN ARRAY.

I think this is part of your question you want to print out all results matching a specific query is this right
 

maddude

overall phsyco
Messages
256
Reaction score
0
Points
0
bigguy said:
maddude said:
HOW DO I USE MYSQL TO SELECT ALL RESULTS MATCHING THAT QUERRY AND PUT THEM INTO AN ARRAY.

I think this is part of your question you want to print out all results matching a specific query is this right
yep into an array ready for printing! :) or into a string :) :grin:
 

bigguy

Retired
Messages
10,984
Reaction score
10
Points
38
maddude said:
bigguy said:
maddude said:
HOW DO I USE MYSQL TO SELECT ALL RESULTS MATCHING THAT QUERRY AND PUT THEM INTO AN ARRAY.

I think this is part of your question you want to print out all results matching a specific query is this right
yep into an array ready for printing! :) or into a string :) :grin:

Well I don`t know much about mysql db but now that the question is somewhat cleared up maybe someone else can help
 

maddude

overall phsyco
Messages
256
Reaction score
0
Points
0
thanks for clearing up my long winded explination there big guy does anyone know how to do what he just said? :grin:
 

maddude

overall phsyco
Messages
256
Reaction score
0
Points
0
since i cant edit my last post for some reason. Can someone please tell me, how to print all matching results, from a mysql query. For some reason it prints one of the matching results, but how do i print them all the results for 1 sql query into an Array()! can someone please tell me, I really need to do so thanks - mike.
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
You know? You have to do something like:

Code:
$results = mysql_query("SELECT * FROM `table` WHERE `blah` = '$blah'") or die(mysql_error());
while ($row = mysql_fetch_array($results))
{
// Do What Ever Here...
}
Just replace table with your table name. You can add more "WHERE `blah` = '$blah" 's if you wanted, just seperate each "one" with a "AND", so if you wanted to have to you would do:
Code:
$results = mysql_query("SELECT * FROM `table` WHERE `blah` = '$blah' AND `why` = '$why'") or die(mysql_error());
Of you could have No "WHERE" 's in there, and pull every row out of the table:
Code:
$results = mysql_query("SELECT * FROM `table`") or die(mysql_error());
No matter what, you should get some results put into the variable $row, in an array for each row pulled. The While loop will go through that array, once for each row, and place the infomation pulled from the database in that row, and do what you want it to do with that row.

I hope that answered your question :-/
 
Top