Categories > TinyButStrong general >

Error in Where Clause

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: joshmac
Date: 2008-07-11
Time: 05:25

Error in Where Clause

I have the following in my php file:

$TBS = new clsTinyButStrong ;
$TBS->LoadTemplate('../TBS_templates/employer/subtpl_myjobs.htm') ;
$TBS->MergeBlock('change',$db_connect,'SELECT * FROM jobs WHERE username = ' . $_SESSION['username']);
$TBS->MergeBlock('page',$db_connect,'SELECT id, title FROM pages');
$pagetitle=$TBS->TplVars['pagetitle'];
$TBS->Show() ;

And then I have this in my htm file:

<tr><td><a href="editjob.php?action=edit&job_id=[change.job_id;block=tr]">[change.title]</a></td> <td>[change.date]</td> <td>[change.job_id]</td> <td align="center"><a href="editjob.php?action=edit&job_id=[change.job_id]"><img src="../images/page_edit.gif" alt="Edit Page" /></a></td></tr>
<tr><td>[change;block=tr;nodata] No jobs listed.</td></tr>

I believe that I did everything right, but because I have been looking at it a lot, I may have missed something.  And below is the error message I get:

TinyButStrong Error when merging block [change] : MySql error message when opening the query: Unknown column 'parkerj' in 'where clause'

Any help with this is greatly appreciated.  Thanks.
By: TomH
Date: 2008-07-11
Time: 06:17

Re: Error in Where Clause

Gotta fix your query, try something like...
$sql= "SELECT * FROM jobs WHERE username = '". $_SESSION['username']."'";
$TBS->MergeBlock('change',$db_connect,$sql);

Now you can add
[var.sql]
somewhere in your template and see what the actual query statement looks like.

NOT tested obviously, just trying to point you toward a way to get started.
By: joshmac
Date: 2008-07-11
Time: 12:11

Re: Error in Where Clause

Sure, thing.  Thanks.