PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Does anyone know why PHP would truncate a Sybase Date field return data? We fixed this by returning the data as a string type in short format, but I would be interested to know if anyone else has ever had a similar experience in any return set from any database?
The weird thing is that in the Sybase client, the result is an actual Date datatype in the form Char-Char-Char-space-<space or 0>-Int-space-YYYY. But PHP sees it as a 6 char string with the first three chars as the three chars from the month followed by three spaces and thats it.
I am taking it straight from the database to the browser. This is the assignment code for the result set (keep in mind we are using an enhanced sybase extension that understands multiple result sets - the core code of the Sybase extension is the same. The only add is the check for multiple result sets).
<?php
if ($qry = sybase_query($sql, $con))
{
$show_results = true;
$rs_full = array();
$counter = 0;
do {
$counter++;
//echo '<h1>We are in a result set ' . $counter . '</h1>';
while ($row = sybase_fetch_array($qry)) {
$rs_full[] = $row;
}
} while (sybase_next_result($qry));
sybase_free_result($qry);
}
else
{
echo '<p>There were problems with your query: <strong>' . sybase_get_last_message() . '</strong>';
}
sybase_close();
if ($show_results) {
echo '<pre>';
print_r($rs_full);
echo '</pre>';
}
?>
Also of note... this is my procedure testing code. I use ADODBlite in production using code similar to this in regards to multiple result sets (I forked that one as well).