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

311 Like 37 Dislike
Previous php-forum Next php-forum
Other php-forum

Business Health Check
Hello

I need to create an online business health check for a client it will be multiple choi

Month String to Numeric?
Hi guys,

Given a month as a string, is there a simple way to find the numeric representation

finding key position of specified value in multi-dimensional array
Code: $openedfile = fopen($tfc_file4, "r");
$rc = 1;
while(!feof($openedfile))
{<

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
what is wrong with this

Code: [Select]<?php
if ($_SERVER['HTTP_REFERER'])
{

Convert Binary String to Decimal
Trying to Get:
Decimal: 305419896

Out of:
Binary String: xV4

how to timeout $doc = new DOMDocument()->load($url)
I am currently using this $doc->load($url) to fetch an rss feed.
If a feed takes long than

matching numbers inside ( )
I know I can match numbers by just [0-9]+, so I thought matching numbers inside ( ) would be somethi

Logic question
im wondering what's the best method to do the above list:

it is for alliance @ MMORPG game

Just wondering what you think about my site
I am new to phpfreaks i just seen this form and thought it would be cool to see what other thought a

Need help with PHP/MySQL drop down menu
I need help on how I can implement a drop down menu which queries mysql database and output the avai

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