I've got a client that has a database with about 200 events at any given time. I'm trying to loop through the dates based on a form and show the title of the event if the start date of the form matches the start date of the event. My code:
Code: [Select]// dates
$start_date = "2009-10-24";
$end_date = "2009-11-20";
// open database connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
// select database
mysql_select_db($db) or die ("Unable to access database!");
// build query
$qry = "SELECT * FROM table ORDER BY start_date asc";
$result = mysql_query($qry) or die("Error during query!");
// loop through every day from $start_date to $end_date
for ($d=strtotime($start_date);$d<=strtotime($end_date);$d+=86400)
{
echo date("Y-m-d", $d) . "
";
while ($row = mysql_fetch_array($result))
{
//echo $row[event_id] . " - ";
if (strtotime($row[start_date]) == $d)
{
echo $row[title] . "
";
}
}
echo "
";
}
I get a list of dates from the start date to the end date but the only titles I see are for the first date even though other titles should be showing. I know this isn't optimal coding - (the record count will never go beyond a few hundred) - but I'm wondering why nothing beyond the first date is outputting. Any help would be appreciated.
Registration
ok so i have a site where people can register and login which works now thanks to someone on here that pointed out my error :-)Now my users click my links they can view the content without logging in,
limitations on array_unique()
Does any one know what/how imitations are applied to array_unique? I have an issue where no matter how big (as in over this limit) the array is array_unique always returns an array with 32768
Problem with array max size.
Hi to everyone,
Not connecting to DB using ruby, error:env.c:257:in oci8lib.so: ORA-12154:
Hi All,I am trying to connect to the database server from the client server using ruby and facing the following issue-$ruby -r oci8 -e "OCI8.new('temp','temp','//host:1521/sid').exec('select count(1)
Limiting uploaded file type
I am working on a simple upload script, and I need it to limit the allowed file type that is uploaded to only .mpr files. .mpr files are not a MIME file type so I do not know how to limit it. Any
Help with PHP and checkboxes
I am posting this for a friend of mine, i wrote a small script for her to process her form data to an email but in testing i am having trouble getting the checkbox data to display in the email it
PHP, Arrays & A Lot Of Confusion
I've been doing basic PHP work on sites for a few years now, but I've never been tempted to learn how the ARRAY function worked, nor in what instances to use it. Now I've stumbled upon the jCarousel
Combining Two Queries
I have two scripts that each work fine by themselves. One is a search script with a variable that depends on what people search for. That will display results, but they are in a single column. I want
extract a file from zip file
hi,i know how to unzip a zip file in php, but is there a way to just extract a certain file only?
Most basic form question ever?
Hello,I want to use this snippet to make sure the fields in a form are ok before processing it.Code: <FORM method="post">To:<input type="text"