In ColdFusion I was able to check if a query contained any records by doing something like this:
<CFIF Query1.RecordCount NOT "">do something</CFIF>
Is there anyway of doing this in php?
In ColdFusion I was able to check if a query contained any records by doing something like this:
<CFIF Query1.RecordCount NOT "">do something</CFIF>
Is there anyway of doing this in php?
Yes there is however which Database are you using.
If its MySQL you can do something like this
$result = mysql_query($sqlQuery);
if (($num=mysql_num_rows($result)))
{
//$num is also defined there so we dont need to call the function again
echo "There are ".$num." rows";
}
else
{
echo "No Rows Returned";
}
That seems kind of strange, almost as if it was a workaround. I was trying all kinds of stuff (such as testing to see if the primary key field was null) but to no avail.
Thank you very much. There should be a forum specificly for migration from other languages to php.
Well maybe not there arent that many questions about migration from x
to php so the forum would be used extremely rarely.