Here is where it is not working:
include 'dblinks.php';
mysql_select_db("DB_NAME");
$date_exp = explode("-",$dateSel);
$time_exp = explode(":",$timeSel);
$c = mktime($time_exp[0],$time_exp[1],$time_exp[2],$date_exp[1],$date_exp[2],$date_exp[0]);
$d = ($c + (60 * getServValue($businessID, $serviceID,"duration")));
$time_exp = explode(":",getBizValue($businessID,strtolower(date("l",$dateSel)."_start")));
$start = mktime($time_exp[0],$time_exp[1],$time_exp[2],$date_exp[1],$date_exp[2],$date_exp[0]);
$time_exp = explode(":",getBizValue($businessID,strtolower(date("l",$dateSel)."_finish")));
$finish = mktime($time_exp[0],$time_exp[1],$time_exp[2],$date_exp[1],$date_exp[2],$date_exp[0]);
if (($c >= $start) && ($c <= $finish) && ($d <= $finish) && (getBizValue($businessID,strtolower(date("l",$dateSel)."_closed")) == 'F')) {
$query = "SELECT * FROM `TABLE_NAME` ";
$query .= "WHERE `business_id` = ".$businessID." and ";
$query .= "`date_main` = '".$dateSel."' ";
$query .= "ORDER BY `time_main`";
$result = mysql_query($query, $sql);
$num = mysql_num_rows($result);
echo 'Number of Rows: '.$num.'<BR>';
if ($num > 0) {
$arrDepth = array();
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo 'The date returned is: '.$row["date_main"].'<BR>';
And here is an example of where it is:
$query = "SELECT * FROM `TABLE_NAME` WHERE `business_id` = " . $_SESSION["login_id"];
$result = mysql_query($query, $sql);
$num = mysql_num_rows($result);
if ($num > 0) {
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
// Spit it out
echo '<OPTION Value="' . $row["id"] . '">' . $row["name"] . '</OPTION>';
}
}
In the first example, the date_main field returns null, the number of rows returns is one, so it does go in to the loop. While phpMyAdmin can show all fields in this same query. If I use:
sizeof($row)
This returns 0. How can that be when I use "SELECT *", and the mysql_num_rows returns the correct value of 1??? 😕
Cheers,
Jess.