close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Error in SQL syntax

Thread began 9/21/2015 2:58 pm by mrobben375515 | Last modified 9/22/2015 12:00 pm by Ray Borduin | 1416 views | 6 replies |

mrobben375515

Error in SQL syntax

I am trying to do a repeat region in the attached php. The section is titled "Latest Inductees". I want to have only the inductees displayed that are in the most recent year only. When I posted the file, the page (http://loyalneighbor.com/index-test.php) only shows "Error in SQL syntax". Can you see how I set the mysqli to do this? I suspect that is where the syntax error is coming from. Y

Sign in to reply to this post

Ray BorduinWebAssist

Open up your rsobj.php file and turn on debugging. It will give you more information about why the query is failing.

Sign in to reply to this post
Did this help? Tips are appreciated...

mrobben375515

sorry, but I have never debugged a rsobj.php page before. how do I turn that on?

Sign in to reply to this post

Ray BorduinWebAssist

Open up the file and you will see a line near the top that says: debug=false

Change it to: debug=true

Sign in to reply to this post
Did this help? Tips are appreciated...

mrobben375515

Thank you Ray, I found the error. I wanted to design the query such that it sorts the "years" in descending order and pulls only the first record when doing that, then it queries all inductees matching that value. The page is now working, except it is returning all inductees in descending year order. I just want those inductees matching the first record in descending order in the "years" table. How can I edit the sql statement to do this? I have MySQLi, but I could not figure it out. The record set I have currently reads as below:

<?php
$catinductee = new WA_MySQLi_RS("catinductee",$PowerCMSConnection_i,1);
$catinductee->setQuery("SELECT inducteecat.cat, inductees.* FROM inducteecat INNER JOIN inductees ON inducteecat.cat = inductees.cat ORDER BY inducteecat.cat ASC, inductees.lastname ASC");
$catinductee->execute();
?>

Sign in to reply to this post

Ray BorduinWebAssist

You would have to add WHERE clause filtered with a parameter to all of the recordsets you want filtered by the first and set the parameter value to the row returned by the first recordset.

Sign in to reply to this post
Did this help? Tips are appreciated...

mrobben375515

That did it. The MySQLi really helps with SQL statements.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...