MySQL not accepting my query string

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
andrew_hodgson
Forum Newbie
Posts: 9
Joined: Fri Mar 12, 2010 9:09 am

MySQL not accepting my query string

Post by andrew_hodgson »

I can't understand why this is not working, the query string looks line to me, or am I just being blind!

Code: Select all

$query  = "SELECT * ";
$query .= "FROM subjects ";
$query .= "WHERE id=" . $subject_id . " ";
$query .= "LIMIT 1";
    
$result_set = mysql_query($query, $connection);
confirm_query($result_set); 
when I echo the query string it looks like this,

Code: Select all

SELECT * FROM subjects WHERE id=1 LIMIT 1
I'm getting the error back from the confirm_query function and my php error log is giving me this to think about,
mysql_query(): supplied argument is not a valid MySQL-Link resource
andrew_hodgson
Forum Newbie
Posts: 9
Joined: Fri Mar 12, 2010 9:09 am

Re: MySQL not accepting my query string

Post by andrew_hodgson »

Can a mod delete this thread, there is nothing wrong with the string, I hadn't open the connection before I called the function to query the db.
Post Reply