Re: arrays, variables, and register_globals--solved--thank you

From: Date: Fri, 26 Jul 2002 01:29:42 +0000
Subject: Re: arrays, variables, and register_globals--solved--thank you
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-109642@lists.php.net to get a copy of this message
On 25 Jul 2002 at 20:11, Matthew K. Gold wrote: > ----- Original Message ----- > From: David Robley <robleyd@paradise.net.nz> > To: Matthew K. Gold <mgold1@gc.cuny.edu> > Sent: Thursday, July 25, 2002 7:14 PM > Subject: Re: arrays, variables, and register_globals--solved--thank you > > > > On 25 Jul 2002 at 11:48, Matthew K. Gold wrote: > > > > > Thank you very much, David--you understood the problem exactly and > > > your solution worked perfectly! > > > > Comes from bitter experience - and working with other languages that > > share > that > > feature. > > > > > > I'd like to add a comment about mysql_data_seek to the php manual > > > entry > on > > > mysql_fetch_row, because I would think that this might be a common > > > problem... > > > > > > Matt > > > > You should be aware that this is not restricted to mysql_fetch_row; the > principle > > applies to arrays generally (see reset, current, each, next and > > previous) > and as I > > mention above, is a general feature across many languages. > > > > It's really a necessity :-) if you want to be able to work your way > through an > > array without actually specifying the position of each element (which > > gets > messy > > with associative arrays) the language needs to be able to keep track of > where it is > > in the array, so it knows where to go next. > > > > Anyway, the main thing is your problem is resolved. > thanks, David, for the additional info. Actually, the one case in which > it's not working well is when the query returns an empty table. In the > manual listing for mysql_data_seek someone suggests counting the rows with > mysql_num_rows, and then, if it's zero, doing something like printing out > an appropriate message. What I'm trying to figure out, though, is how to > integrate that with a mysql_data_seek line that sets the count back to > zero after printing a variable, and a while loop. > > I'm kind of hopeful, though, that I can figure that out. I'm just getting > into programming, and I'm finding that it's fun to run into a problem and > then solve it--although if the solution takes too long, it starts getting > really frustrating. But that's where people like you come in--thanks > again for all of your help. I appreciate it. > > best, > > Matt > > Hmm, forgot to cc the list with my previous reply. There is really no conflict between array pointers and mysql_num_rows; you just call mysql_num_rows with the result set as an argument. In any case, you should be doing that immediately after you make the query, before you attempt to process the results. PS - do you think you can convince Outhouse not to top-quote? Cheers -- David Robley Temporary Kiwi! Quod subigo farinam "I'm knitting a sweater for my guppy," said Tom wolfishly.

« previous php.general (#109642) next »