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
Is there a way to override built in php functions without APD?
I am trying to use the
rename_function()
override_function()
options that are built into
fopen() security
As i understood the usage of fopen() for it to function correctly the Dir you write to has to be rw
Multithreading in Oracle (Java, SQLJ, Pro*C,??) on 10g
I am investigating how to run a Java stored procedure in multithread mode.
I know that if I chang
Edit MySQL Row Using PHP and HTML Form
Hello,
Here's what I'm trying to do. Build a page where a user enters a MySQL row number in.
Mysql query, two times?
Hello to all,
I'm new to php coding and i like it alot. I need help with some noob stuff.
PHP Search Issue
Hi, I am using the following code to search and return flights from a database. The user searches by
Creating Images from images in PHP
Okay well I am trying to make a 'dynamic' calender image with PHP.
I have images like this:
Protecting forms
Alright, I want to protect some forms of mine from SQL Injections, because I had someone earlier spa
Search with relational database
Hey,
I have quite a complicated (for me anyway ) relational database for an apartments syste
SOAP Issue
Hi,
I am facing some understanding problem with SOAP basic.kindly recommend some SOAP expert.