Page 1 of 1

Querying a string

Posted: Thu Nov 01, 2007 6:53 am
by aceconcepts
Hi,

I have the following query setup:

Code: Select all

$listSql=("SELECT * FROM sctblAttendee
	LEFT JOIN itvtblRegistrations ON itvtblAttendee.intAttendeeId=itvtblRegistrations.intAttendeeId
	WHERE strAttendanceOption='na'");

$listRes=mysql_query($listSql);
The problem is that all records are returned no just those specified in the query.

The field in the table is defined as varchar.

Any ideas?

Posted: Thu Nov 01, 2007 7:10 am
by aceconcepts
I've sorted it.

I use a switch statement derived by a variable set in the url.

One instance of the url variable sets it to 0 and the other sets it to na.

Outside of the switch I ran an if statement:

Code: Select all

if($action=="na" && $action!="0")
	{
		$listSql=("SELECT * FROM itvtblAttendee
							INNER JOIN itvtblRegistrations ON itvtblAttendee.intAttendeeId=itvtblRegistrations.intAttendeeId
							WHERE strAttendanceOption='na'");
	}
And it worked.

So from this, 0 is the same as text as the value.