🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.vms
Article #85

Re: PHP "Features"

#85
From: Arne Vajhøj
Date: Sun, 25 Oct 2026 01:02
56 lines
2743 bytes
On 10/24/2026 8:32 PM, Lawrence D’Oliveiro wrote:
> On Sat, 24 Oct 2026 19:46:12 -0400, Arne Vajhøj wrote:
>>> What do you use for LIKE and REGEXP clauses?
>>
>> prepare of course.
> 
> You mean, mysqli_stmt_prepare()? You think this will work?
> 
>      mysqli_stmt_prepare(«stmt», "select «table» from «table» where «field» like \"%?%\"")
> 
> ?

No.

The syntax is:

mysqli_stmt_prepare(«stmt», "select «table» from «table» where «field» 
like ?")

and then the value is:

"%" + s + "%"

Parameters has to be values.

It is not a library thing - it is a SQL thing (usually -
implementations may differ).

mysql> SELECT * FROM t1 WHERE f2 LIKE 'B%';
+----+------+
| f1 | f2   |
+----+------+
|  2 | BB   |
+----+------+
1 row in set (0.00 sec)

mysql> PREPARE stmt FROM 'SELECT * FROM t1 WHERE f2 LIKE ?';
Query OK, 0 rows affected (0.00 sec)
Statement prepared

mysql> SET @f2 = 'B%';
Query OK, 0 rows affected (0.00 sec)

mysql> EXECUTE stmt USING @f2;
+----+------+
| f1 | f2   |
+----+------+
|  2 | BB   |
+----+------+
1 row in set (0.00 sec)

mysql> DEALLOCATE PREPARE stmt;
Query OK, 0 rows affected (0.00 sec)

Arne
Technical Details
Message-ID: <11bjkf1$3770s$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11bcbi1$k068$1@dont-email.me> <nk1gv8F1eecU1@mid.individual.net> <11bgih8$f7a$1@reader2.panix.com> <nk2bhaF5j2sU1@mid.individual.net> <11bh3ei$19g$1@reader2.panix.com> <11bi7bg$2mdi4$1@dont-email.me> <11bikkl$2rllh$1@dont-email.me> <11bjcal$340l8$9@dont-email.me> <11bjfvm$35qiv$1@dont-email.me> <11bjim0$36fkf$3@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Arne Vajhøj <arne@vajhoej.dk>
Newsgroups: comp.os.vms
Subject: Re: PHP "Features"
Date: Sat, 24 Oct 2026 21:02:37 -0400
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <11bjkf1$3770s$1@dont-email.me>
References: <11bcbi1$k068$1@dont-email.me> <nk1gv8F1eecU1@mid.individual.net>
 <11bgih8$f7a$1@reader2.panix.com> <nk2bhaF5j2sU1@mid.individual.net>
 <11bh3ei$19g$1@reader2.panix.com> <11bi7bg$2mdi4$1@dont-email.me>
 <11bikkl$2rllh$1@dont-email.me> <11bjcal$340l8$9@dont-email.me>
 <11bjfvm$35qiv$1@dont-email.me> <11bjim0$36fkf$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 25 Oct 2026 01:02:25 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3382300"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1891ghscNaU8INSOd5W97e4KN/egG5TrZU="; posting-host="c39ced0a3238a22363869b6a49ab031a"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:vrY4ZPwV+uAERoEdY9VeJ9wnZoM= sha256:OrenXFRIdcmJMkz5QnSogeHMSfmRXZiIUuxXiQTV9ko=
	sha1:MUxBH6gEkSuOFmNJT6ZDf5V8L/Q= sha256:PRmLY0pcDcgGpR66ntNhQ2Qt0e8E2cdFD6+JIXKhOYk=
Content-Language: en-US
In-Reply-To: <11bjim0$36fkf$3@dont-email.me>