Re. : [SMARTY] Define SQL search queries with PHP
| From: | philippe dot morange at ca-indosuez dot com | Date: | Wed, 26 Mar 2003 09:18:50 +0000 |
| Subject: | Re. : [SMARTY] Define SQL search queries with PHP | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-8913@lists.php.net to get a copy of this message | ||
> I'm afraid this is more of a php question than smarty, but I'm stuck on this problem
> with sql
queries. Sorry to > trouble you all with this.
>
> $result = func_query("SELECT categoryid, FROM $sql_tbl[categories] WHERE category LIKE
'".addslashes($category_name)."%'");
>
> I'm trying to search the query from $category_name (ie. Computer/Hardware/Joystick ) and
> return
the string before > the last "/"(ie. Computer, Computer/Hardware).*note queries can
return Computer,
Computer/Hardware, Computer/Hardware/Joystick, I need the search to return strings without slash as
well...* I've modified it to this:
>
> WHERE category LIKE '"strrev( strchr(strrev($category_name),"/")
> )'");
>
> I also tried !strstr($category_name,"/") as well, but no cigar...
>
> but displaying the page gives me a Parse error on top. What am I doing wrong with the code?
I'm sorry if I don't answer you, but for all PHP / MySQL related questions, you should go
to
www.phpbuilder.com for instance.
Once there, go on the forums, you will get an answer really fast...
Philippe.
> Distressed, thanks in advance to all of you!
==========================================================
Ce message et ses pièces jointes (le "message") est destiné à l'usage exclusif de
son destinataire.
Si vous recevez ce message par erreur, merci d'en aviser immédiatement l'expéditeur et
de le
détruire ensuite. Le présent message pouvant être altéré à notre insu, Crédit Agricole
Indosuez
ne peut pas être engagé par son contenu. Tous droits réservés.
This message and/or any attachments (the "message") is intended for the sole use of its
adressee.
If you are not the adressee, please immediately notify the sender and then destroy the message. As
this message and/or any attachments may have been altered without our knowledge, its content is
not legally binding on Crédit Agricole Indosuez. All rights reserved.
==========================================================