I am in the process of making a script that will grab dates from a mysql database, find one that is greater than today, and then count the days to that date. Once that date has been reached, the next future date will be used.
I have created a table named date that has a field named eventDate:
+-----------+---------+------+-----+------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+---------+------+-----+------------+----------------+
| ID | int(11) | | PRI | NULL | auto_increment |
| eventDate | date | | | 0000-00-00 | |
+-----------+---------+------+-----+------------+----------------+
Here is the script:
// Connect to the database server
$dbcnx = @mysql_connect("localhost", "username", "password");
if (!$dbcnx) {
echo( "<p>Unable to connect to the " .
"database server at this time.</p>" );
exit();
}
// Select the database
if (! @mysql_select_db("atomicco_bandung") ) {
echo( "<p>Unable to locate the " .
"database at this time.</p >" );
exit();
}
$sql = "SELECT eventDate FROM Date WHERE TO_DAYS(eventDate) > TO_DAYS(CURDATE()) ORDER BY eventDate ASC LIMIT 1";
$res = mysql_result($sql);
$next_date = mysql_result($res, 0);
echo ("here is the Next Date $next_date");
I get an error of
Wrong parameter count for mysql_result()
I think it is some string conversion problem??? Any help?
JJ