lional Posted July 10, 2006 Share Posted July 10, 2006 Hi AllI 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.ThanksLional Quote Link to comment https://forums.phpfreaks.com/topic/14205-multiple-records/ Share on other sites More sharing options...
SQL_F1 Posted July 11, 2006 Share Posted July 11, 2006 ???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. Quote Link to comment https://forums.phpfreaks.com/topic/14205-multiple-records/#findComment-55940 Share on other sites More sharing options...
lional Posted July 11, 2006 Author Share Posted July 11, 2006 $query = "SELECT * from availability"; $result = mysql_query($query, $conn); while ($row = mysql_fetch_array($result)){ $booking_date_out = $row[booking_date];} Quote Link to comment https://forums.phpfreaks.com/topic/14205-multiple-records/#findComment-56007 Share on other sites More sharing options...
fenway Posted July 11, 2006 Share Posted July 11, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/14205-multiple-records/#findComment-56057 Share on other sites More sharing options...
lional Posted July 11, 2006 Author Share Posted July 11, 2006 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 lotLional Quote Link to comment https://forums.phpfreaks.com/topic/14205-multiple-records/#findComment-56067 Share on other sites More sharing options...
fenway Posted July 11, 2006 Share Posted July 11, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/14205-multiple-records/#findComment-56308 Share on other sites More sharing options...
SQL_F1 Posted July 13, 2006 Share Posted July 13, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/14205-multiple-records/#findComment-57147 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.