mysql_query returning boolean instead of mysql ressource
Posted on
16th Feb 2014 07:03 pm by
admin
Hi,
I seem to have a weird issue with the php command mysql_query. I pass 2 arguments the query in a string format (SQL is working properly) and a database ressource which is also good. The problem is that even with good parameters, the mysql_query returns me bogus data
exact code that cause problem
Code: public function execute($query){
$result = mysql_query($query, $this -> ressource);
return $result;
} // execute
the full database object code
Code: class DBconnexion{
private $host; // database url/host
private $user; // database login name
private $pass; // database login password
private $db; // database name
private $ressource; // mysql ressource for database
public function DBconnexion($db_host, $db_user, $db_pass, $db_name){
$this -> host = $db_host;
$this -> user = $db_user;
$this -> pass = $db_pass;
$this -> db = $db_name;
// connect to database
$cnDB = mysql_connect($this -> host, $this -> user, $this -> pass);
mysql_select_db($this -> db, $cnDB);
// store database ressource in database object
$this -> ressource = $cnDB;
} // DBconnexion (constructor)
// getter for database ressource
public function get(){
return $this -> ressource;
} // get_connexion
public function execute($query){
$result = mysql_query($query, $this -> ressource);
return $result;
} // execute
public function number($sqlRessource){
$result = mysql_num_rows($sqlRessource);
return $result;
} // number
public function row($sqlRessource){
$result = mysql_fetch_row($sqlRessource);
return $result;
} // row
} // DBconnexion
No comments posted yet
Your Answer:
Login to answer
311
37
Other forums
Google voice
I currently have a form in html, but I want it in php so the information is not in the source code.<
[Need Help] php timing issues
I don't know what is going wrong. I need some help with being able to set an image at 9:00am Colorad
Regarding accessing SQL query issued by any user in Oracle 10g
Hi all,
i want to know the queries issued by various users accessing a database...
HELP with mysql_real_escape_string
I'm looking to remove apostrophes completely when someone enters lyrics but don't have a clue how to
simple php table loop
Hi all,
I've the following code
<?php // Create category options
Points for Wiki contribution
Hi everyone,
I want to know how long does it take for the moderator to award points for a
Schedule editor
Hi,
I have a question related to Schedule editor.
If we schedule a BLS for every 30
Help me with some material on Open Text Overview.
Hi Experts,
Please help me out with some material on Open Text. I have been supporting AP Workf
Get Total From While Loop
I'm trying to get the total for each product and add them for a Grand Total to list outside the loop
Problem in String replace program's output
Hi all,
I was trying to make a program which accepts a string and replaces it with another stri