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 Like 37 Dislike
Previous forums Next forums
Other forums

Form File Upload
I've read through tons of resources and tutorials and as far as I can tell, my code is accurate, but

temporary objects
Until now i thought every temporary object in C++ is created as constant. I'm wondering why my compi

Can anyone give me some link on .htaccess tutorial
i wish to have friendly url using .htaccess, but no idea yet about this

Hope that anyone cou

please hep to get values from a table row
can anyone tel me how I can select and get data from one row by pressing an Edit button in that row

Undefined index on my form
ok im getting Undefined index on this line.. print_r($_REQUEST['form']);

below is the full sc

Limiting uploaded file type
Hi. First post here
I am working on a simple upload script, and I need it to limit the allowed f

Calculating n! using vector
#include
#include
#include

using

Module pool selction screen parameters combination logic
Hi floks,
Am new to the module pool development ,Recently i have created one program based on

using variables in another page
I have a test database set up on localhost. I have a form that I can type a name into, hit the butto

Warning: session_start() headers already sent error - Driving me Nuts!
I am trying my sister in laws site and I keep getting an error with my coding. I am more of a design

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash