From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | "lowdog" <lowdog(at)axelero(dot)hu>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: SQL query seach + rearranging results |
Date: | 2004-02-17 20:26:41 |
Message-ID: | 200402172026.41114.dev@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Monday 16 February 2004 16:07, lowdog wrote:
> hey guys!
>
> I need your help in writing a php name-day searcher script.
Actually, you probably want a mysql list - this is a PostgreSQL list.
However, from what I can understand of your problem I think the easiest
solution for you might be to order the results by name (nevek table?) and
then loop through building a results list while the name remains the same.
Something like:
$current_name = '';
while (/* fetch next row */) {
if ($row['name']==$current_name) {
/* add next "day" to output list */
}
else {
/* display output list if anything there */
$current_name = $row['name'];
$output_list = array();
$output_list[] = $row['day'];
}
}
/* on exiting loop, check if there is a final row to display */
Hope that's of some use.
PS - indenting your SQL cleanly on multiple lines will save you time in the
future - trust me on this.
PPS - localization (the accented characters you are having problems with) is a
difficult issue, especially on the web where client/page/database encoding
can all interact.
PPPS - if you port your application to PostgreSQL, you've found the right list
for SQL questions. We also have a PHP list and a novice list if you're just
starting.
Good luck
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2004-02-17 21:04:38 | Re: Return relation table data in a single value CSV |
Previous Message | terry | 2004-02-17 20:05:12 | Return relation table data in a single value CSV |