function select($sql="")
{
print "\nselect $sql\n";
if (empty($sql)) {
print ("empty sql");
return false;
}
if (empty($this->CONN)) {
print ("empty conn");
return false;
}
$conn = $this->CONN;
$results = mysql_query($sql,$conn);
if ((!$results) or (empty($results)))
{
print ("empty results");
return false;
}
$count = 0;
$data = array();
while ($row = mysql_fetch_array($results)) {
$data[$count] = $row;
$count++;
}
mysql_free_result($results);
return $data;
}
The above is the function with the debugging print statements I added. I don't beleive it's incorrect since it works fine with the session check (when I don't have the print statements in there, obviously). When I pass it the simple sql statement: "select * from tablename" it prints "empty results".
Here's the function without the debugging prints added:
function select($sql="")
{
if (empty($sql)) return false;
if (empty($this->CONN)) return false;
$conn = $this->CONN;
$results = mysql_query($sql,$conn);
if ((!$results) or (empty($results)))
{
return false;
}
$count = 0;
$data = array();
while ($row = mysql_fetch_array($results)) {
$data[$count] = $row;
$count++;
}
mysql_free_result($results);
return $data;
}