|
Posted by Jesse Burns aka jburns131 on 11/21/07 05:28
I've got a coding problem here that I could use some help with.
Here's my db class (the config.php only has db connection info):
********************************************************************
<?php
// db_handler.inc
require_once("config.php");
class db {
var $mySQLresult;
function db() {
$this->dbConn = mysql_connect(DB_HOST, DB_USER, DB_PW);
mysql_select_db(DB_NAME, $this -> dbConn) or
die(mysql_error());
}
function db_Select($tables, $columns="'*'", $conditions="") {
$sql = "SELECT ".$columns." FROM ".$tables." ".$conditions;
$row = mysql_query($sql, $this -> dbConn) or
die(mysql_error());
$this->mySQLresult = $row;
}
function db_Fetch($type = MYSQL_BOTH) { //MYSQL_ASSOC
$row = mysql_fetch_array($this -> mySQLresult, $type) or
die(mysql_error());
if ($row) {
return $row;
} else {
return FALSE;
}
}
}
?>
********************************************************************
Here's the code I'm executing:
********************************************************************
<?php
require_once("includes/db_handler.inc");
require_once("includes/config.php");
echo "Hit 1<br />";
$sql = new db;
$result = $sql -> db_Select(DB_TABLE_ORG_INFO);
while ($row = $sql -> db_Fetch()) {
$organization_disclaimer =
$row['organization_disclaimer'];
}
echo "Hit 2<br />";
?>
********************************************************************
For some reason, the while loop is halting execution and won't display
"echo "Hit 2<br />";". The script just stops executing.
Any idea's why?
I'm using php5
[Back to original message]
|