Jump to content

Archived

This topic is now archived and is closed to further replies.

lional

multiple records

Recommended Posts

Hi All
I am trying to runa query where I have multiple records each containing a date.
I want to use these dates to change the background of my table using php at a later stage.
My problem is that each date that is pulled overwrites the previous date, whch means that the end of the queryonly the last date is shown.
Is there a way to run a query so that all the dates are stored and that they can all be referenced.

Thanks
Lional

Share this post


Link to post
Share on other sites
???
Give us your query.

Also execute the MySQL statement
[code]describe [i]<table name>[/i][/code]
so that we can see what the table looks like.



Share this post


Link to post
Share on other sites
$query = "SELECT * from availability";
$result = mysql_query($query, $conn);
while ($row = mysql_fetch_array($result)){
$booking_date_out = $row[booking_date];
}

Share this post


Link to post
Share on other sites
Well, quotes around the bareword "booking_date" would probably be a good start; however, sound like you want to be pushing each date onto an array.

Share this post


Link to post
Share on other sites
I fel the same ay, but I am nt sre how t pul a aray fom mysql. Cold you be so king to pint me in the right direction.

thanks a lot
Lional

Share this post


Link to post
Share on other sites
Has nothing to do with MySQL... instead of setting each date to the same scalar variable, since create an array, and push onto it... this is entirely contained within PHP.

Share this post


Link to post
Share on other sites
What else are you doing within the while loop?

If it is only to collect the dates, then look at php.net for php's extensive array_ functions including array_push

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.