Rubix
12-17-2003, 12:58 AM
I'm trying to translate a simple application I wrote in ColdFusion into PHP. Does anyone know what the PHP equivalent of a <CFPARAM> tag would be?
Also, I'm trying to translate the following conditional query, and am unsure of the best way to do it:
<CFQUERY DATASOURCE="MarketNotes" NAME="GetNotes">
SELECT NoteID, Date, Headline, SubjectName, SourceName
FROM notes, subjectareas, sources
WHERE subjectareas.SubjectAreaID = notes.SubjectAreaID AND notes.SourceID = sources.SourceID
<!--- if a particular subject was selected --->
<cfif NOT SubjectView IS "all">
AND #SubjectView# = notes.SubjectAreaID
</cfif>
ORDER BY #sort# #sortdir#
</CFQUERY>
I can't figure out how to throw a conditional statement into the middle of a php-based sql query. I start out with
$GetNotes ="SELECT (yada yada yada) ... "
but can't figure out how you throw a conditional statement into the middle of that.
Any suggestions would be greatly appreciated, thanks!
Also, I'm trying to translate the following conditional query, and am unsure of the best way to do it:
<CFQUERY DATASOURCE="MarketNotes" NAME="GetNotes">
SELECT NoteID, Date, Headline, SubjectName, SourceName
FROM notes, subjectareas, sources
WHERE subjectareas.SubjectAreaID = notes.SubjectAreaID AND notes.SourceID = sources.SourceID
<!--- if a particular subject was selected --->
<cfif NOT SubjectView IS "all">
AND #SubjectView# = notes.SubjectAreaID
</cfif>
ORDER BY #sort# #sortdir#
</CFQUERY>
I can't figure out how to throw a conditional statement into the middle of a php-based sql query. I start out with
$GetNotes ="SELECT (yada yada yada) ... "
but can't figure out how you throw a conditional statement into the middle of that.
Any suggestions would be greatly appreciated, thanks!