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
Help with setcookie()
Merry Xmas to those on this foruum
Older guy here with some experience but not allot so please be
How to display objects in a row
I have 7 codes that i want to display in a row one next to another.
The first is {$ads->ad
why aint this working?
i have this code:
Code: $num = 250;
$count = ($num - $rcount);
echo $rc
smart reading from a text file
Hello there fellow coders, i was wondering if one of you wouldnt mind helping me with this problem i
do while conditions
i want to display 6 images in a 2x3 table
now what would be the correct logic to
count that th
exclude characters from counting?
Hello, I wanted to ask if you have a string like:
Code: $my_s='ASRGREGTGTR----REGREGRE+++RRRRRR..
Forum tutorial
Im a beginner in PHP. Im making a forum(previous questbook, counter and few others) to learn. For no
Using unserialize()
Hi there.
I have some data in my database that is serialized.
e.g.
a:2:{i:0
date function help
i need help with date function
Code: [Select]<!DOCTYPE HTML PUBLIC "-//W3C//DTD H
Prevent PHP mail( ) from appending hostname to from address
Hey guys,
I want to be able to send texts to phones via email (since each phone has their own