MySQL Error 1604
Posted: 12 July 2008 01:48 PM   [ Ignore ]
Jr. Member
RankRank
Total Posts:  32
Joined  2008-07-11

Hello! I just installed Rating 2.1.2 yesterday, as it’s something I’d really like to get going on my site.

The goal of the installation is just to get average ratings, no reviews.

I installed it as per the readme instructions and am getting an error on the page that has the rating code included. This is the error:

MySQL ERROR:

Error Number: 1064

Description: 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 ‘exp_weblog_titles.weblog_id = ‘4’’ at line 1

Query: SELECT exp_weblog_titles.entry_id, exp_weblogs.rating_system_enabled, exp_weblogs.rating_use_captcha, exp_weblogs.rating_require_membership FROM exp_weblog_titles, exp_weblogs WHERE exp_weblog_titles.url_title = ‘text’ AND exp_weblog_titles.weblog_id = exp_weblogs.weblog_idAND exp_weblog_titles.weblog_id = ‘4’

And this is the code (to keep things tidy, I’ve put the code in a webpage template, and have embedded that template on the article page of the blog):

{exp:rating:form form_name="ratethis" weblog="tom" required="rating" anonymous="no" require_membership = "yes"}
<input type="hidden" name="name" value="{screen_name}" />
<
input type="hidden" name="email" value="{email}" />
<
label for="review">Your Rating</label>
<
select name="rating">
   <
option value="1">1</option>
   <
option value="2">2</option>
   <
option value="3">3</option>
   <
option value="4">4</option>
   <
option value="5">5</option>
</
select>
<
input type="submit" name="submit" value="Rate this!" />
  
{/exp:rating:form}

Is this a problem with the code, or with the installation, or what? Any help much appreciated. THANKS!

