Re: [PHP] mysql_fetch_array() vs mysql_fetch_assoc() WAS: Re: [PHP] Why does this script run out of memory?

2011-10-28 Thread Daniel Brown
On Fri, Oct 28, 2011 at 18:48, Jim Long wrote: > > I'm not seeing any numeric keys in my mysql_fetch_assoc() arrays. You're absolutely correct, that's my mistake: substitute mysql_fetch_row() for mysql_fetch_assoc(). Duh. Time to call it a week -- Network Infrastructure Manager h

Re: [PHP] mysql_fetch_array() vs mysql_fetch_assoc() WAS: Re: [PHP] Why does this script run out of memory?

2011-10-28 Thread Jim Long
On Fri, Oct 28, 2011 at 06:19:56PM -0400, Daniel Brown wrote: > On Fri, Oct 28, 2011 at 18:13, Paul Halliday wrote: > > > > Whats the difference between fetch_assoc and fetch_row? > > > > I use: > > while ($row = mysql_fetch_row($theQuery)) { > > ? ?doCartwheel; > > } > > > > on just under 300 mil

Re: [PHP] mysql_fetch_array

2007-11-05 Thread Philip Thompson
On 11/3/07, Eduardo Vizcarra <[EMAIL PROTECTED]> wrote: > > Hi guys > > After doing some changes, I believe it is partially working, what I did is > the following: > while($row=mysql_fetch_array($fotos)) > { >$fotos_mostrar[] = $row; > } > $primer_foto = reset($fotos_mostrar[0]); // Thi

Re: [PHP] mysql_fetch_array

2007-11-04 Thread Jim Lucas
[EMAIL PROTECTED] wrote: Do you even need reset()? I've never used it. Personally, I do not see the need. The op is building the array then wanting to work with it. At this point, the internal pointer should still be at the beginning. AFAIK Jim -- PHP General Mailing List (http://www.php.ne

Re: [PHP] mysql_fetch_array

2007-11-04 Thread heavyccasey
Do you even need reset()? I've never used it. On Nov 3, 2007 11:08 PM, Jim Lucas <[EMAIL PROTECTED]> wrote: > Eduardo Vizcarra wrote: > > Hi guys > > > > After doing some changes, I believe it is partially working, what I did is > > the following: > > while($row=mysql_fetch_array($fotos)) > >

Re: [PHP] mysql_fetch_array

2007-11-03 Thread Jim Lucas
Eduardo Vizcarra wrote: Hi guys After doing some changes, I believe it is partially working, what I did is the following: while($row=mysql_fetch_array($fotos)) { $fotos_mostrar[] = $row; } $primer_foto = reset($fotos_mostrar[0]); // This is to set the pointer to the first record e

Re: [PHP] mysql_fetch_array

2007-11-03 Thread Eduardo Vizcarra
Hi guys After doing some changes, I believe it is partially working, what I did is the following: while($row=mysql_fetch_array($fotos)) { $fotos_mostrar[] = $row; } $primer_foto = reset($fotos_mostrar[0]); // This is to set the pointer to the first record echo $primer_foto; // This di

Re: [PHP] mysql_fetch_array

2007-11-03 Thread Jim Lucas
Eduardo Vizcarra wrote: I have a WHILE sentence to retrieve all records from a SELECT query in a database and am using mysql_fetch_array to store them in a matrix, the sentence is like this: while($row=mysql_fetch_array($fotos)) { $fotos_mostrar[] = $row; } $fotos contains all records

Re: [PHP] mysql_fetch_array

2007-11-02 Thread Richard S. Crawford
On Friday 02 November 2007 18:23:03 Eduardo Vizcarra wrote: >   while($row=mysql_fetch_array($fotos)) >   { >    $fotos_mostrar[] = $row; >   } > > $fotos contains all records found in a db table, the SELECT statement is > retrieving 2 columns from a table, how do I store all records in a 2 > dimen

Re: [PHP] mysql_fetch_array

2007-11-02 Thread Eduardo Vizcarra
Yes, matrix has been defined just before this WHILE sentence "Cristian Vrabie" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > this is most peculiar. your code should do exactly what you expect. have > you initialized the $fotos_mostrar array before the while loop? > $fotos_mo

Re: [PHP] mysql_fetch_array

2007-11-02 Thread Cristian Vrabie
this is most peculiar. your code should do exactly what you expect. have you initialized the $fotos_mostrar array before the while loop? $fotos_mostrar = array(); Eduardo Vizcarra wrote: I have a WHILE sentence to retrieve all records from a SELECT query in a database and am using mysql_fetch_

