Jump to content

PHP/SQL issue. Incorrect Syntax?


FlashNinja

Recommended Posts

So I have a little problem here. I'm trying to put a limit on an SQL Query, simple. The problem that is arising is that the variables I am using to denote the limit values are causing some funky MySQL syntax error.

 

This is the error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''0','20'' at line 1

 

Here's the snippet of code that appears to be causing the error. The variables being used for the limit are the values I expect them to be so that doesn't seem to be the issue here.

 

if(isset($_GET['page']))
{
$page = $_GET['page'];
}
else
{
$page = 1;
}

$start_from = ($page-1) * 20;
$end = $page * 20;
$ads = mysql_query("SELECT * FROM ad WHERE usr ='$member' ORDER BY id DESC LIMIT '$start_from','$end'") or die(mysql_error());
$numRowsa = mysql_num_rows($ads);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.