Profile
 
 
Posted: 13 July 2008 04:58 AM   [ Ignore ]   [ # 1 ]
Jr. Member
RankRank
Total Posts:  32
Joined  2008-07-11

I should also note a couple things:

- I’m running Expression Engine 1.6.4, personal edition.
- I have the members module up and running.
- I followed the Rating instructions “for advanced users” (so I modified mod.weblog.php the way the readme described).
- I have the following modules installed: Photo Gallery, Tags (not yet in use), Ratings.

Profile
 
 
Posted: 14 July 2008 06:03 AM   [ Ignore ]   [ # 2 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

PsNP,

Can you

1. Re-upload a fresh copy of mod.weblog.php?
2. Disable the “Advanced User” extension (ext.rating_order.php)
3. De-Install Rating Module (if you do not have any “live” data)
4. Install the module again.... and test out that code (without the mod.weblog.php mod, and rating_order extension)

Let me know what happens smile

 Signature 
Profile
 
 
Posted: 14 July 2008 10:21 AM   [ Ignore ]   [ # 3 ]
Jr. Member
RankRank
Total Posts:  32
Joined  2008-07-11

Thanks for the reply, Pie Man!

I’ve uploaded the fresh file, disabled the advanced user extension, de-installed and reinstalled the module. The code still produces that error (exact same)!

Profile
 
 
Posted: 14 July 2008 10:31 AM   [ Ignore ]   [ # 4 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

What happens if you place that code into the main template (instead of embedding it)

Also, do you have a page I can view it at? smile

 Signature 
Profile
 
 
Posted: 14 July 2008 01:32 PM   [ Ignore ]   [ # 5 ]
Jr. Member
RankRank
Total Posts:  32
Joined  2008-07-11

I’ve pasted the code into the template. Same error.

Profile
 
 
Posted: 14 July 2008 01:35 PM   [ Ignore ]   [ # 6 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

I’m assuming this is happening when you submit the form?

 Signature 
Profile
 
 
Posted: 14 July 2008 01:37 PM   [ Ignore ]   [ # 7 ]
Jr. Member
RankRank
Total Posts:  32
Joined  2008-07-11

Right—I should have specified that too. This is happening before anything is submitted. This happens when a blog article should be displayed with the rating form beneath to be entered.

Profile
 
 
Posted: 15 July 2008 07:48 AM   [ Ignore ]   [ # 8 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

PsNP,

What does all of your code look like altogether? smile

 Signature 
Profile
 
 
Posted: 15 July 2008 11:25 AM   [ Ignore ]   [ # 9 ]
Jr. Member
RankRank
Total Posts:  32
Joined  2008-07-11

This is the code for the page (again it’s the /blog/article template):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<
html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

{embed="psnp/headtags" headtags_title="PSNP article" headtags_description="..."}

<body bgcolor="#ffffff">

{embed="psnp/header_main"}
<div style="text-align: center;">
<
table width="600" border="0" cellpadding="1" cellspacing="1"  class="centred">
  <
tr>
<
td width="120" valign="top>
    <div style="
text-align: center;">{embed="psnp/basic_search"}</div>
    <div style="
text-align: center;"><hr class="thin"><!-- ... //-->
    
    
    </div>
</td>
<td width="
480" valign="top"><div style="text-align: left;">
   <h2>{exp:weblog:weblog_name weblog="
tom"}</h2>
   {exp:weblog:entries weblog="
tom"}

   <div class="
entry" style="background-color: #eee;"><p><b>{title}:&nbsp;</b>{thatoffends}</p></div>
   
<div class="posted" style="text-align: right;"><p class="frail">Posted by {author} ({offensesite}) on {entry_date format='%d %F %Y'}.</p></div>

    <
div class="posted" style="text-align: right;">
     
{exp:rating:form form_name="rateoffense" weblog="tom" required="rating" anonymous="no" require_membership = "yes"}
     
<input type="hidden" name="name" value="{screen_name}" />
     <
input type="hidden" name="email" value="{email}" />
     <
label for="review">Your Rating</label>
     <
select name="rating">
    <
option value="1">1 (It's not that bad)</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5 (Wow! That'
s rough!)</option>
     </
select>
     <
input type="submit" name="submit" value="Rate this offense!" />
   
{/exp:rating:form}
  
</div>

    <
div style="text-align: center;"><br><hr class="thin" /><table width="300"  border="0" cellpadding="1" cellspacing="1"  class="centred">
    <
tr>
    <
td>
      
{exp:weblog:prev_entry}
      
<p><a href="{path="tom/article"}">{title}</a><br>(previous)</p>
      
{/exp:weblog:prev_entry}
   
</td><td>
      
{exp:weblog:next_entry}
      
<p><a href="{path="tom/article"}">{title}</a><br>(next)</p>
      
{/exp:weblog:next_entry}{/exp:weblog:entries}
   
</td>
    </
tr><tr>
   <
td>
      <
p><a href="{path="psnp/psnp_blog"}">back to the blog</a>
   </
td><td>
      <
a href="{path="psnp/index"}">back to the main page</a></p>
   </
td>
    </
tr>
  </
table></div>
</
div></td>
  </
tr>
</
table>

{embed="psnp/footer"}
</div>

</
body>
</
html>

Profile
 
 
Posted: 20 July 2008 01:31 PM   [ Ignore ]   [ # 10 ]
Newbie
Rank
Total Posts:  2
Joined  2008-07-20

I found this too. It’s a bug. Line 1069 of mod.rating.php version 2.1.2 doesn’t add a space to $sql after “exp_weblogs.weblog_id”, and if you specify a weblog parameter, then line 1092 appends “AND...” without an intervening space. You can see the SQL syntax error on the last line of the OP’s quotation.

Profile
 
 
Posted: 20 July 2008 04:01 PM   [ Ignore ]   [ # 11 ]
Jr. Member
RankRank
Total Posts:  32
Joined  2008-07-11

Ben Kimball found the missing spaces, and if the spaces are added (one after the “exp_weblogs.weblog_id” on 1069, and one before the “AND” on 1092 in mod.rating.php) it works like a charm!

Thanks, Ben!

Profile
 
 
Posted: 21 July 2008 08:07 AM   [ Ignore ]   [ # 12 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

Awesome! smile
I’m sure this is corrected for the new version of Rating (supposed to be out soon)… but I will make sure… smile

Thanks Ben smile

 Signature 
Profile
 
 
Posted: 29 August 2008 10:59 AM   [ Ignore ]   [ # 13 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

This issue has been corrected in the release of Rating 2.2.0, now available for download. smile

 Signature 
Profile