Im wondering, can I have a table name with 2 words, ie. 'my table'?
Heres what I have:
Code: Select all
$myTable = "'".$row['prod_name']."'";
$dbquery->buildSelectQuery("*", $myTable, false,'');If I enclose it with ' ' , it then throws:
"Check the manual that corresponds to your MySQL server version for the right syntax to use near ''Arabidopsis Chambers'' at line 1".
Here is the function from my DbQuery class:
Code: Select all
function buildSelectQuery($selectWhat, $table, $where, $whereParams)
{
// $selectWhat = What to select, certain fields or *
// $table = What table to select from
// $where = Check if it needs a WHERE clause - true or false
// $whereParams = What are the paramaters
// check if a WHERE statement is needed
if($where){
$this->queryString = "SELECT ".$selectWhat." FROM ".$table." WHERE ".$whereParams;
}else{
$this->queryString = "SELECT ".$selectWhat." FROM ".$table;
}
$this->result = mysql_query($this->queryString) or die("Could not connect to MySQL database from buildSelectQuery" .mysql_error());
}Thanks
Keith