Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #11086 > unrolled thread

Re: Will this work?

Started byDerek Turner <frderek@cesmail.net>
First post2011-02-08 16:36 +0000
Last post2011-02-08 16:36 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.php

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Will this work? Derek Turner <frderek@cesmail.net> - 2011-02-08 16:36 +0000

#11086 — Re: Will this work?

FromDerek Turner <frderek@cesmail.net>
Date2011-02-08 16:36 +0000
SubjectRe: Will this work?
Message-ID<8rd9o6Fnl3U2@mid.individual.net>
On Tue, 08 Feb 2011 15:35:05 +0000, Denis McMahon wrote:


> <?php
> 
> $fmt = "SELECT `workName`, `composer`, SUBSTRING(`Reference`,
> LOCATE(\'%02d-\', `Reference`)) as TRACK FROM `work` WHERE `Reference`
> LIKE \'%%%02d-%%\' ORDER BY TRACK";
> 
> for ($i = 1; $i < 100; $i++) {
> $result = $mysql_query(sprintf($fmt,$i,$i)); if (!$result) {
>   // print an error message, maybe break
> }
> if (mysql_num_rows($result) == 0) break; // empty result set, finished
> // process $result here
> }
> 
> ?>
> 
> Rgds
> 
> Denis McMahon

Cool! very many thanks, it works. One more question: why the double %% ?

[toc] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web