getting weird error..


Posted on 16th Feb 2014 07:03 pm by admin

okay, I'm getting an error on this particular function, something about the syntax in the mysql LIMIT statement, but as far as I can see I have it right, currently using easymysql3.0 as test server, which was latest version as of a couple weeks ago.

Code: function get_subject_by_id($subject_id) {
global $connection;
$query = "SELECT * ";
$query .="FROM subjects ";
$query .="WHERE id=" . $subject_id . " ";
$query .="LIMIT 1"; //this is the line I'm having problems with comes up as syntax error ***this is where problem is at least the one I know about***
$result_set = mysql_query($query, $connection);
confirm_query($result_set);
//if no rows are returned fetch array will return false
if ($subject = mysql_fetch_array($result_set)) {
return $subject;
} else {
return NULL;
}
}
I'd really appreciate the help, thanks for looking at it.

No comments posted yet

Your Answer:

Login to answer
109 Like 9 Dislike
Previous forums Next forums
Other forums

Printing issues with xMII 11.5
For some reason, we have one report (and only one) that is giving us fits when trying to print. The

Syntax Help
Code:


im having trouble with that code snipped
Parse error: syntax error, unexpec

Fatal error: Call to a member function fetchrow() on a non-object in C:xamppht
okay i have this query and everytime i add `item_id`=? to it... it gives me the error in the title..

Php Mysql Page Loading Notice
Hi all,

I was wondering if there is a way (Sure there is) of showing a message or an image wh

Content-Disposition: attachment; filename=... not working as i thought it should
taken the following code from the php.net site the script is not working.

what is not happeni

foreach iterator
Hi Guys
Does the foreach loop have an inbuilt iterator ?

Variables and Include
Code: [Select]<?php

$header = $_COOKIE['mss']['header'];
$body = $_COOKIE['mss']['b

SELECT * FROM users WHERE Users are not in Blocked
How do I select all users from users table where there users_id is not stored in the block table

Find occurences of unicode characters in string
I need to prohibit filenames with everything but English characters and numbers but regexp and strin

rename the file
File.txt

Code: ***DOCUMENT***
..DN:
000044255
..CB:
..SN:
..PY:
2009
..E

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