Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6871697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:50:14+00:00 2026-05-27T03:50:14+00:00

I keep getting this error but this sql statement works fine in mysql it

  • 0

I keep getting this error but this sql statement works fine in mysql it might be something dumb but im wore out from working on it all weekend.

select e.* 
, t.nombre
, c.compania 
, c.nombre 
, c.apellido 
, c.ruc 
, c.direccion 
from envio e 
inner join cliente c on e.cliente_id = c.id 
inner join transporte t on t.id = e.transporte_id 
limit 0, 10;

MySQL 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 'limit 0, 10' at line 11

here’s the var_dump result:

string(263) "select e.* , t.nombre as transporte_nombre , c.compania , c.nombre , c.apellido , c.ruc , c.direccion from envio e inner join cliente c on e.cliente_id = c.id inner join transporte t on t.id = e.transporte_id limit 0, 10" MySQL 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 'limit 0, 10' at line 11

Here’s my code, now I am using 2 classes for this 1 is my db connection which works fine(tested with other pages) and the other is the one that returns the select.

if(!empty($_REQUEST['page']))
    $page = $_REQUEST['page'];
else
    $page = "1";

$limit = 10;    
if($page)
    $start = ($page - 1) * $limit; 
else
    $start = 0; 

require_once("../class/sql.php");
$db = new MySQL();  

require_once("../class/envios.php");
$envios = new Envio();
var_dump($envios->BuscaEnvios("",$start,$limit));

if(is_array($conditions))
    $consulta = $db->consulta($envios->BuscaEnvios($conditions,$start,$limit));  
else
    $consulta = $db->consulta($envios->BuscaEnvios("",$start,$limit));  

if($db->num_rows($consulta) > 0)
    $total_pages = $db->num_rows($consulta);
else 
    $total_pages = 0;

In class “Envios”:

public function BuscaEnvios($conditions, $start, $limit)
{
        $sql = "select 
              e.*
            , t.nombre as transporte_nombre 
            , c.compania
            , c.nombre
            , c.apellido
            , c.ruc
            , c.direccion
        from envio e 
        inner join cliente c on e.cliente_id = c.id
        inner join transporte t on t.id = e.transporte_id ";

        if($conditions != "")
            $sql .= ' where '. implode(' AND ', $conditions);

        $sql .= " limit $start, $limit";

        return $sql;

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:50:14+00:00Added an answer on May 27, 2026 at 3:50 am

    try this code in your function

    if(sizeof($conditions)>0)
              {
                $sql .= " where ".implode(' AND ', $conditions);
              }
    
            $sql .= " limit $start, $limit";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying this SQL statement but I keep getting an error Run-time error '3061':
I'm trying to make this ASP/SQL statement to work but I keep getting ORA-01036:
I'm trying to use slime from CVS (2009-01-05) but keep getting this error: LOAD:
Im trying to use Date Formatters (NSDateFormatter), but I keep getting this error: Program
Using this SP I keep getting an error on the UPDATE statement indicating that
Keep getting this error after inserting a subdatasheet into a query and trying to
I keep getting this error System.Web.HttpException was unhandled by user code Message=Validation of viewstate
I keep getting this error when I try to commit a group of executed
I keep getting this error when I try to call Find() public void findTxt(string
I keep getting this error all over the place where I only have jquery

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.