Detecting empty SQL call
Hi all, Can anyone tell me how to detect if the call to a mySQL database returns an empty recordset as my code causes an error if the SQL returns an empty recordset. This is what i am currently using: <!--#in dBcall--> <!--#if "newName == name"--> <!--#call "REQUEST.set('titleTrue', 'true')"--> <!--#else--> <!--#call "REQUEST.set('titleTrue', 'false')"--> <!--#/if--> <!--#/in--> i have tried various <!--#if --> statement, but it doesn't seem to make any difference. Any advice? P. --------------------------------------------------------------------- Phil Grove phil.grove@flg21.com Web Development 0113 2949494 flg21 http://www.flg21.com ---------------------------------------------------------------------
At 10:56 01/07/99 , Phil Grove wrote:
Hi all,
Can anyone tell me how to detect if the call to a mySQL database returns an empty recordset as my code causes an error if the SQL returns an empty recordset.
This is what i am currently using:
<!--#in dBcall--> <!--#if "newName == name"--> <!--#call "REQUEST.set('titleTrue', 'true')"--> <!--#else--> <!--#call "REQUEST.set('titleTrue', 'false')"--> <!--#/if--> <!--#/in-->
i have tried various <!--#if --> statement, but it doesn't seem to make any difference.
Have you tried the <!--#else--> block of the <!--#in--> tag? Like so: <!--#in dBcall--> <!--#if "newName == name"--> <!--#call "REQUEST.set('titleTrue', 'true')"--> <!--#else--> <!--#call "REQUEST.set('titleTrue', 'false')"--> <!--#/if--> <!--#else--> Sorry, no results from the query. <!--#/in--> -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
Try this <!--#in dBcall--> <!--#if "newName == name"--> <!--#call "REQUEST.set('titleTrue', 'true')"--> <!--#else--> <!--#call "REQUEST.set('titleTrue', 'false')"--> <!--#/if--> <!--#else-> it failed, no records <!--#/in--> HTH Phil phil@philh.org ----- Original Message ----- From: Phil Grove <phil.grove@flg21.com> To: <zope@zope.org> Sent: Thursday, July 01, 1999 9:56 AM Subject: [Zope] Detecting empty SQL call
Hi all,
Can anyone tell me how to detect if the call to a mySQL database returns an empty recordset as my code causes an error if the SQL returns an empty recordset.
This is what i am currently using:
<!--#in dBcall--> <!--#if "newName == name"--> <!--#call "REQUEST.set('titleTrue', 'true')"--> <!--#else--> <!--#call "REQUEST.set('titleTrue', 'false')"--> <!--#/if--> <!--#/in-->
i have tried various <!--#if --> statement, but it doesn't seem to make any difference.
Any advice?
P.
---------------------------------------------------------------------
Phil Grove phil.grove@flg21.com Web Development 0113 2949494 flg21 http://www.flg21.com
---------------------------------------------------------------------
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(For developer-specific issues, use the companion list, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
Replying to myself, HMMMM ANyway a bit more explanation, after reading you mail more carefully. <!--#in dBcall--> <!--#call "REQUEST.set('titleTrue', 'true')"--> <!--#else-> <!--#call "REQUEST.set('titleTrue', 'false')"--> <!--#/in--> That is probably more like what you want, ;) See ya Phil Phil@philh.org ----- Original Message ----- From: Phil Harris <phil@philh.org> To: <zope@zope.org>; Phil Grove <phil.grove@flg21.com> Sent: Thursday, July 01, 1999 10:15 AM Subject: Re: [Zope] Detecting empty SQL call
Try this
<!--#in dBcall--> <!--#if "newName == name"--> <!--#call "REQUEST.set('titleTrue', 'true')"--> <!--#else--> <!--#call "REQUEST.set('titleTrue', 'false')"--> <!--#/if--> <!--#else-> it failed, no records <!--#/in-->
HTH
Phil phil@philh.org
----- Original Message ----- From: Phil Grove <phil.grove@flg21.com> To: <zope@zope.org> Sent: Thursday, July 01, 1999 9:56 AM Subject: [Zope] Detecting empty SQL call
Hi all,
Can anyone tell me how to detect if the call to a mySQL database returns an empty recordset as my code causes an error if the SQL returns an empty recordset.
This is what i am currently using:
<!--#in dBcall--> <!--#if "newName == name"--> <!--#call "REQUEST.set('titleTrue', 'true')"--> <!--#else--> <!--#call "REQUEST.set('titleTrue', 'false')"--> <!--#/if--> <!--#/in-->
i have tried various <!--#if --> statement, but it doesn't seem to make any difference.
Any advice?
P.
---------------------------------------------------------------------
Phil Grove phil.grove@flg21.com Web Development 0113 2949494 flg21 http://www.flg21.com
---------------------------------------------------------------------
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(For developer-specific issues, use the companion list, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(For developer-specific issues, use the companion list, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Martijn Pieters -
Phil Grove -
Phil Harris