Querying a string

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Querying a string

Post 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?
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Post 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.
Post Reply