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.
my login script page is not working on remote computers
hi my login is working on my computer, but when i tried 2 computers from 2 different locations, they couldnt login. any help greatly appreciated. thanks. derek. its setting the hack variable to Y on
PHP Array quick help
I need$_SESSION{'username'} to be like this:if $_SESSION['username'] = "gayner,bob,jesus";echo "ba blah ";but do i use Arrays or what for those 3 nameS? how thanks
How do I replace any number of character occurences with one occurrence?
How do I replace any number of character occurences with one occurrence?Let's say I have:aaaaaaaaaaaaaaaaaaaaaaAll of the above should be replaces with a single 'z' character say for exampleI can do
Email logic not working
I would like to send an email using the php email() function then if it does execute i.e sends i would like to update a particular field in my db.however no matter how hard i try to the code seem to
Upload simple problem
Really confused!! I run once and it worked, but when i tried today...it didn't workWhich part is
LSB (PHP 5.3) problem with static value!
hello,i'm having a problem. static::$text variable gets lost at some point. can someone please correct and explain it to me?Line number On/Off| Expand/Contract <?phpclass A { protected
Get relative path from absolute path
How would one go about getting the relative path to a file from its absolute path?
PHP - MySQL Fail
My PHP code will only execute the first part of my code... Code: <?php session_start(); ?> <html> <head> <title> Create a
Posting to another Site?
I have software that people install.When they install it, is there a way to make it post their domain name to my website?I know I could do a header('location: http//www.mysite.com/id=?domain.com');
PHP mail() rejected by SMTP
I'm currently working on a newsletter application which is installed on a windows 2003 server running apache. This server is scheduled to run a script every 5 minutes that will send an email to 10