CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 CCDLookUp WHERE error

Print topic Send  topic

Author Message
robeh

Posts: 17
Posted: 10/23/2005, 5:56 AM

My WHERE clause is reading the wrong thing for the name of the database column, and I can't figure out why. Here's the part of the code doing this:

$ctype = $parshaSet->ds->type->GetValue() %100;  
$cparsha = $parshaSet->ds->parsha->GetValue();  
$db = new clsDBConnectTonsleining();  
$id = CCDLookUp("parsha_id", "parshas", "yeartype = ".$ctype." AND parsha = ".$cparsha,$db);

The error is Invalid SQL: SELECT parsha_id FROM parshas WHERE yeartype = 2 AND parsha = Bre
MySQL Error: 1054 (Unknown column 'Bre' in 'where clause')

yeartype is fine, but the parsha is a problem - the column name is parsha, not Bre - Bre is a particular field.

What am I doing wrong?

Thanks.

Robert
View profile  Send private message
DonB
Posted: 10/23/2005, 8:44 AM

You need quotes/apostrophes for string data types otherwise SQL's rule is
'assume it's a column name'

--
DonB

http://www.gotodon.com/ccbth


"robeh" <robeh@forum.codecharge> wrote in message
news:5435b887a726f6@news.codecharge.com...
> My WHERE clause is reading the wrong thing for the name of the database
column,
> and I can't figure out why. Here's the part of the code doing this:
>
>
$ctype = $parshaSet->ds->type->GetValue() %100;  
> $cparsha = $parshaSet->ds->parsha->GetValue();  
> $db = new clsDBConnectTonsleining();  
> $id = CCDLookUp("parsha_id", "parshas", "yeartype = ".$ctype." AND parsha  
=  
> ".$cparsha,$db);
>
> The error is Invalid SQL: SELECT parsha_id FROM parshas WHERE yeartype = 2
AND
> parsha = Bre
> MySQL Error: 1054 (Unknown column 'Bre' in 'where clause')
>
> yeartype is fine, but the parsha is a problem - the column name is parsha,
not
> Bre - Bre is a particular field.
>
> What am I doing wrong?
>
> Thanks.
>
> Robert
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

robeh

Posts: 17
Posted: 10/23/2005, 5:06 PM

DonB,

Thanks for the information. Everything is happy now.

Robert
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.