RE: [PHP] mysql_fetch_array to associative array

2007-07-16 Thread Andras Kende
-Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: Monday, July 16, 2007 6:12 PM To: Andras Kende Cc: php-general@lists.php.net Subject: RE: [PHP] mysql_fetch_array to associative array On Mon, 2007-07-16 at 13:37 -0700, Andras Kende wrote

RE: [PHP] mysql_fetch_array to associative array

2007-07-16 Thread Robert Cummings
On Mon, 2007-07-16 at 13:37 -0700, Andras Kende wrote: > > > function GetAssoc($query) { > > $get = $this->Execute ( $query ); > > > $result = array(); > > while ( $row = mysql_fetch_array($get) ) {

RE: [PHP] mysql_fetch_array to associative array

2007-07-16 Thread Andras Kende
-Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: Monday, July 16, 2007 1:46 PM To: Andras Kende Cc: php-general@lists.php.net Subject: RE: [PHP] mysql_fetch_array to associative array On Mon, 2007-07-16 at 13:37 -0700, Andras Kende wrote: > >

RE: [PHP] mysql_fetch_array to associative array

2007-07-16 Thread Robert Cummings
On Mon, 2007-07-16 at 13:37 -0700, Andras Kende wrote: > > Hi Rob, > > Thanks for your help, its associative but I forget to mention its needs > To be a single dimensional associative array. > > > $result = array(); > while ( $row = mysql_fetch_assoc($get) ) { > $result[] = $row; > } > > This

RE: [PHP] mysql_fetch_array to associative array

2007-07-16 Thread Andras Kende
-Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: Monday, July 16, 2007 7:52 AM To: Andras Kende Cc: php-general@lists.php.net Subject: Re: [PHP] mysql_fetch_array to associative array On Mon, 2007-07-16 at 07:41 -0700, Andras Kende wrote: > Hello, > >

Re: [PHP] mysql_fetch_array to associative array

2007-07-16 Thread Jim Lucas
Andras Kende wrote: Hello, I use the following GetArray for returning an array from mysql results. But having a hard time modifying it for returning a simple associative array Like: $conn->GetAssoc('SELECT id, name from manufacturers') Array ( [2] => BMW [1] => MAZDA [9] => FORD )

Re: [PHP] mysql_fetch_array to associative array

2007-07-16 Thread Robert Cummings
On Mon, 2007-07-16 at 10:52 -0400, Robert Cummings wrote: > On Mon, 2007-07-16 at 07:41 -0700, Andras Kende wrote: > > Hello, > > > > I use the following GetArray for returning an array from mysql results. > > > > But having a hard time modifying it for returning a simple associative array > > >

Re: [PHP] mysql_fetch_array to associative array

2007-07-16 Thread Robert Cummings
On Mon, 2007-07-16 at 07:41 -0700, Andras Kende wrote: > Hello, > > I use the following GetArray for returning an array from mysql results. > > But having a hard time modifying it for returning a simple associative array > > Like: > > $conn->GetAssoc('SELECT id, name from manufacturers') > > A

Re: [PHP] mysql_fetch_array()

2004-08-17 Thread Chris Shiflett
--- Anthony Ritter <[EMAIL PROTECTED]> wrote: > My question was the call to > > mysql_fetch_array() > > will also return a result set without the additional argument > constant as in: > > while ($row = mysql_fetch_array($sql)) > {... > // no constant is being used > > There are many times tha

Re: [PHP] mysql_fetch_array()

2004-08-17 Thread Anthony Ritter
Thank you Chris. My question was the call to mysql_fetch_array() will also return a result set without the additional argument constant as in: while ($row = mysql_fetch_array($sql)) {... // no constant is being used There are many times that I see that used in textbooks - without the constan

Re: [PHP] mysql_fetch_array()

2004-08-17 Thread Chris Shiflett
--- Anthony Ritter <[EMAIL PROTECTED]> wrote: > When using mysql_fetch_array() is it necsessary to specify the > second argument - meaning the constant of MYSQL_NUM or > MYSQL_ASSOC? Whenever you have a question about a function, you can look it up using a URL formatted as follows: http://www.php

Re: [PHP] mysql_fetch_array()

2004-08-17 Thread John Holmes
Anthony Ritter wrote: When using mysql_fetch_array() is it necsessary to specify the second argument - meaning the constant of MYSQL_NUM or MYSQL_ASSOC? I have seen many examples where it is left out and it is coded: $row = mysql_fetch_array($sql); as opposed to $row = mysql_fetch_array($sql, MYSQL

Re: [PHP] mysql_fetch_array problem? O.o

2004-04-15 Thread Burhan Khalid
Jeff Ostapchuk wrote: Ok, I have no clue what version of PHP I have installed, 4.??.??, and I have like the newest version of MySQL insatlled, and PHP and MySQL work fine together, excpet when I use mysql_fetch_row($query) then I have problems, mysql_fetch_array($query) works fine, but not mysql

Re: [PHP] mysql_fetch_array problem? O.o

2004-04-14 Thread Richard Davey
Hello Jeff, Thursday, April 15, 2004, 3:18:53 AM, you wrote: JO> Ok, I have no clue what version of PHP I have installed, 4.??.??, and I have Find out: (view it in a browser) JO> like the newest version of MySQL insatlled, and PHP and MySQL work fine JO> together, excpet when I use mysql_fet

Re: [PHP] mysql_fetch_array

2004-03-26 Thread Tom Rogers
Hi, Saturday, March 27, 2004, 4:50:27 AM, you wrote: CM> I have this query to select the date from my table... CM> SELECT DATE_FORMAT(date1, '%W %M %Y') FROM table CM> How do I know what name mysql_fetch_array assigned to the date_format ? SELECT DATE_FORMAT(date1, '%W %M %Y') AS date_formatte

Re: [PHP] mysql_fetch_array

2004-03-26 Thread John W. Holmes
From: "Adam Voigt" <[EMAIL PROTECTED]> > On Fri, 2004-03-26 at 13:50, Chris Mach wrote: > > > > I have this query to select the date from my table... > > > > SELECT DATE_FORMAT(date1, '%W %M %Y') FROM table > > > > How do I know what name mysql_fetch_array assigned to the date_format ? > > It would

Re: [PHP] mysql_fetch_array

2004-03-26 Thread Adam Voigt
It would be position 0 in the array, or in your query after the date format function you could put "AS blah" and then it would come out as blah. On Fri, 2004-03-26 at 13:50, Chris Mach wrote: > I have this query to select the date from my table... > > SELECT DATE_FORMAT(date1, '%W %M %Y') FROM t

RE: [PHP] mysql_fetch_array() not working as expected

2003-10-07 Thread Chris W. Parker
Marek Kilimajer on Tuesday, October 07, 2003 12:26 PM said: > (c.id) You can make the query: > SELECT c.id > , cc.id AS ccid > , cc.prod_id > , p.name doh! how obvious! thanks. c. -- PHP General Mailing List (http://www.php.net/) To unsubscrib

Re: [PHP] mysql_fetch_array() not working as expected

2003-10-07 Thread Marek Kilimajer
Chris W. Parker wrote: Hey peeps. Let me make this simple. I've got the following sql query in a function: SELECT c.id , cc.id , cc.prod_id , p.name , cc.price , cc.qty FROM cart AS c INNER JOIN cart_contents AS cc ON cc.cart_id = c.id INNER

Re: [PHP] mysql_fetch_array(): supplied argument is not a validMySQL result resource

2003-06-12 Thread Philip Olson
It has to do with you assuming everything will work 100% of the time. It won't. mysql_query() returns false on failure, check for that. Read this recent thread: http://marc.theaimsgroup.com/?l=php-general&m=105517588819420 Also, this faq explains it: http://www.php.net/manual/en/faq.data

Re: [PHP] mysql_fetch_array errors

2002-05-20 Thread Philip Olson
A key to understanding your mysql errors is by using the mysql_error() function. It's wonderful! Here's a simple example with a little error checking: Regards, Philip Olson On Sun, 19 May 2002, Justin Latham wrote: > I am trying to clone my webserver because I am switching ISPs. So I

Re: [PHP] mysql_fetch_array errors

2002-05-19 Thread Richard Archer
At 9:38 PM -0400 19/5/02, Justin Latham wrote: >insists that any query I do is not a valid result resource when I try to use >it in a mysql_fetch_array command. I know that both php and the database So what errors are being returned by all the mysql_* calls? Error messages are their to help th

RE: [PHP] mysql_fetch_array()

2002-04-05 Thread Miguel Cruz
On Fri, 5 Apr 2002, Phil Ewington wrote: > This is for an events calendar, I want all the dates form the db but when I > am generating the individual days for the calendar I need to know whether > there is an event for that day, hence pulling out all the dates from the db. > As I am looping throug

RE: [PHP] mysql_fetch_array()

2002-04-05 Thread heinisch
At 05.04.2002 12:31, you wrote: > >Jason, > >This is for an events calendar, I want all the dates form the db but when I >am generating the individual days for the calendar I need to know whether >there is an event for that day, hence pulling out all the dates from the db. >As I am looping throug

RE: [PHP] mysql_fetch_array()

2002-04-05 Thread Phil Ewington
to:[EMAIL PROTECTED]] > Sent: 05 April 2002 11:31 > To: [EMAIL PROTECTED] > Subject: Re: [PHP] mysql_fetch_array() > > > On Friday 05 April 2002 18:21, you wrote: > > Hi All, > > > > I am new to PHP and am having a bit of trouble. I have a > recordset using...

Re: [PHP] mysql_fetch_array()

2002-04-05 Thread Ben Edwards
$db = mysql_open(); $results = mysql_query( "select * from something", $db ); while( $row = mysql_fetch_array( $results ) ) { processing using $row["column"] as reference } Ben At 11:21 05/04/2002, Phil Ewington wrote: >Hi All, > >I am new to PHP and am having a bit of trouble. I h

Re: [PHP] mysql_fetch_array

2001-12-31 Thread Vincent Stoessel
you can also do $queryString = "select table1.uid as 'my_uid' , table2.uid as 'their_uid' from table1, table2 where ... "; Greg Sidelinger wrote: > > > > Subject: > > [PHP] mysql_fetch_array > From: > > "Greg Sid

Re: [PHP] mysql_fetch_array

2001-12-30 Thread Mehmet Kamil ERISEN
Hi, In your SQL, you can say select t1.col colt1, t2.col colt2 from table1 t1, table2 t2 where t1.something = t2.samething In other words, you can name your columns differently in your select clause. I Bogdan Stancescu <[EMAIL PROTECTED]> wrote: If everything else fails, you should consider u

Re: [PHP] mysql_fetch_array

2001-12-30 Thread Bogdan Stancescu
If everything else fails, you should consider using mysql_fetch_row() instead. Bogdan Greg Sidelinger wrote: > Ok I have use mysql_fetch_array to dump the results of a select query with a > join in it. > if my tables contain a column with the same name how can I distinguish from > them. -- P

Re: [PHP] mysql_fetch_array() doesn't work

2001-09-26 Thread Naintara Jain
Hi Mike, The query $query="selct count(*) from users where sign=1"; should be "select" not "selct" -and in future to know if there is any error in your queries you might want to check this way: if(mysql_query($query) { --do statements-- } else -error msg- or even the following would be

Re: [PHP] mysql_fetch_array() doesn't work

2001-09-26 Thread Jason G.
echo " Missing end quote and semicolon on this line may be the reason... Try properly indenting and formatting your code. Also take advantage of going in and out of php mode to seperate your code from your display of content... Ex: instead of this: $sContent"); ?> Try this: Or even this:

Re: [PHP] mysql_fetch_array() doesn't work

2001-09-26 Thread Philip Olson
hi. this doesn't have to do with mysql_fetch_array. the following will create that error : echo "a $b['c'] d e f"; the following will not : echo "a $b[c] d e {$f['g']} h i $j[$k] l 'm' n o p"; adjust accordingly. just posted a few words on this topic recently, can view them here : ht

Re: [PHP] mysql_fetch_array

2001-09-06 Thread sagar
hi, just go thru ur code once u'll getout with the bug. $myrow<>mysql_fetch_Array($result2); what is $myrow and to which value should the left part should compare. try this : /sagar - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, September 06,

Re: [PHP] mysql_fetch_array

2001-09-06 Thread David Robley
On Thu, 6 Sep 2001 18:09, [EMAIL PROTECTED] wrote: > Can someone tell me what i'm doing wrong here? > > //Connect to db > $db = mysql_pconnect("localhost","login","pass"); > mysql_select_db("database",$db); > > //Check for the IP > $result2 = mysql_query("SELECT ip FROM ip where ip = > '$RE

Re: [PHP] mysql_fetch_array()

2001-03-07 Thread David Robley
On Thu, 8 Mar 2001 14:03, Deependra B. Tandukar wrote: > Greetings! > > I am using PHP and MySQL in RedHat 6.0. > I have used mysql_fetch_array() to display the datas in web page but > all the columns are printed twice. What can be the wrong with my code: > $connection=mysql_connection(.

RE: [PHP] mysql_fetch_array()

2001-03-07 Thread Tyler Longren
"; while ($row=mysql_fetch_array($sql_result)) { print ""; foreach ($row as $field) print "$field"; print ""; print "Get it"; print ""; print ""; } print ""; ?> Try that, you tried to call $mysql_query, when you needed to call mysql_query. In your code, $m

RE: [PHP] mysql_fetch_array and row referencing under 4.0.4pl1

2001-02-13 Thread Scott Brown
crawl back under my rock now. > -Original Message- > From: Steve Werby [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, February 13, 2001 12:26 AM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: Re: [PHP] mysql_fetch_array and row referencing > under 4.0.4pl1 > >

Re: [PHP] mysql_fetch_array and row referencing under 4.0.4pl1

2001-02-12 Thread Steve Werby
"Scott Brown" <[EMAIL PROTECTED]> wrote: > I grabbed an example of of php.net dealing with just arrays and it works ... > > Here's what I'm seeing - THIS WORKS: > while ( $row = mysql_fetch_array($rslt) ) > { > echo "\n"; > echo "$row[ID]"; > But

RE: [PHP] mysql_fetch_array and row referencing under 4.0.4pl1

2001-02-12 Thread Scott Brown
> > I'd be curious to see others' answers on this because I > upgraded everything > the other day (been at php4 for a while though) and I don't > have a problem > with the quotes. > I've probably just putzed something somewhere during the build it's been one of those days. But the thing i

RE: [PHP] mysql_fetch_array and row referencing under 4.0.4pl1

2001-02-12 Thread Scott Brown
> Forgot to ask - does referencing an array with double quotes > around the key work for arrays not associated with a MySQL > result? I doubt it's specific to MySQL result arrays, but > it doesn't hurt to check. Make a small array and test. I grabbed an example of of php.net dealing with just

Re: [PHP] mysql_fetch_array and row referencing under 4.0.4pl1

2001-02-12 Thread Steve Werby
"Scott Brown" <[EMAIL PROTECTED]> wrote: > $row["this_is_a_field_name"] > > Seems simple, right? > > Well - I compiled a new copy of Apache 1.3.17, pushed PHP up to 4.0.4pl1, > and upgraded mysql to the new stable version at the same time... > > Now the above code doesnt work. But if I do a: For

Re: [PHP] mysql_fetch_array and row referencing under 4.0.4pl1

2001-02-12 Thread Steve Werby
"Scott Brown" <[EMAIL PROTECTED]> wrote: > I have code which runs under PHP3.0.15, and PHP4.0.2 which references the > result of a > $row["this_is_a_field_name"] > > Well - I compiled a new copy of Apache 1.3.17, pushed PHP up to 4.0.4pl1, > and upgraded mysql to the new stable version at the same

Re: [PHP] mysql_fetch_array and row referencing under 4.0.4pl1

2001-02-12 Thread Thomas Deliduka
I'd be curious to see others' answers on this because I upgraded everything the other day (been at php4 for a while though) and I don't have a problem with the quotes. On 2/12/01 11:11 PM this was written: > Have I lost something somewhere? > > I have code which runs under PHP3.0.15, and PHP4.0

Re: [PHP] mysql_fetch_array strangeness

2001-01-24 Thread Markus Fischer
Because, basically, in php an array is a hash with just numbers as keys. m. -- Markus Fischer, http://josefine.ben.tuwien.ac.at/~mfischer/ EMail: [EMAIL PROTECTED] PGP Public Key: http://josefine.ben.tuwien.ac.at/~mfischer/C2272BD0.asc PGP Fingerprint: D3B0 DD4F E12B F911 3CE1 C2B5

Re: [PHP] mysql_fetch_array strangeness

2001-01-21 Thread Kristi Russell
each() assigns four elements... (0 = index), (1 = value), (key = index), (value = value) You are concerned with key and value. So: list ($fieldname, $value) = each($row) You may not be using $value but you still need to assign the data to a variable. Or list will only assign $fieldname the num

Re: [PHP] mysql_fetch_array strangeness

2001-01-21 Thread Kristi Russell
each() assigns four elements... (0 = index), (1 = value), (key = index), (value = value) You are concerned with key and value. So: list ($fieldname, $value) = each($row) You may not be using $value but you still need to assign the data to a variable. Or list will only assign $fieldname the num

Re: [PHP] mysql_fetch_array strangeness

2001-01-21 Thread Richard Lynch
> $rowData = mysql_fetch_array($result); mysql_fetch_array can return an array with only numeric indices, only text (fieldname) indices, *OR* *BOTH*, the default. You need to use the "optional" argument: $rowData = mysql_fetch_array($result, MYSQL_ASSOC); By Day: