jQWidgets Forums

jQuery UI Widgets Forums Grid SQL Error 1: You have an error in your SQL syntax;

Tagged: 

This topic contains 2 replies, has 1 voice, and was last updated by  timcadieux 12 years, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author

  • timcadieux
    Member

    I haven;t been able to get this Grid to work and in my troubleshooting, I attempted to run just data.php to see what I could see.

    I get this

    SQL Error 1: 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 ” at line 1

    I only changed the mySQL aspects of the file, so my first few lines still look like this…any ideas?

    <?php
    #Include the connect.php file
    include('connect.php');
    #Connect to the database
    //connection String
    $connect = mysql_connect($hostname, $username, $password)
    or die('Could not connect: ' . mysql_error());
    //Select The database
    $bool = mysql_select_db($database, $connect);
    if ($bool === False){
    print "can't find $database";
    }
    // get data and store in a json array


    timcadieux
    Member

    Ok, i managed somehow to fix the SQL query

    i next get a return JSON but when i load my index.php, nothing appears

    [{"TotalRows":"29019","Rows":[{"ID":"1","Surname":"ABRAHAMS","Forenames":"JOHANNES"},{"ID":"2","Surname":"ABRAHAMS","Forenames":"JOHN ANDREW WILLIAM"},{"ID":"3","Surname":"ABRAHAMS","Forenames":"JAMES BERNARD"},{"ID":"4","Surname":"ABRAHAMS","Forenames":""},{"ID":"5","Surname":"ABRAHAMS","Forenames":""},{"ID":"6","Surname":"ABRAHAMS","Forenames":"NICHOLAS"},{"ID":"7","Surname":"ABRAHAMS","Forenames":"NATHANG"},{"ID":"8","Surname":"ABRAHAMS","Forenames":"NICHOLAS JOHANNES DANIEL"},{"ID":"9","Surname":"ABRAHAMS","Forenames":"STEPHEN"},{"ID":"10","Surname":"ABRAHAMS","Forenames":""},{"ID":"11","Surname":"ABRAHAMS","Forenames":"WILLIE"},{"ID":"12","Surname":"ABRAHAMS","Forenames":""},{"ID":"13","Surname":"ABRAHAMS or ABRAMS","Forenames":"JOHN"},{"ID":"14","Surname":"ABRAHAMSE","Forenames":"CYRIL WILLIAM"},{"ID":"15","Surname":"ABRAHAMSON","Forenames":""},{"ID":"16","Surname":"ABRAM","Forenames":null},{"ID":"17","Surname":"ABRAMOWITZ","Forenames":"ABRAHAM ELIJAH"},{"ID":"18","Surname":"ABRAMS","Forenames":"DAVID"},{"ID":"19","Surname":"ABRAMS","Forenames":"JOHN"},{"ID":"20","Surname":"ABRAMS","Forenames":"JOHN"}]}]
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <link rel="stylesheet" href="/jqwidgets/styles/jqx.base.css" type="text/css"/>
    <link rel="stylesheet" href="/jqwidgets/styles/jqx.classic.css" type="text/css"/>
    <script type="text/javascript" src="/scripts/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="/jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="/jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="/jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="/jqwidgets/jqxmenu.js"></script>
    <script type="text/javascript" src="/jqwidgets/jqxgrid.js"></script>
    <script type="text/javascript" src="/jqwidgets/jqxgrid.selection.js"></script>
    <script type="text/javascript" src="/jqwidgets/jqxgrid.filter.js"></script>
    <script type="text/javascript" src="/jqwidgets/jqxgrid.sort.js"></script>
    <script type="text/javascript" src="/jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="/jqwidgets/jqxlistbox.js"></script>
    <script type="text/javascript" src="/jqwidgets/jqxgrid.pager.js"></script>
    <script type="text/javascript" src="/jqwidgets/jqxdropdownlist.js"></script>
    <script type="text/javascript">$(document).ready(function(){var theme='classic';var source={datatype:"json",datafields:[{name:'ID'},{name:'Surname'},{name:'Forenames'}],url:'data.php',cache:false,filter:function()
    {$("#jqxgrid").jqxGrid('updatebounddata','filter');},sort:function()
    {$("#jqxgrid").jqxGrid('updatebounddata','sort');},root:'Rows',beforeprocessing:function(data)
    {if(data!=null)
    {source.totalrecords=data[0].TotalRows;}}};var dataadapter=new $.jqx.dataAdapter(source,{loadError:function(xhr,status,error)
    {alert(error);}});$("#jqxgrid").jqxGrid({source:dataadapter,theme:theme,filterable:true,sortable:true,autoheight:true,pageable:true,virtualmode:true,rendergridrows:function(obj)
    {return obj.data;},columns:[{text:'ID',datafield:'ID',width:100},{text:'Surname',datafield:'Surname',width:200},{text:'Forenames',datafield:'Forenames',width:180}]});});</script>
    </head>
    <body class='default'>
    <div id='jqxWidget' ">
    <div id="jqxgrid"></div>
    </div>
    </body>
    </html>

    timcadieux
    Member

    Managed to sort myself. Was a path issue. sorry!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.