Bill F
2007-04-06 16:07:47 UTC
I am trying to check for '$date' & '$mileage' but when I give them a value
that is not in the table $result = 2 & the 'if' statement fails to create
the new record, or just print "create DMID" in this case. $result seems to
always = 2. num_rows shows correct (0 or 1) & the DMID is printed if
$date & $mileage are in the table.
What am I doing wrong?
-----------
$result = mysql_query("select DMID from DateMileage where date = '$date' and mil
eage = '$mileage'");
printf("Rows = ".mysql_num_rows($result));
$data=mysql_fetch_object($result);
printf(" data= $data->DMID");
printf("<BR>Result = $result, Mileage = $mileage, Date= $date");
printf("<BR>Year = $year, Make = $make, Model = $model");
printf("<BR>Category = $category");
if( !$result )
{
prinf("<P>create DMID");
}
else
{
print("<P>Found DMID");
//$DMID = mysql_fetch_object($result);
}
that is not in the table $result = 2 & the 'if' statement fails to create
the new record, or just print "create DMID" in this case. $result seems to
always = 2. num_rows shows correct (0 or 1) & the DMID is printed if
$date & $mileage are in the table.
What am I doing wrong?
-----------
$result = mysql_query("select DMID from DateMileage where date = '$date' and mil
eage = '$mileage'");
printf("Rows = ".mysql_num_rows($result));
$data=mysql_fetch_object($result);
printf(" data= $data->DMID");
printf("<BR>Result = $result, Mileage = $mileage, Date= $date");
printf("<BR>Year = $year, Make = $make, Model = $model");
printf("<BR>Category = $category");
if( !$result )
{
prinf("<P>create DMID");
}
else
{
print("<P>Found DMID");
//$DMID = mysql_fetch_object($result);
}