Forums

error in your SQL syntax

tcole 11 Jul, 2010
I posted this problem some time ago and failed to get it resolved.

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 'SQL: WHERE 'cf_user_id' = 63' at line 1 SQL=SELECT count(*) FROM jos_chronoforms_SchoolDetails WHERE SQL: WHERE 'cf_user_id' = 63

WHERE SQL:
<?php
$user = &JFactory::getUser();
echo "WHERE 'cf_user_id' = ".$user->id
?>


Can some please help to resolve this?

Cheers
GreyHead 11 Jul, 2010
Hi tcole,

WHERE SQL: <<-- Delete this line
<?php
$user = &JFactory::getUser();
echo "WHERE 'cf_user_id' = ".$user->id
?>


Bob
tcole 11 Jul, 2010
Bob,
thanks heaps for that, that has got rid of the error.

But no data is shown.😟
Header:
{pagination}
<table width="100%" border="0">
  <tr bgcolor="#CC0000">
    <td width="20%"><strong>School Name:</strong></td>
    <td width="20%"><strong>School Address:</strong></td>
    <td width="20%"><strong>School Phone:</strong></td>
    <td width="20%"><strong>School Email:</strong></td>
  </tr>
</table>
<hr>


Body:
<table style="text-align: left; width: 100%;" border="0" cellpadding="2" cellspacing="2">
      <tbody>
        <tr>
          <td style="width: 20%;">{schoolname}</td>
          <td style="width: 20%;">{schooladdress}</td>
          <td style="width: 20%;">{schoolphone}</td>
          <td style="width: 20%;">{schoolemail}</td>
        </tr>
      </tbody>
    </table>


Footer: empty no code

What I am trying to do is set it up so that the different schools can edit their data that they have set up via chronoforms.

This part is the school details and once I have that working I will then set up chronoforms with team info where again they can enter and edit their own data only.

Any suggestions that you can offer would be great.

Cheers
GreyHead 12 Jul, 2010
Hi Terry,

The most likely reason for not displaying any data is that there are no records with the correct cf_user_id. Can you check that?

Bob

PS It's neater to use just a <tr>. . . </tr> in the Body section as that will keep the column widths stable. Put the <table> & </table> tags into the Header & Footer boxes.

Head:
<table>
<thead><tr><th>. . .</th><th>. . .</th></tr></thead>
<tfoot><tr><tf>. . .</tf><tf>. . .</tf></tr></tfoot>
<tbody>

Body:
<tr><td>. . .</td><td>. . .</td></tr>

Footer:
</tbody></table>
tcole 12 Jul, 2010
Bob,
thanks for the code tidy up.🙂

Yes I have checked and the cf_user_id is correct.

I am sure that I must be missing something simple to why this is not working.

Do I need anything in the post or get variables???

cheers
GreyHead 14 Jul, 2010
Hi Terry,

By all means email or PM me the site URL and a SuperAdmin login and I'll take a quick look.

Bob
tcole 14 Jul, 2010
Thanks for you help, Bob.

PM sent with details.

cheers
GreyHead 15 Jul, 2010
Hi Terry,

Fixed, in your 'Where' code you had single quotes '' round the column name instead of back-ticks ``. Here's how it needs to be:
echo "WHERE `cf_user_id` = ".$user->id


Bob
kevin998 15 Jul, 2010
Yes, I missed that at first to. This happens to me sometimes when I have copied and pasted code from a webpage into my editor and not caught that.
tcole 15 Jul, 2010
Bob, you are a whizz.🙂

I thought speech marks were needed.

Thanks heaps for your help, I can now get on with the project.

Cheers
This topic is locked and no more replies can be posted.