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

Did you know?Explore Trending and Topic pages for more stories like this.
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

Database connection failure
Hello All,

I am trying to create new connection to Oracle DB 10.1,
I could not see a

cyrillic string conversion question
Hello,

First time here...

I would like to know if there is a way to convert a

How to sum these output values
Hi

I need sum the month totals
SELECT region_name, area_name ,SUM (CASE WHEN S

how to configure ADS in ABAP instance
Hi All,

I am working on r/3 4.7 ABAP system.Can we configure ADS(adobe document services)

Production of mango in processing industry
Hi,

We have one scenario ,company is in process industry,they are manufacturing MANGO pul

Async WSAConnect failed on XP with error code = 2 ("File not found")
Hi all,

I have very strange bug, please help me if you can.

It is reproduced o

captcha error
I have been trying to implement a captcha in php...

here is the code..
Code: (php) [Select

mod_rewrite.c on windows ??
why it's not working on windows while it's working on other hosts???

this is the code i got

does anyone know a php script to send mail using gmails/googles free smtp server
cause i heard u can do that but i dont know how

My query is being run with no results.
I have this.

Code: function DropUser($duser_id, $user_email, $user_username) {

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