somo Posted July 11, 2006 Share Posted July 11, 2006 i realise the code below is cr@p but can any one tell me how i can retrieve all todays dates (i.e. $Todays_Date) and return the number of rows that exist in all of the "B_Checkout" field this is all i need . Can any one help i realise this is simple and will kick myself when im told but i have been workin for to long and my brain is warped lolWhat ive got at mo:$result = mysql_query("SELECT B_CheckoutDate FROM Bookings WHERE B_CheckoutDate = ".$Todays_Date." ") or die(mysql_error()); while ($get_info = mysql_fetch_row($result)){ foreach ($get_info as $field) print "\t<td><p>$field</p></td>\n"; } Quote Link to comment https://forums.phpfreaks.com/topic/14339-mysql-help/ Share on other sites More sharing options...
kenrbnsn Posted July 11, 2006 Share Posted July 11, 2006 What format are B_CheckoutDate and $Todays_Date? If they are formatted as YYYY-MM-DD, try this:[code]<?php$q = "SELECT B_CheckoutDate FROM Bookings WHERE B_CheckoutDate = '$Todays_Date'";$rs = mysql_query($q) or die("Problem with query: $q<br>" . mysql_error());while ($row = mysql_fetch_assoc($rs)) echo "\t<td>" . $row['B_CheckoutDate'] . "</td>\n";?>[/code]Ken Quote Link to comment https://forums.phpfreaks.com/topic/14339-mysql-help/#findComment-56520 Share on other sites More sharing options...
somo Posted July 12, 2006 Author Share Posted July 12, 2006 that isn't doing anything (and theres not even errors ???)the format is D M Y e.g. 09 July 2006.i just need the amount of fields in the database that have todays date.if there are 2 fields with 11 July for example (i need a variable to store 2)any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/14339-mysql-help/#findComment-56530 Share on other sites More sharing options...
ShogunWarrior Posted July 12, 2006 Share Posted July 12, 2006 $amount = mysql_num_rows($rs);Should do it. Quote Link to comment https://forums.phpfreaks.com/topic/14339-mysql-help/#findComment-56539 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.