Jump to content


Photo

mysql help


  • Please log in to reply
3 replies to this topic

#1 somo

somo
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 11 July 2006 - 11:33 PM

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 lol


What 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";

}

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 11 July 2006 - 11:50 PM

What format are B_CheckoutDate and $Todays_Date? If they are formatted as YYYY-MM-DD, try this:
<?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";
?>

Ken

#3 somo

somo
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 12 July 2006 - 12:01 AM

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?

#4 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 12 July 2006 - 12:13 AM

$amount = mysql_num_rows($rs);

Should do it.
<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users