RE: [PHP-DB] preg_math vs preg_match_all

2004-11-24 Thread Russell Johnson
For those perl fans out there, preg_match_all adds the g (global) flag to the expression. So this: preg_match('/foo/', $str, $match); would be like $str =~ /foo/; preg_match_all('/foo/', $str, $match); like $str =~ /foo/g; - Russ p.s. - anyone coming from Perl to PHP can get a little hung

[PHP-DB] Re: array messing up

2004-11-24 Thread Sebastian Mendel
Rainer Bendig Aka Ny wrote: I want to build an array containing two arrays $navm[] and $navs[], $navs[] should go to $navm[items]. - -sourcecode:start8<-- $resultm = $db->query("SELECT * FROM ".$p."_cats WHERE ms='m' \ ORDER BY sortorder A

[PHP-DB] Using a loop on a result destroys array??

2004-11-24 Thread Mark Benson
I have another issue. I have a fairly large script that requires data to be read for 2 separate purposes from the results of the same query. e.g.: = = >From the above code, loop 2 r

Re: [PHP-DB] Using a loop on a result destroys array??

2004-11-24 Thread Jason Wong
On Wednesday 24 November 2004 20:31, Mark Benson wrote: > From the above code, Actually the above code would result in a parse error. There are no where-loops in PHP but there are while-loops. This is not being pedantic. If you're going to post code, make sure it's verbatim by using "copy and p

RE: [PHP-DB] Using a loop on a result destroys array??

2004-11-24 Thread Norland, Martin
The real problem you're having is the statement says "while there are results in this query, grab them" - once you reach the end of the first while loop, there are no more results, so the second one is skipped right over - it's condition *never* evaluates true. If the query isn't changing, and the

RE: [PHP-DB] Using a loop on a result destroys array??

2004-11-24 Thread Mark Benson
On Wednesday 24 November 2004 20:31, Mark Benson wrote: >> From the above code, >Actually the above code would result in a parse error. There are no >where-loops in PHP but there are while-loops. This is not being pedantic. If >you're going to post code, make sure it's verbatim by using "copy

RE: [PHP-DB] Using a loop on a result destroys array??

2004-11-24 Thread Mark Benson
On Wednesday, November 24, 2004, at 02:40PM, Norland, Martin <[EMAIL PROTECTED]> wrote: >The real problem you're having is the statement says "while there are >results in this query, grab them" - once you reach the end of the first >while loop, there are no more results, so the second one is sk

RE: [PHP-DB] Using a loop on a result destroys array??

2004-11-24 Thread Norland, Martin
-Original Message- From: Mark Benson [mailto:[EMAIL PROTECTED] >The real problem you're having is the statement says "while there are >results in this query, grab them" - once you reach the end of the first >while loop, there are no more results, so the second one is skipped >right ove

Re: [PHP-DB] Using a loop on a result destroys array??

2004-11-24 Thread Jason Wong
On Wednesday 24 November 2004 23:02, Mark Benson wrote: > >You want people to focus on your real problem and not on > >the mistakes you made in transcribing your actual code into your post. > I actually write (rather badly it would seem!) theoretical examples Please don't construct theoretical e

[PHP-DB] how to implement "pages" of results

2004-11-24 Thread ragan_davis
Hi, I'm sure this is a common question, so please forgive if it's been posted before. I have a select statement that selects records from a table: "select * from $table where host='$somename'" I then propagate a table with the returned data. My goal is to only display 30 records per "page", w

RE: [PHP-DB] how to implement "pages" of results

2004-11-24 Thread Norland, Martin
Basic example: (handwritten in email client, syntax errors may exist) if (!isset($pagenum) || $pagenum < 0) { $pagenum = 0; } $range = 30; $start = $range*$pagenum; $end = $start + $range; $limit = " limit $start, $end"; $query = "select * from $table where host='$somename'$limit"; Then just pass

RE: [PHP-DB] how to implement "pages" of results

2004-11-24 Thread Gryffyn, Trevor
Off the top of my head, doesn't LIMIT accept two paramters? Can't you do: LIMIT 30,2 That'd give you page 2 of a 30+ record result set, right? Using that, you can pass a page # when you click "next page" so previous page ends up being current page - 1 (and "if that is less than 1, then it equa

RE: [PHP-DB] how to implement "pages" of results

2004-11-24 Thread Gryffyn, Trevor
Oh yeah.. LIMIT 30,2 would show 30 records starting with the second record. I knew I was forgetting something. Sorry for the misinformation. Trying to finish some stuff before leaving for the weekend, but wanted to at least give you a nudge before disappearing. Good luck! -TG > -Origin

RE: [PHP-DB] how to implement "pages" of results

2004-11-24 Thread Norland, Martin
Correct - LIMIT 30,2 would show 2 records starting with the thirtieth. :) Enjoy the long weekend [and likely, given the day, your Thanksgiving!] Woo, I'm outta here soon too. - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do

RE: [PHP-DB] how to implement "pages" of results

2004-11-24 Thread Norland, Martin
> Correct - LIMIT 30,2 would show 2 records starting with the thirtieth. thirty-first. Sheesh, I should get outta here too - ^airhead^ - Martin Norland, Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Ju

[PHP-DB] Re: Update Query with special conditions.

2004-11-24 Thread GH
I am curious about doing something simular to this... does anyone have an idea On Wed, 24 Nov 2004 00:43:32 -0500, list 123. wrote: > Using mySQL 4.0, I would like to know how I can code a query that will change > the value of Participants.Active from Y to N is for three or more CONSECUTIVE >

RE: [PHP-DB] Using a loop on a result destroys array??

2004-11-24 Thread David Robley
On Thu, 25 Nov 2004 01:36, Mark Benson wrote: > > On Wednesday, November 24, 2004, at 02:40PM, Norland, Martin > <[EMAIL PROTECTED]> wrote: > >>The real problem you're having is the statement says "while there are >>results in this query, grab them" - once you reach the end of the first >>while

Re: [PHP-DB] Cisco UBR interface with PHP

2004-11-24 Thread David Ziggy Lubowa
On Friday 19 November 2004 07:53, Doug Finch wrote: > I have an idea that I wanted to throw out there. I have a cable ISP > plant that I am trying to help with a project. They are using Cisco > 7114 UBRs to connect their cable modems with their Internet backbone - > this device assigns it a dhcp