RE: [PHP-DB] Mysql_fetch_array

2004-09-30 Thread Ryan Jameson \(USA\)
It means that the  "supplied argument is not a valid MySQL result
resource" so.. Line 17 of your script mailsender2.php is trying to
manipulate a variable that isn't actually a mysql result. In some
previous line you should have set the result resource variable equal to
something else, on that line there is probably some problem with your
query or it is empty altogether.

We usually call "result resource" variables $rs, but it can be anything
you or your program wanted to call it...

<>< Ryan

-Original Message-
From: Yemi Obembe [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 30, 2004 2:30 PM
To: [EMAIL PROTECTED]
Subject: *** Detected as Spam ***[PHP-DB] Mysql_fetch_array



Does anyone have an idea what may probably be the cause of this error: 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
result resource in /var/www/ng/mailsender2.php on line 17



-

A passion till tomorrow,
www.opeyemi.tk





-
Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Mysql_fetch_array

2004-09-30 Thread Brian
Yup, we're mind readers, I can figure out your entire script and
database structure from the error message.


On Thu, 30 Sep 2004 13:30:25 -0700 (PDT), Yemi Obembe
<[EMAIL PROTECTED]> wrote:
> 
> 
> Does anyone have an idea what may probably be the cause of this error:
> 
> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource 
> in /var/www/ng/mailsender2.php on line 17
> 
> -
> 
> A passion till tomorrow,
> www.opeyemi.tk
> 
> 
> -
> Do you Yahoo!?
> Y! Messenger - Communicate in real time. Download now.
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Mysql_fetch_array

2004-09-30 Thread Yemi Obembe


Does anyone have an idea what may probably be the cause of this error: 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource 
in /var/www/ng/mailsender2.php on line 17




-

A passion till tomorrow,
www.opeyemi.tk





-
Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now.

Re: [PHP-DB] mysql_fetch_array issues.

2003-07-09 Thread Kieu D. Trang
this error only means that your msql_query($result) was correct, but did
not have any result...  meaning, there was nothing to select, there for
there is nothing to fetch...  hence you can not do a msql_fetch_array() on
an empty result set.

KD


On Wed, 9 Jul 2003, Greg Hetrick wrote:

> Yup, I have all permissions -- it appears that I can access mysql but not
> the database itself.
>
> "Gary Every" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> .
> > Do you have select permissions on that DB/table?
> >
> > If you have GRANT permissions, try
> > GRANS SELECT, INSERT, UPDATE, DELETE ON db.tablename to
> > 'youruser'@'your.ip.address' IDENTIFIED BY 'yourpassword';
> >
> > your.ip.address can be substituted with localhost if you're on the same
> box.
> >
> >
> > Gary Every
> > Sr. UNIX Administrator
> > Ingram Entertainment
> > (615) 287-4876
> > "Pay It Forward"
> > mailto:[EMAIL PROTECTED]
> > http://accessingram.com
> >
> >
> > > -Original Message-
> > > From: Greg Hetrick [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, July 09, 2003 12:31 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: [PHP-DB] mysql_fetch_array issues.
> > >
> > >
> > > I do not have the die statment -- the DB is the same except
> > > the name and I
> > > have double checked that I just did a back up of the previous
> > > db and moved
> > > it to the new server. I have done some more digging, my query
> > > appears to
> > > work, but I almost appears that I have a problem with selecting the
> > > database --
> > > if I comment out the mysql_select -- statment I get the same
> > > error, perhaps
> > > I just can't get to that DB.
> > > intresting.
> > >
> > > I guess I can assume at this point there is something flaky with my DB
> > >
> > >
> > > "Jeffrey N Dyke" <[EMAIL PROTECTED]> wrote in message
> > > news:[EMAIL PROTECTED]
> > > >
> > > > Do you have an 'or die(mysql_error())'  statement following your
> > > > mysql_query($result) line.  99% of the time, this error
> > > means your query
> > > > failed.  if it works on another serverare the fields
> > > the same, the
> > > > dbname, the tablename?
> > > >
> > > > hth
> > > > jeff
> > > >
> > > >
> > > >
> > > >   "Greg Hetrick"
> > > >   <[EMAIL PROTECTED]To:
> > > [EMAIL PROTECTED]
> > > >   net> cc:
> > > >Subject:  [PHP-DB]
> > > mysql_fetch_array issues.
> > > >   07/09/2003 12:04
> > > >   PM
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > I am getting the following error when attempting to pull
> > > data out of a
> > > > mysql
> > > > DB
> > > >
> > > > Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
> > > result
> > > > resource in
> > > /home/pffl/public_html/pffl/webpage/html/dataentry.php on line
> > > > 125
> > > >
> > > > I can take this same code to a different web server and it
> > > is pulling
> > > > correctly!
> > > >
> > > > I am currently running Apache 2.0.46 with PHP 4.3.2 I was
> > > running Apache
> > > > 1.3.x with PHP 4.3.1 and getting the same thing, any ideas?
> > > here is the
> > > > chunk of code where I use the function.
> > > >
> > > > while ($myrow=mysql_fetch_array($result))
> > > > {
> > > > ?>
> > > >  
> > > >  > > > }
> > > >
> > > > Any Ideas.
> > > >
> > > >
> > > >
> > > > --
> > > > PHP Database Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] mysql_fetch_array issues.

2003-07-09 Thread Greg Hetrick
Yup, I have all permissions -- it appears that I can access mysql but not
the database itself.

"Gary Every" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
.
> Do you have select permissions on that DB/table?
>
> If you have GRANT permissions, try
> GRANS SELECT, INSERT, UPDATE, DELETE ON db.tablename to
> 'youruser'@'your.ip.address' IDENTIFIED BY 'yourpassword';
>
> your.ip.address can be substituted with localhost if you're on the same
box.
>
>
> Gary Every
> Sr. UNIX Administrator
> Ingram Entertainment
> (615) 287-4876
> "Pay It Forward"
> mailto:[EMAIL PROTECTED]
> http://accessingram.com
>
>
> > -Original Message-
> > From: Greg Hetrick [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, July 09, 2003 12:31 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] mysql_fetch_array issues.
> >
> >
> > I do not have the die statment -- the DB is the same except
> > the name and I
> > have double checked that I just did a back up of the previous
> > db and moved
> > it to the new server. I have done some more digging, my query
> > appears to
> > work, but I almost appears that I have a problem with selecting the
> > database --
> > if I comment out the mysql_select -- statment I get the same
> > error, perhaps
> > I just can't get to that DB.
> > intresting.
> >
> > I guess I can assume at this point there is something flaky with my DB
> >
> >
> > "Jeffrey N Dyke" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > >
> > > Do you have an 'or die(mysql_error())'  statement following your
> > > mysql_query($result) line.  99% of the time, this error
> > means your query
> > > failed.  if it works on another serverare the fields
> > the same, the
> > > dbname, the tablename?
> > >
> > > hth
> > > jeff
> > >
> > >
> > >
> > >   "Greg Hetrick"
> > >   <[EMAIL PROTECTED]To:
> > [EMAIL PROTECTED]
> > >   net> cc:
> > >Subject:  [PHP-DB]
> > mysql_fetch_array issues.
> > >   07/09/2003 12:04
> > >   PM
> > >
> > >
> > >
> > >
> > >
> > >
> > > I am getting the following error when attempting to pull
> > data out of a
> > > mysql
> > > DB
> > >
> > > Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
> > result
> > > resource in
> > /home/pffl/public_html/pffl/webpage/html/dataentry.php on line
> > > 125
> > >
> > > I can take this same code to a different web server and it
> > is pulling
> > > correctly!
> > >
> > > I am currently running Apache 2.0.46 with PHP 4.3.2 I was
> > running Apache
> > > 1.3.x with PHP 4.3.1 and getting the same thing, any ideas?
> > here is the
> > > chunk of code where I use the function.
> > >
> > > while ($myrow=mysql_fetch_array($result))
> > > {
> > > ?>
> > >  
> > >  > > }
> > >
> > > Any Ideas.
> > >
> > >
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> > >
> > >
> > >
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] mysql_fetch_array issues.

2003-07-09 Thread Gary . Every
Do you have select permissions on that DB/table?

If you have GRANT permissions, try
GRANS SELECT, INSERT, UPDATE, DELETE ON db.tablename to
'youruser'@'your.ip.address' IDENTIFIED BY 'yourpassword';

your.ip.address can be substituted with localhost if you're on the same box.


Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
"Pay It Forward"
mailto:[EMAIL PROTECTED]
http://accessingram.com


> -Original Message-
> From: Greg Hetrick [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 09, 2003 12:31 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] mysql_fetch_array issues.
> 
> 
> I do not have the die statment -- the DB is the same except 
> the name and I
> have double checked that I just did a back up of the previous 
> db and moved
> it to the new server. I have done some more digging, my query 
> appears to
> work, but I almost appears that I have a problem with selecting the
> database --
> if I comment out the mysql_select -- statment I get the same 
> error, perhaps
> I just can't get to that DB.
> intresting.
> 
> I guess I can assume at this point there is something flaky with my DB
> 
> 
> "Jeffrey N Dyke" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> >
> > Do you have an 'or die(mysql_error())'  statement following your
> > mysql_query($result) line.  99% of the time, this error 
> means your query
> > failed.  if it works on another serverare the fields 
> the same, the
> > dbname, the tablename?
> >
> > hth
> > jeff
> >
> >
> >
> >           "Greg Hetrick"
> >   <[EMAIL PROTECTED]To:
> [EMAIL PROTECTED]
> >   net> cc:
> >Subject:  [PHP-DB]
> mysql_fetch_array issues.
> >   07/09/2003 12:04
> >   PM
> >
> >
> >
> >
> >
> >
> > I am getting the following error when attempting to pull 
> data out of a
> > mysql
> > DB
> >
> > Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
> result
> > resource in 
> /home/pffl/public_html/pffl/webpage/html/dataentry.php on line
> > 125
> >
> > I can take this same code to a different web server and it 
> is pulling
> > correctly!
> >
> > I am currently running Apache 2.0.46 with PHP 4.3.2 I was 
> running Apache
> > 1.3.x with PHP 4.3.1 and getting the same thing, any ideas? 
> here is the
> > chunk of code where I use the function.
> >
> > while ($myrow=mysql_fetch_array($result))
> > {
> > ?>
> >  
> >  > }
> >
> > Any Ideas.
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
> >
> >
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


Re: [PHP-DB] mysql_fetch_array issues.

2003-07-09 Thread Greg Hetrick
Query is correct appears to be a problem connecting to the db -- I can
comment out the mysql_select line and I get no change.

"Terry Riley" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> As far as I know, that error means that the query that was supposed to
> produce $result did not run because of errors in the SQL (or the
> database).
>
> Suggest you check your query in myPHPAdmin or MySQLfront or whatever to be
> sure that it has no errors.
>
> Terry
>
> --Original Message-
>
> > I am getting the following error when attempting to pull data out of a
> > mysql
> > DB
> >
> > Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
> > result
> > resource in /home/pffl/public_html/pffl/webpage/html/dataentry.php on
> > line
> > 125
> >
> > I can take this same code to a different web server and it is pulling
> > correctly!
> >
> > I am currently running Apache 2.0.46 with PHP 4.3.2 I was running Apache
> > 1.3.x with PHP 4.3.1 and getting the same thing, any ideas? here is the
> > chunk of code where I use the function.
> >
> > while ($myrow=mysql_fetch_array($result))
> > {
> > ?>
> >  
> >  > }
> >
> > Any Ideas.
> >
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] mysql_fetch_array issues.

2003-07-09 Thread Greg Hetrick
I do not have the die statment -- the DB is the same except the name and I
have double checked that I just did a back up of the previous db and moved
it to the new server. I have done some more digging, my query appears to
work, but I almost appears that I have a problem with selecting the
database --
if I comment out the mysql_select -- statment I get the same error, perhaps
I just can't get to that DB.
intresting.

I guess I can assume at this point there is something flaky with my DB


"Jeffrey N Dyke" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Do you have an 'or die(mysql_error())'  statement following your
> mysql_query($result) line.  99% of the time, this error means your query
> failed.  if it works on another serverare the fields the same, the
> dbname, the tablename?
>
> hth
> jeff
>
>
>
>   "Greg Hetrick"
>   <[EMAIL PROTECTED]To:
[EMAIL PROTECTED]
>   net>     cc:
>Subject:  [PHP-DB]
mysql_fetch_array issues.
>   07/09/2003 12:04
>   PM
>
>
>
>
>
>
> I am getting the following error when attempting to pull data out of a
> mysql
> DB
>
> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
result
> resource in /home/pffl/public_html/pffl/webpage/html/dataentry.php on line
> 125
>
> I can take this same code to a different web server and it is pulling
> correctly!
>
> I am currently running Apache 2.0.46 with PHP 4.3.2 I was running Apache
> 1.3.x with PHP 4.3.1 and getting the same thing, any ideas? here is the
> chunk of code where I use the function.
>
> while ($myrow=mysql_fetch_array($result))
> {
> ?>
>  
>  }
>
> Any Ideas.
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] mysql_fetch_array issues.

2003-07-09 Thread Terry Riley
As far as I know, that error means that the query that was supposed to 
produce $result did not run because of errors in the SQL (or the 
database).

Suggest you check your query in myPHPAdmin or MySQLfront or whatever to be 
sure that it has no errors.

Terry

--Original Message-  

> I am getting the following error when attempting to pull data out of a 
> mysql
> DB
> 
> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL 
> result
> resource in /home/pffl/public_html/pffl/webpage/html/dataentry.php on 
> line
> 125
> 
> I can take this same code to a different web server and it is pulling
> correctly!
> 
> I am currently running Apache 2.0.46 with PHP 4.3.2 I was running Apache
> 1.3.x with PHP 4.3.1 and getting the same thing, any ideas? here is the
> chunk of code where I use the function.
> 
> while ($myrow=mysql_fetch_array($result))
> {
> ?>
>  
>  }
> 
> Any Ideas.
> 



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] mysql_fetch_array issues.

2003-07-09 Thread jeffrey_n_Dyke

Do you have an 'or die(mysql_error())'  statement following your
mysql_query($result) line.  99% of the time, this error means your query
failed.  if it works on another serverare the fields the same, the
dbname, the tablename?

hth
jeff


   
 
  "Greg Hetrick"   
 
  <[EMAIL PROTECTED]To:   [EMAIL PROTECTED]
   
  net> cc: 
 
           Subject:  [PHP-DB] mysql_fetch_array 
issues. 
  07/09/2003 12:04 
 
  PM   
 
   
 
   
 




I am getting the following error when attempting to pull data out of a
mysql
DB

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in /home/pffl/public_html/pffl/webpage/html/dataentry.php on line
125

I can take this same code to a different web server and it is pulling
correctly!

I am currently running Apache 2.0.46 with PHP 4.3.2 I was running Apache
1.3.x with PHP 4.3.1 and getting the same thing, any ideas? here is the
chunk of code where I use the function.

while ($myrow=mysql_fetch_array($result))
{
?>
 
http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] mysql_fetch_array issues.

2003-07-09 Thread Greg Hetrick
I am getting the following error when attempting to pull data out of a mysql
DB

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
resource in /home/pffl/public_html/pffl/webpage/html/dataentry.php on line
125

I can take this same code to a different web server and it is pulling
correctly!

I am currently running Apache 2.0.46 with PHP 4.3.2 I was running Apache
1.3.x with PHP 4.3.1 and getting the same thing, any ideas? here is the
chunk of code where I use the function.

while ($myrow=mysql_fetch_array($result))
{
?>
 
http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] mysql_fetch_array

2003-02-25 Thread f.collineau
Hi, 
 
Here is my code: 
Setup("user","user","localhost"); 
$sql->connexion("materiel"); 
$sql->Query("select nom from personne"); 
$cpt=0; 
while($row=mysql_fetch_array($sql->result)) 
{
print($cpt); 
print("");  
print($row["nom"]); 
print(""); 
$cpt++; 
}
$sql->close; 
?> 
 
The personne table has 14 articles. 
but with this code i can see only 13 articles 
 
here is the output on a browser: 
0BRUYÈRE 
1COLLINEAU 
2ELIAS 
3GLOANEC 
4HUGOT 
5LE BRIS 
6LE FLOCH 
7LEMAUVIEL 
8LOUVEL 
9MARTINIERE 
10OGUET 
11THOMAS 
12VASSELET 
 
What is the problem ? 
 
Thanks 
 
Franck 
 
--

Faites un voeu et puis Voila ! www.voila.fr 



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] mysql_fetch_array and extract() with LEFT SELECT

2003-02-19 Thread Mark
Try "SELECT id,LEFT(fluff,80) as fluffy FROM sometable"

Then extract() will have a value for fluffy


--- Baumgartner Jeffrey <[EMAIL PROTECTED]> wrote:
> I'm having a problem when I use mysql_fetch_array and extract()
> following a
> left select query. As an example...
> 
> $query = "SELECT id,LEFT(fluff,80) FROM sometable";
> $result = mysql_query($query) or die('message');
> 
> while ($row = mysql_fetch_array($result){
> extract($row);
> echo "" . $id . ": " . $fluff . "";
> }
> 
> would echo the $id, but there would be nothing for $fluff. However,
> if I
> select only 'fluff' from the MySQL table, I get the full text for
> $fluff. I
> am reluctant to SELECT the entire fluff text from the table and
> shorten it
> in PHP  as that seems inefficient to me - (but correct me if I am
> wrong).
> 
> I expect the solution must be dead easy, but I can't find it or
> figure it
> out.
> 
> Many thanks,
> 
> Jeffrey
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a "right" unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***

__
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] mysql_fetch_array and extract() with LEFT SELECT

2003-02-19 Thread Baumgartner Jeffrey
I'm having a problem when I use mysql_fetch_array and extract() following a
left select query. As an example...

$query = "SELECT id,LEFT(fluff,80) FROM sometable";
$result = mysql_query($query) or die('message');

while ($row = mysql_fetch_array($result){
extract($row);
echo "" . $id . ": " . $fluff . "";
}

would echo the $id, but there would be nothing for $fluff. However, if I
select only 'fluff' from the MySQL table, I get the full text for $fluff. I
am reluctant to SELECT the entire fluff text from the table and shorten it
in PHP  as that seems inefficient to me - (but correct me if I am wrong).

I expect the solution must be dead easy, but I can't find it or figure it
out.

Many thanks,

Jeffrey

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] mysql_fetch_array() question

2002-11-06 Thread Josh Johnson
Of course, you can avoid that problem if you use a join, I guess it all
comes down to code complexity vs SQL complexity. 

-- Josh

-Original Message-
From: Ignatius Reilly [mailto:ignatius.reilly@;free.fr] 
Sent: Wednesday, November 06, 2002 1:38 PM
To: Josh Johnson; '1LT John W. Holmes'; 'Graeme McLaren';
[EMAIL PROTECTED]
Subject: Re: [PHP-DB] mysql_fetch_array() question

John is right. In fact one routinely calls two different $result(s) when
coding nested loops:
while( $details = mysql_fetch_array( $result ) ) {
while ( $Email = mysql_fetch_array( $result2 ) )
..
}
}

when executing the next instance of your loop:
while( $details = mysql_fetch_array( $result ) and $Email =
mysql_fetch_array( $result2 ) ),

each mysql_fetch_array will push both pointers (on your two result
resources) by one position.
if your result sets do not have the same number of rows, the shorter one
will choke before the longer one is finished. therefore you will finish
the
loop not having called all results from the "long" resource.

My 0.02 Belgian francs
Ignatius

- Original Message -
From: "Josh Johnson" <[EMAIL PROTECTED]>
To: "'1LT John W. Holmes'" <[EMAIL PROTECTED]>; "'Graeme
McLaren'"
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, November 06, 2002 7:24 PM
Subject: RE: [PHP-DB] mysql_fetch_array() question


> :) see why I love mailing lists! :)
>
> It must have been their logic then, I respectfully retract everything
I
> said, sorry Graeme! Why do I have to work, I could spend my days
> researching this stuff before I post!
>
> Thanks John!
> -- Josh
>
> -Original Message-
> From: 1LT John W. Holmes [mailto:holmes072000@;charter.net]
> Sent: Wednesday, November 06, 2002 1:21 PM
> To: Josh Johnson; 'Graeme McLaren'; [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] mysql_fetch_array() question
>
> That's not true. You can assign them to different variables and it
works
> fine.
>
> $r1 = mysql_query("select * from main limit 1") or die(mysql_error());
> $r2 = mysql_query("select * from apft limit 1") or die(mysql_error());
>
> $row1 = mysql_fetch_array($r1);
> $row2 = mysql_fetch_array($r2);
>
> print_r($row1);
> echo "";
> print_r($row2);
>
> ---John Holmes...
>
> - Original Message -
> From: "Josh Johnson" <[EMAIL PROTECTED]>
> To: "'Graeme McLaren'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Wednesday, November 06, 2002 1:02 PM
> Subject: RE: [PHP-DB] mysql_fetch_array() question
>
>
> > In my experience, (I haven't checked the docs just yet to figure out
> > exactly why), you can only work with one result id at a time. Every
> time
> > you call mysql_query, it resets the result id (I think it frees the
> > result id automatically so you can send another query before getting
> the
> > new result id), so even if you store it in two separate variables,
it
> > will only refrence the last id (which sounds just like what happened
> in
> > your initial post). I think this is limited to a given connection,
but
> > I'm not sure.
> >
> > One of the, I guess you could say, "shortcomings" of the mysql
> interface
> > in php is that you can only execute one query at a time, and I think
> > this odd result id overwrighting that happens is due to that fact (I
> > might be wrong, but I think you can execute multiple queries at a
time
> > with perl's DBI module).
> >
> > I hope that makes more sense :)
> >
> > -- Josh
> >
> > -Original Message-
> > From: Graeme McLaren [mailto:mickel@;ntlworld.com]
> > Sent: Wednesday, November 06, 2002 12:17 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] mysql_fetch_array() question
> >
> > Josh, Thank you for reply.  Thank you to everyone else who replied
to
> my
> > email also.  I solved the problem shortly after posting my question,
> > I've
> > now got a massive SQL query which does the trick.
> >
> > I was interested when you replied and part of it read:  "Just
> > remember that you can only work with one mysql result per connection
> at
> > a time".  Can you explain a little more about that please?  I don't
> > think I
> > fully understand what you mean.
> >
> > Cheers,
> >
> > Graeme :)
> >
> > - Original Message -
> > From: "Josh Johnson" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, November 06, 2002 12:

Re: [PHP-DB] mysql_fetch_array() question

2002-11-06 Thread Ignatius Reilly
John is right. In fact one routinely calls two different $result(s) when
coding nested loops:
while( $details = mysql_fetch_array( $result ) ) {
while ( $Email = mysql_fetch_array( $result2 ) )
..
}
}

when executing the next instance of your loop:
while( $details = mysql_fetch_array( $result ) and $Email =
mysql_fetch_array( $result2 ) ),

each mysql_fetch_array will push both pointers (on your two result
resources) by one position.
if your result sets do not have the same number of rows, the shorter one
will choke before the longer one is finished. therefore you will finish the
loop not having called all results from the "long" resource.

My 0.02 Belgian francs
Ignatius

- Original Message -
From: "Josh Johnson" <[EMAIL PROTECTED]>
To: "'1LT John W. Holmes'" <[EMAIL PROTECTED]>; "'Graeme McLaren'"
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, November 06, 2002 7:24 PM
Subject: RE: [PHP-DB] mysql_fetch_array() question


> :) see why I love mailing lists! :)
>
> It must have been their logic then, I respectfully retract everything I
> said, sorry Graeme! Why do I have to work, I could spend my days
> researching this stuff before I post!
>
> Thanks John!
> -- Josh
>
> -Original Message-
> From: 1LT John W. Holmes [mailto:holmes072000@;charter.net]
> Sent: Wednesday, November 06, 2002 1:21 PM
> To: Josh Johnson; 'Graeme McLaren'; [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] mysql_fetch_array() question
>
> That's not true. You can assign them to different variables and it works
> fine.
>
> $r1 = mysql_query("select * from main limit 1") or die(mysql_error());
> $r2 = mysql_query("select * from apft limit 1") or die(mysql_error());
>
> $row1 = mysql_fetch_array($r1);
> $row2 = mysql_fetch_array($r2);
>
> print_r($row1);
> echo "";
> print_r($row2);
>
> ---John Holmes...
>
> ----- Original Message -
> From: "Josh Johnson" <[EMAIL PROTECTED]>
> To: "'Graeme McLaren'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Wednesday, November 06, 2002 1:02 PM
> Subject: RE: [PHP-DB] mysql_fetch_array() question
>
>
> > In my experience, (I haven't checked the docs just yet to figure out
> > exactly why), you can only work with one result id at a time. Every
> time
> > you call mysql_query, it resets the result id (I think it frees the
> > result id automatically so you can send another query before getting
> the
> > new result id), so even if you store it in two separate variables, it
> > will only refrence the last id (which sounds just like what happened
> in
> > your initial post). I think this is limited to a given connection, but
> > I'm not sure.
> >
> > One of the, I guess you could say, "shortcomings" of the mysql
> interface
> > in php is that you can only execute one query at a time, and I think
> > this odd result id overwrighting that happens is due to that fact (I
> > might be wrong, but I think you can execute multiple queries at a time
> > with perl's DBI module).
> >
> > I hope that makes more sense :)
> >
> > -- Josh
> >
> > -Original Message-
> > From: Graeme McLaren [mailto:mickel@;ntlworld.com]
> > Sent: Wednesday, November 06, 2002 12:17 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] mysql_fetch_array() question
> >
> > Josh, Thank you for reply.  Thank you to everyone else who replied to
> my
> > email also.  I solved the problem shortly after posting my question,
> > I've
> > now got a massive SQL query which does the trick.
> >
> > I was interested when you replied and part of it read:  "Just
> > remember that you can only work with one mysql result per connection
> at
> > a time".  Can you explain a little more about that please?  I don't
> > think I
> > fully understand what you mean.
> >
> > Cheers,
> >
> > Graeme :)
> >
> > - Original Message -
> > From: "Josh Johnson" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, November 06, 2002 12:29 PM
> > Subject: RE: [PHP-DB] mysql_fetch_array() question
> >
> >
> > > I concur with Jason, but if restructuring is out of the question,
> just
> > > rearrange your queries like this:
> > >
> > > $query = "SELECT Name, Address FROM users";
> > > $result = mysql_query($query);
> > > while($details = mysql_fetch_arr

RE: [PHP-DB] mysql_fetch_array() question

2002-11-06 Thread Josh Johnson
:) see why I love mailing lists! :)

It must have been their logic then, I respectfully retract everything I
said, sorry Graeme! Why do I have to work, I could spend my days
researching this stuff before I post! 

Thanks John!
-- Josh

-Original Message-
From: 1LT John W. Holmes [mailto:holmes072000@;charter.net] 
Sent: Wednesday, November 06, 2002 1:21 PM
To: Josh Johnson; 'Graeme McLaren'; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] mysql_fetch_array() question

That's not true. You can assign them to different variables and it works
fine.

$r1 = mysql_query("select * from main limit 1") or die(mysql_error());
$r2 = mysql_query("select * from apft limit 1") or die(mysql_error());

$row1 = mysql_fetch_array($r1);
$row2 = mysql_fetch_array($r2);

print_r($row1);
echo "";
print_r($row2);

---John Holmes...

- Original Message -
From: "Josh Johnson" <[EMAIL PROTECTED]>
To: "'Graeme McLaren'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, November 06, 2002 1:02 PM
Subject: RE: [PHP-DB] mysql_fetch_array() question


> In my experience, (I haven't checked the docs just yet to figure out
> exactly why), you can only work with one result id at a time. Every
time
> you call mysql_query, it resets the result id (I think it frees the
> result id automatically so you can send another query before getting
the
> new result id), so even if you store it in two separate variables, it
> will only refrence the last id (which sounds just like what happened
in
> your initial post). I think this is limited to a given connection, but
> I'm not sure.
>
> One of the, I guess you could say, "shortcomings" of the mysql
interface
> in php is that you can only execute one query at a time, and I think
> this odd result id overwrighting that happens is due to that fact (I
> might be wrong, but I think you can execute multiple queries at a time
> with perl's DBI module).
>
> I hope that makes more sense :)
>
> -- Josh
>
> -Original Message-
> From: Graeme McLaren [mailto:mickel@;ntlworld.com]
> Sent: Wednesday, November 06, 2002 12:17 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] mysql_fetch_array() question
>
> Josh, Thank you for reply.  Thank you to everyone else who replied to
my
> email also.  I solved the problem shortly after posting my question,
> I've
> now got a massive SQL query which does the trick.
>
> I was interested when you replied and part of it read:  "Just
> remember that you can only work with one mysql result per connection
at
> a time".  Can you explain a little more about that please?  I don't
> think I
> fully understand what you mean.
>
> Cheers,
>
> Graeme :)
>
> - Original Message -
> From: "Josh Johnson" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, November 06, 2002 12:29 PM
> Subject: RE: [PHP-DB] mysql_fetch_array() question
>
>
> > I concur with Jason, but if restructuring is out of the question,
just
> > rearrange your queries like this:
> >
> > $query = "SELECT Name, Address FROM users";
> > $result = mysql_query($query);
> > while($details = mysql_fetch_array($result)){
> > echo "Name: $details[Name]";
> > echo "Address: $details[Address]";
> > }
> > $query2 = "SELECT EmailAddress From Members";
> > $result2 = mysql_query($query2);
> > while($details = mysql_fetch_array($result2)){
> > echo "Email: $Email[EmailAddress]";
> > }
> >
> > The results won't come out at the same time, but you could use some
> > logic to combine the results into an array by a common factor. Just
> > remember that you can only work with one mysql result per connection
> at
> > a time. You *may* (untested!) be able to accomplish what you want to
> do
> > with two separate connections, but again, this is seriously
overkill.
> :)
> >
> > I'd definitely recommend restructuring your talbes as Jason
suggested.
> > -- Josh
> >
> >
> > -Original Message-
> > From: Jason Wong [mailto:phplist@;gremlins.com.hk]
> > Sent: Wednesday, November 06, 2002 5:24 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] mysql_fetch_array() question
> >
> > On Tuesday 05 November 2002 05:47, Graeme McLaren wrote:
> > > Hi, Anyone know how I can use two mysql_fetch_array() functions
> > similar
> > > to the code below?  I've tried a few different ways but I keep
> getting
> > > Resource ID #4.  I need to do this to retrieve an email address
from
> > one
> > > t

Re: [PHP-DB] mysql_fetch_array() question

2002-11-06 Thread 1LT John W. Holmes
That's not true. You can assign them to different variables and it works
fine.

$r1 = mysql_query("select * from main limit 1") or die(mysql_error());
$r2 = mysql_query("select * from apft limit 1") or die(mysql_error());

$row1 = mysql_fetch_array($r1);
$row2 = mysql_fetch_array($r2);

print_r($row1);
echo "";
print_r($row2);

---John Holmes...

- Original Message -
From: "Josh Johnson" <[EMAIL PROTECTED]>
To: "'Graeme McLaren'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, November 06, 2002 1:02 PM
Subject: RE: [PHP-DB] mysql_fetch_array() question


> In my experience, (I haven't checked the docs just yet to figure out
> exactly why), you can only work with one result id at a time. Every time
> you call mysql_query, it resets the result id (I think it frees the
> result id automatically so you can send another query before getting the
> new result id), so even if you store it in two separate variables, it
> will only refrence the last id (which sounds just like what happened in
> your initial post). I think this is limited to a given connection, but
> I'm not sure.
>
> One of the, I guess you could say, "shortcomings" of the mysql interface
> in php is that you can only execute one query at a time, and I think
> this odd result id overwrighting that happens is due to that fact (I
> might be wrong, but I think you can execute multiple queries at a time
> with perl's DBI module).
>
> I hope that makes more sense :)
>
> -- Josh
>
> -----Original Message-----
> From: Graeme McLaren [mailto:mickel@;ntlworld.com]
> Sent: Wednesday, November 06, 2002 12:17 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] mysql_fetch_array() question
>
> Josh, Thank you for reply.  Thank you to everyone else who replied to my
> email also.  I solved the problem shortly after posting my question,
> I've
> now got a massive SQL query which does the trick.
>
> I was interested when you replied and part of it read:  "Just
> remember that you can only work with one mysql result per connection at
> a time".  Can you explain a little more about that please?  I don't
> think I
> fully understand what you mean.
>
> Cheers,
>
> Graeme :)
>
> - Original Message -
> From: "Josh Johnson" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, November 06, 2002 12:29 PM
> Subject: RE: [PHP-DB] mysql_fetch_array() question
>
>
> > I concur with Jason, but if restructuring is out of the question, just
> > rearrange your queries like this:
> >
> > $query = "SELECT Name, Address FROM users";
> > $result = mysql_query($query);
> > while($details = mysql_fetch_array($result)){
> > echo "Name: $details[Name]";
> > echo "Address: $details[Address]";
> > }
> > $query2 = "SELECT EmailAddress From Members";
> > $result2 = mysql_query($query2);
> > while($details = mysql_fetch_array($result2)){
> > echo "Email: $Email[EmailAddress]";
> > }
> >
> > The results won't come out at the same time, but you could use some
> > logic to combine the results into an array by a common factor. Just
> > remember that you can only work with one mysql result per connection
> at
> > a time. You *may* (untested!) be able to accomplish what you want to
> do
> > with two separate connections, but again, this is seriously overkill.
> :)
> >
> > I'd definitely recommend restructuring your talbes as Jason suggested.
> > -- Josh
> >
> >
> > -Original Message-
> > From: Jason Wong [mailto:phplist@;gremlins.com.hk]
> > Sent: Wednesday, November 06, 2002 5:24 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] mysql_fetch_array() question
> >
> > On Tuesday 05 November 2002 05:47, Graeme McLaren wrote:
> > > Hi, Anyone know how I can use two mysql_fetch_array() functions
> > similar
> > > to the code below?  I've tried a few different ways but I keep
> getting
> > > Resource ID #4.  I need to do this to retrieve an email address from
> > one
> > > table and retrieve details from another.
> > >
> > > Cheers for any tips - I'm stumped with this one,
> > >
> > > Graeme :)
> > >
> > > $query = "SELECT Name, Address FROM users";
> > > $query2 = "SELECT EmailAddress From Members";
> > >
> > > $result = mysql_query($query);
> > > $result2 = mysql_query($query2);
> > >
> > > while($details = my

RE: [PHP-DB] mysql_fetch_array() question

2002-11-06 Thread Josh Johnson
In my experience, (I haven't checked the docs just yet to figure out
exactly why), you can only work with one result id at a time. Every time
you call mysql_query, it resets the result id (I think it frees the
result id automatically so you can send another query before getting the
new result id), so even if you store it in two separate variables, it
will only refrence the last id (which sounds just like what happened in
your initial post). I think this is limited to a given connection, but
I'm not sure.

One of the, I guess you could say, "shortcomings" of the mysql interface
in php is that you can only execute one query at a time, and I think
this odd result id overwrighting that happens is due to that fact (I
might be wrong, but I think you can execute multiple queries at a time
with perl's DBI module). 

I hope that makes more sense :)

-- Josh

-Original Message-
From: Graeme McLaren [mailto:mickel@;ntlworld.com] 
Sent: Wednesday, November 06, 2002 12:17 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] mysql_fetch_array() question

Josh, Thank you for reply.  Thank you to everyone else who replied to my
email also.  I solved the problem shortly after posting my question,
I've
now got a massive SQL query which does the trick.

I was interested when you replied and part of it read:  "Just
remember that you can only work with one mysql result per connection at
a time".  Can you explain a little more about that please?  I don't
think I
fully understand what you mean.

Cheers,

Graeme :)

- Original Message -
From: "Josh Johnson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, November 06, 2002 12:29 PM
Subject: RE: [PHP-DB] mysql_fetch_array() question


> I concur with Jason, but if restructuring is out of the question, just
> rearrange your queries like this:
>
> $query = "SELECT Name, Address FROM users";
> $result = mysql_query($query);
> while($details = mysql_fetch_array($result)){
> echo "Name: $details[Name]";
> echo "Address: $details[Address]";
> }
> $query2 = "SELECT EmailAddress From Members";
> $result2 = mysql_query($query2);
> while($details = mysql_fetch_array($result2)){
> echo "Email: $Email[EmailAddress]";
> }
>
> The results won't come out at the same time, but you could use some
> logic to combine the results into an array by a common factor. Just
> remember that you can only work with one mysql result per connection
at
> a time. You *may* (untested!) be able to accomplish what you want to
do
> with two separate connections, but again, this is seriously overkill.
:)
>
> I'd definitely recommend restructuring your talbes as Jason suggested.
> -- Josh
>
>
> -Original Message-
> From: Jason Wong [mailto:phplist@;gremlins.com.hk]
> Sent: Wednesday, November 06, 2002 5:24 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] mysql_fetch_array() question
>
> On Tuesday 05 November 2002 05:47, Graeme McLaren wrote:
> > Hi, Anyone know how I can use two mysql_fetch_array() functions
> similar
> > to the code below?  I've tried a few different ways but I keep
getting
> > Resource ID #4.  I need to do this to retrieve an email address from
> one
> > table and retrieve details from another.
> >
> > Cheers for any tips - I'm stumped with this one,
> >
> > Graeme :)
> >
> > $query = "SELECT Name, Address FROM users";
> > $query2 = "SELECT EmailAddress From Members";
> >
> > $result = mysql_query($query);
> > $result2 = mysql_query($query2);
> >
> > while($details = mysql_fetch_array($result) and $Email =
> > mysql_fetch_array($result2))
> > {
> > echo "Name: $details[Name]";
> > echo "Address: $details[Address]";
> > echo "Email: $Email[EmailAddress]";
> > }
>
> Unless I've missed something you're going about this the wrong way.
For
> what
> you want to do, you should (in general) be able to accomplish it using
> just a
> single query.
>
> What fields do the tables 'users' and 'Members' contain? There should
be
> a
> field there (like eg. userid) which links the two together. If there
> isn't
> one then you should seriously restructure your tables so that there is
> one.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development
*
>
>
> /*
> Cats are smarter than dogs.  You can't make eight cats pull a sled
> through
> the snow.
> */
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] mysql_fetch_array() question

2002-11-06 Thread Graeme McLaren
Josh, Thank you for reply.  Thank you to everyone else who replied to my
email also.  I solved the problem shortly after posting my question, I've
now got a massive SQL query which does the trick.

I was interested when you replied and part of it read:  "Just
remember that you can only work with one mysql result per connection at
a time".  Can you explain a little more about that please?  I don't think I
fully understand what you mean.

Cheers,

Graeme :)

- Original Message -
From: "Josh Johnson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, November 06, 2002 12:29 PM
Subject: RE: [PHP-DB] mysql_fetch_array() question


> I concur with Jason, but if restructuring is out of the question, just
> rearrange your queries like this:
>
> $query = "SELECT Name, Address FROM users";
> $result = mysql_query($query);
> while($details = mysql_fetch_array($result)){
> echo "Name: $details[Name]";
> echo "Address: $details[Address]";
> }
> $query2 = "SELECT EmailAddress From Members";
> $result2 = mysql_query($query2);
> while($details = mysql_fetch_array($result2)){
> echo "Email: $Email[EmailAddress]";
> }
>
> The results won't come out at the same time, but you could use some
> logic to combine the results into an array by a common factor. Just
> remember that you can only work with one mysql result per connection at
> a time. You *may* (untested!) be able to accomplish what you want to do
> with two separate connections, but again, this is seriously overkill. :)
>
> I'd definitely recommend restructuring your talbes as Jason suggested.
> -- Josh
>
>
> -Original Message-
> From: Jason Wong [mailto:phplist@;gremlins.com.hk]
> Sent: Wednesday, November 06, 2002 5:24 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] mysql_fetch_array() question
>
> On Tuesday 05 November 2002 05:47, Graeme McLaren wrote:
> > Hi, Anyone know how I can use two mysql_fetch_array() functions
> similar
> > to the code below?  I've tried a few different ways but I keep getting
> > Resource ID #4.  I need to do this to retrieve an email address from
> one
> > table and retrieve details from another.
> >
> > Cheers for any tips - I'm stumped with this one,
> >
> > Graeme :)
> >
> > $query = "SELECT Name, Address FROM users";
> > $query2 = "SELECT EmailAddress From Members";
> >
> > $result = mysql_query($query);
> > $result2 = mysql_query($query2);
> >
> > while($details = mysql_fetch_array($result) and $Email =
> > mysql_fetch_array($result2))
> > {
> > echo "Name: $details[Name]";
> > echo "Address: $details[Address]";
> > echo "Email: $Email[EmailAddress]";
> > }
>
> Unless I've missed something you're going about this the wrong way. For
> what
> you want to do, you should (in general) be able to accomplish it using
> just a
> single query.
>
> What fields do the tables 'users' and 'Members' contain? There should be
> a
> field there (like eg. userid) which links the two together. If there
> isn't
> one then you should seriously restructure your tables so that there is
> one.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
>
> /*
> Cats are smarter than dogs.  You can't make eight cats pull a sled
> through
> the snow.
> */
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] mysql_fetch_array() question

2002-11-06 Thread Josh Johnson
I concur with Jason, but if restructuring is out of the question, just
rearrange your queries like this:

$query = "SELECT Name, Address FROM users";
$result = mysql_query($query);
while($details = mysql_fetch_array($result)){
echo "Name: $details[Name]";
echo "Address: $details[Address]";
}
$query2 = "SELECT EmailAddress From Members";
$result2 = mysql_query($query2);
while($details = mysql_fetch_array($result2)){
echo "Email: $Email[EmailAddress]";
}

The results won't come out at the same time, but you could use some
logic to combine the results into an array by a common factor. Just
remember that you can only work with one mysql result per connection at
a time. You *may* (untested!) be able to accomplish what you want to do
with two separate connections, but again, this is seriously overkill. :)

I'd definitely recommend restructuring your talbes as Jason suggested.
-- Josh


-Original Message-
From: Jason Wong [mailto:phplist@;gremlins.com.hk] 
Sent: Wednesday, November 06, 2002 5:24 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] mysql_fetch_array() question

On Tuesday 05 November 2002 05:47, Graeme McLaren wrote:
> Hi, Anyone know how I can use two mysql_fetch_array() functions
similar
> to the code below?  I've tried a few different ways but I keep getting
> Resource ID #4.  I need to do this to retrieve an email address from
one
> table and retrieve details from another.
>
> Cheers for any tips - I'm stumped with this one,
>
> Graeme :)
>
> $query = "SELECT Name, Address FROM users";
> $query2 = "SELECT EmailAddress From Members";
>
> $result = mysql_query($query);
> $result2 = mysql_query($query2);
>
> while($details = mysql_fetch_array($result) and $Email =
> mysql_fetch_array($result2))
> {
> echo "Name: $details[Name]";
> echo "Address: $details[Address]";
> echo "Email: $Email[EmailAddress]";
> }

Unless I've missed something you're going about this the wrong way. For
what 
you want to do, you should (in general) be able to accomplish it using
just a 
single query.

What fields do the tables 'users' and 'Members' contain? There should be
a 
field there (like eg. userid) which links the two together. If there
isn't 
one then you should seriously restructure your tables so that there is
one.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
Cats are smarter than dogs.  You can't make eight cats pull a sled
through
the snow.
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] mysql_fetch_array() question

2002-11-06 Thread Jason Wong
On Tuesday 05 November 2002 05:47, Graeme McLaren wrote:
> Hi, Anyone know how I can use two mysql_fetch_array() functions similar
> to the code below?  I've tried a few different ways but I keep getting
> Resource ID #4.  I need to do this to retrieve an email address from one
> table and retrieve details from another.
>
> Cheers for any tips - I'm stumped with this one,
>
> Graeme :)
>
> $query = "SELECT Name, Address FROM users";
> $query2 = "SELECT EmailAddress From Members";
>
> $result = mysql_query($query);
> $result2 = mysql_query($query2);
>
> while($details = mysql_fetch_array($result) and $Email =
> mysql_fetch_array($result2))
> {
> echo "Name: $details[Name]";
> echo "Address: $details[Address]";
> echo "Email: $Email[EmailAddress]";
> }

Unless I've missed something you're going about this the wrong way. For what 
you want to do, you should (in general) be able to accomplish it using just a 
single query.

What fields do the tables 'users' and 'Members' contain? There should be a 
field there (like eg. userid) which links the two together. If there isn't 
one then you should seriously restructure your tables so that there is one.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
Cats are smarter than dogs.  You can't make eight cats pull a sled through
the snow.
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] mysql_fetch_array() question

2002-11-04 Thread Graeme McLaren
Hi, Anyone know how I can use two mysql_fetch_array() functions similar
to the code below?  I've tried a few different ways but I keep getting
Resource ID #4.  I need to do this to retrieve an email address from one
table and retrieve details from another.

Cheers for any tips - I'm stumped with this one,

Graeme :)

$query = "SELECT Name, Address FROM users"; 
$query2 = "SELECT EmailAddress From Members";

$result = mysql_query($query);
$result2 = mysql_query($query2);

while($details = mysql_fetch_array($result) and $Email =
mysql_fetch_array($result2))
{
echo "Name: $details[Name]";
echo "Address: $details[Address]";
echo "Email: $Email[EmailAddress]";
}






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] mysql_fetch_array limit? - more details

2002-07-30 Thread Paul Worthington

Thanks for all your helpful suggestions. It turns out I was limiting the
array myself by setting a temporary table column definition to varchar(255).
I have been overlooking it all this time. I feel so stupid. Thanks again for
trying to help me.

Paul

"Paul Burney" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> on 7/30/02 10:34 AM, Paul Worthington at [EMAIL PROTECTED] appended the
> following bits to my mbox:
>
> > I'm using this PHP code, very simple and straightforward, to select two
> > columns into an array and then display the results in an HTML table:
> >

.
> > ...
> > $db = mysql_connect("localhost", "user1");
> > mysql_select_db("testdb",$db);
> > $sql = "SELECT * FROM tmp ORDER BY Name";
> > $result = mysql_query($sql,$db);
> >
> > echo "\n";
> > echo "\nPlace Name\nDescription\n\n";
> > while ($myrow = mysql_fetch_array($result)) {
> > printf("%s%s\n", $myrow[Name],
> > $myrow[txtSWDesc1]);
> > }
> > echo "\n";
> >

.
> > 
> > What happens is I'm only getting the first 256 characters of txtSWDesc1
> > displayed in my table. I am assuming the problem is in
>
> Are you sure that the printf() function can take more than 256 characters
of
> input?  Since you are only outputting strings, printf isn't really
necessary
> so you can use the echo command instead.
>
> Also, though this probably isn't the reason, you should quote your key
> names.
>
> while ($myrow = mysql_fetch_array($result)) {
> echo '',$myrow['Name'],'';
> echo '',$myrow['txtSWDesc1'],'';
> }
>
> HTH.
>
> Sincerely,
>
> Paul Burney
> 
>
>  while ($self != "asleep") {
> $sheep_count++;
> }
> ?>
>
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] mysql_fetch_array limit? - more details

2002-07-30 Thread Paul Worthington

Problem solved. I was stupidly overlooking an incorrect column definition in
a temporary table. Everything's fine now. Thank you so much for trying to
help me, and please excuse my errors.

Paul

"Richard Hutchins" <[EMAIL PROTECTED]> wrote in message
1EA7D3AE70ACD511BE6D006097A78C1E022BF618@USROCEXC">news:1EA7D3AE70ACD511BE6D006097A78C1E022BF618@USROCEXC...
> One thing I haven't seen yet is a cut-n-paste of your db tables. Could you
> post that to this list? Maybe there's something you're overlooking there?
> Maybe seomebody will find something amiss there.
>
> I know it sounds simple and you might think you have it all down right,
but
> how many times have you been nagged for something stupid like forgetting
the
> ; at the end of a query or PHP statement?
>
> Just a thought.
>
> -Original Message-
> From: Paul Worthington [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 30, 2002 10:34 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] mysql_fetch_array limit? - more details
>
>
> I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5.
>
> In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT.
> According to the manual, TEXT will give me a maximum space of 65,536
> bytes per field. I've entered text in this field in the amount of
> approximately
> 500 characters.
>
> I'm using this PHP code, very simple and straightforward, to select two
> columns into an array and then display the results in an HTML table:
>

> ..
> $db = mysql_connect("localhost", "user1");
> mysql_select_db("testdb",$db);
> $sql = "SELECT * FROM tmp ORDER BY Name";
> $result = mysql_query($sql,$db);
>
> echo "\n";
> echo "\nPlace Name\nDescription\n\n";
> while ($myrow = mysql_fetch_array($result)) {
>   printf("%s%s\n", $myrow[Name],
> $myrow[txtSWDesc1]);
> }
> echo "\n";
>

> ...
> What happens is I'm only getting the first 256 characters of txtSWDesc1
> displayed in my table. I am assuming the problem is in
> mysql_fetch_array(), that it must have some size limitation that
> truncates whatever data it has read to exactly 256 chars. Another
> possibility is that the mysql_query() could be truncing the result. I've
> checked my data directly in MySQL, and all the characters are there in
> direct SELECTs.
>
> Can someone please help? I've checked all manuals and FAQs I can, but I
> can't figure out why I'm having this problem. It should not be happening
> at all. Is there some size limitation to the array created via
> mysql_fetch_array()? Is there some other function that will accomodate
> my data? Is there any custom code to handle my data correctly?
>
> Thanks,
> Paul Worthington
> [EMAIL PROTECTED]
>
>
> --
> The views expressed here are those of the user, not necessarily those of
> Evolving Systems, Inc.
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] mysql_fetch_array limit? - more details

2002-07-30 Thread Paul Worthington

My mistake: I was setting the limit myself via an incorrect column
definition whilst creating a temporary table. I feel so stupid. Thanks for
trying to help me.

Paul


"Kodrik" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>
> I use mysql_fetch array to retrieve large text data many many times
> without a problem. I've actually written functions to retrieve the data
for me using this
> function, and I never had a single problem, truncated or speed, on Unix,
> Linux or Windows platform.
>
> Check out the code for the functions getrow(), getrows(), they use
> mysql_fetch array.
> http://zc8.com/zc8/samplecode/sqltools.phps
>
> This is the explanations of the functions:
> http://zc8.net/zc8/shownews.php?articleid=98
>
> You can use those as you please if you want
>
>
> On Tue, 30 Jul 2002, Paul Worthington wrote:
>
> > No I don't have PhpMyAdmin installed. I work directly in MySQL via a
> > terminal, so all my checking is with native calls anyway. Working
natively
> > in MySQL, all my data is there and everything works the way I expect it
to.
> > Using mysql_fetch_array() in PHP results in a truncated result set. And
I am
> > trying to figure out why, and how I can work around this problem.
> > Thanks again,
> > Paul Worthington
> > [EMAIL PROTECTED]
> >
> > "Andrey Hristov" <[EMAIL PROTECTED]> wrote in message
> > 01ed01c237ea$0d0fcf10$1601a8c0@nik">news:01ed01c237ea$0d0fcf10$1601a8c0@nik...
> > > Do you have PhpMyAdmin installed? If you have try with it to see the
> > > results. It uses native mysql functions.
> > >
> > > Andrey
> > >
> > > - Original Message -
> > > From: "Paul Worthington" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Tuesday, July 30, 2002 7:53 PM
> > > Subject: Re: [PHP-DB] mysql_fetch_array limit? - more details
> > >
> > >
> > > > Thank you for that idea. I don't think that's it, though, because
this
> > > > script is the only one I'm ever running on this site. The problem is
> > > > perfectly consistent and repeatable, which leads me to believe it's
> > > > something in the way the array is being built.
> > > >
> > > > Paul Worthington
> > > > [EMAIL PROTECTED]
> > > >
> > > > "Andrey Hristov" <[EMAIL PROTECTED]> wrote in message
> > > > 01cd01c237e8$7e1438b0$1601a8c0@nik">news:01cd01c237e8$7e1438b0$1601a8c0@nik...
> > > > > Maybe it will help you but I've read that when using persistent
> > > > connections
> > > > > PHP uses 2 on every request.
> > > > > So if in one moment you have 10 scripts,that use persistent
> > connections,
> > > > > running you will have 20 connections used to the mysql.
> > > > >
> > > > > Regards,
> > > > > Andrey
> > > > > - Original Message -
> > > > > From: "Paul Worthington" <[EMAIL PROTECTED]>
> > > > > To: <[EMAIL PROTECTED]>
> > > > > Sent: Tuesday, July 30, 2002 5:34 PM
> > > > > Subject: [PHP-DB] mysql_fetch_array limit? - more details
> > > > >
> > > > >
> > > > > > I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5.
> > > > > >
> > > > > > In my table, I've got two fields: Name VARCHAR(35) and
txtSWDesc1
> > > TEXT.
> > > > > > According to the manual, TEXT will give me a maximum space of
65,536
> > > > > > bytes per field. I've entered text in this field in the amount
of
> > > > > > approximately
> > > > > > 500 characters.
> > > > > >
> > > > > > I'm using this PHP code, very simple and straightforward, to
select
> > > two
> > > > > > columns into an array and then display the results in an HTML
table:
> > > > > >
> > > > >
> > > >
> > >
> >

> > > > > > ..
> > > > > > $db = mysql_connect("localhost", "user1");
> > > > > > mysql_select_db("testdb",$db);
> > > > > > $sql = "SELECT * FROM tmp ORDER BY Name";
> > > > > > $result = my

Re: [PHP-DB] mysql_fetch_array limit? - more details

2002-07-30 Thread Paul Worthington

I am a bonehead. In stripping down my code for posting here, the problem
suddenly went away. I was building a temporary table and all this time I've
been overlooking the fact that my txtSWDesc1 field in the tmp table was set
to 255. My apologies to everyone. And thanks for trying to help me.

Paul


"Mark A. Roedel" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> -Original Message-
> From: Paul Worthington [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 30, 2002 9:34 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] mysql_fetch_array limit? - more details
>
>
> What happens is I'm only getting the first 256 characters of
> txtSWDesc1 displayed in my table. I am assuming the problem is in
> mysql_fetch_array(), that it must have some size limitation that
> truncates whatever data it has read to exactly 256 chars.

I'm a little curious about this assumption, given that I know I've
successfully used mysql_query() and mysql_fetch_array() on pieces of
data much bigger than that.

Does
echo strlen($myrow[txtSWDesc1]);
produce the output you'd expect?


---
Mark Roedel   | "There is only one truly satisfying way
Systems Programmer|  to boot a computer."
LeTourneau University |
Longview, Texas  USA  | -- J.H.Goldfuss



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] mysql_fetch_array limit? - more details

2002-07-30 Thread Paul Burney

on 7/30/02 10:34 AM, Paul Worthington at [EMAIL PROTECTED] appended the
following bits to my mbox:

> I'm using this PHP code, very simple and straightforward, to select two
> columns into an array and then display the results in an HTML table:
> .
> ...
> $db = mysql_connect("localhost", "user1");
> mysql_select_db("testdb",$db);
> $sql = "SELECT * FROM tmp ORDER BY Name";
> $result = mysql_query($sql,$db);
> 
> echo "\n";
> echo "\nPlace Name\nDescription\n\n";
> while ($myrow = mysql_fetch_array($result)) {
> printf("%s%s\n", $myrow[Name],
> $myrow[txtSWDesc1]);
> }
> echo "\n";
> .
> 
> What happens is I'm only getting the first 256 characters of txtSWDesc1
> displayed in my table. I am assuming the problem is in

Are you sure that the printf() function can take more than 256 characters of
input?  Since you are only outputting strings, printf isn't really necessary
so you can use the echo command instead.

Also, though this probably isn't the reason, you should quote your key
names.

while ($myrow = mysql_fetch_array($result)) {
echo '',$myrow['Name'],'';
echo '',$myrow['txtSWDesc1'],'';
}

HTH.

Sincerely,

Paul Burney






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] mysql_fetch_array limit? - more details

2002-07-30 Thread Hutchins, Richard

One thing I haven't seen yet is a cut-n-paste of your db tables. Could you
post that to this list? Maybe there's something you're overlooking there?
Maybe seomebody will find something amiss there.

I know it sounds simple and you might think you have it all down right, but
how many times have you been nagged for something stupid like forgetting the
; at the end of a query or PHP statement?

Just a thought.

-Original Message-
From: Paul Worthington [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 30, 2002 10:34 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mysql_fetch_array limit? - more details


I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5.

In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT.
According to the manual, TEXT will give me a maximum space of 65,536
bytes per field. I've entered text in this field in the amount of
approximately
500 characters.

I'm using this PHP code, very simple and straightforward, to select two
columns into an array and then display the results in an HTML table:

..
$db = mysql_connect("localhost", "user1");
mysql_select_db("testdb",$db);
$sql = "SELECT * FROM tmp ORDER BY Name";
$result = mysql_query($sql,$db);

echo "\n";
echo "\nPlace Name\nDescription\n\n";
while ($myrow = mysql_fetch_array($result)) {
  printf("%s%s\n", $myrow[Name],
$myrow[txtSWDesc1]);
}
echo "\n";

...
What happens is I'm only getting the first 256 characters of txtSWDesc1
displayed in my table. I am assuming the problem is in
mysql_fetch_array(), that it must have some size limitation that
truncates whatever data it has read to exactly 256 chars. Another
possibility is that the mysql_query() could be truncing the result. I've
checked my data directly in MySQL, and all the characters are there in
direct SELECTs.

Can someone please help? I've checked all manuals and FAQs I can, but I
can't figure out why I'm having this problem. It should not be happening
at all. Is there some size limitation to the array created via
mysql_fetch_array()? Is there some other function that will accomodate
my data? Is there any custom code to handle my data correctly?

Thanks,
Paul Worthington
[EMAIL PROTECTED]


--
The views expressed here are those of the user, not necessarily those of
Evolving Systems, Inc.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] mysql_fetch_array limit? - more details

2002-07-30 Thread Kodrik



I use mysql_fetch array to retrieve large text data many many times
without a problem. I've actually written functions to retrieve the data for me using 
this
function, and I never had a single problem, truncated or speed, on Unix,
Linux or Windows platform.

Check out the code for the functions getrow(), getrows(), they use
mysql_fetch array.
http://zc8.com/zc8/samplecode/sqltools.phps

This is the explanations of the functions:
http://zc8.net/zc8/shownews.php?articleid=98

You can use those as you please if you want


On Tue, 30 Jul 2002, Paul Worthington wrote:

> No I don't have PhpMyAdmin installed. I work directly in MySQL via a
> terminal, so all my checking is with native calls anyway. Working natively
> in MySQL, all my data is there and everything works the way I expect it to.
> Using mysql_fetch_array() in PHP results in a truncated result set. And I am
> trying to figure out why, and how I can work around this problem.
> Thanks again,
> Paul Worthington
> [EMAIL PROTECTED]
>
> "Andrey Hristov" <[EMAIL PROTECTED]> wrote in message
> 01ed01c237ea$0d0fcf10$1601a8c0@nik">news:01ed01c237ea$0d0fcf10$1601a8c0@nik...
> > Do you have PhpMyAdmin installed? If you have try with it to see the
> > results. It uses native mysql functions.
> >
> > Andrey
> >
> > - Original Message -
> > From: "Paul Worthington" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, July 30, 2002 7:53 PM
> > Subject: Re: [PHP-DB] mysql_fetch_array limit? - more details
> >
> >
> > > Thank you for that idea. I don't think that's it, though, because this
> > > script is the only one I'm ever running on this site. The problem is
> > > perfectly consistent and repeatable, which leads me to believe it's
> > > something in the way the array is being built.
> > >
> > > Paul Worthington
> > > [EMAIL PROTECTED]
> > >
> > > "Andrey Hristov" <[EMAIL PROTECTED]> wrote in message
> > > 01cd01c237e8$7e1438b0$1601a8c0@nik">news:01cd01c237e8$7e1438b0$1601a8c0@nik...
> > > > Maybe it will help you but I've read that when using persistent
> > > connections
> > > > PHP uses 2 on every request.
> > > > So if in one moment you have 10 scripts,that use persistent
> connections,
> > > > running you will have 20 connections used to the mysql.
> > > >
> > > > Regards,
> > > > Andrey
> > > > - Original Message -
> > > > From: "Paul Worthington" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Tuesday, July 30, 2002 5:34 PM
> > > > Subject: [PHP-DB] mysql_fetch_array limit? - more details
> > > >
> > > >
> > > > > I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5.
> > > > >
> > > > > In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1
> > TEXT.
> > > > > According to the manual, TEXT will give me a maximum space of 65,536
> > > > > bytes per field. I've entered text in this field in the amount of
> > > > > approximately
> > > > > 500 characters.
> > > > >
> > > > > I'm using this PHP code, very simple and straightforward, to select
> > two
> > > > > columns into an array and then display the results in an HTML table:
> > > > >
> > > >
> > >
> >
> 
> > > > > ..
> > > > > $db = mysql_connect("localhost", "user1");
> > > > > mysql_select_db("testdb",$db);
> > > > > $sql = "SELECT * FROM tmp ORDER BY Name";
> > > > > $result = mysql_query($sql,$db);
> > > > >
> > > > > echo "\n";
> > > > > echo "\nPlace Name\nDescription\n\n";
> > > > > while ($myrow = mysql_fetch_array($result)) {
> > > > >   printf("%s%s\n", $myrow[Name],
> > > > > $myrow[txtSWDesc1]);
> > > > > }
> > > > > echo "\n";
> > > > >
> > > >
> > >
> >
> 
> > > > > ...
> > > > > What happens is I'm only getting the first 256 charact

RE: [PHP-DB] mysql_fetch_array limit? - more details

2002-07-30 Thread Roedel, Mark A.

> -Original Message-
> From: Paul Worthington [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, July 30, 2002 9:34 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] mysql_fetch_array limit? - more details
> 
> 
> What happens is I'm only getting the first 256 characters of 
> txtSWDesc1 displayed in my table. I am assuming the problem is in
> mysql_fetch_array(), that it must have some size limitation that
> truncates whatever data it has read to exactly 256 chars. 

I'm a little curious about this assumption, given that I know I've
successfully used mysql_query() and mysql_fetch_array() on pieces of
data much bigger than that.

Does
echo strlen($myrow[txtSWDesc1]);
produce the output you'd expect?


---
Mark Roedel   | "There is only one truly satisfying way
Systems Programmer|  to boot a computer."
LeTourneau University |
Longview, Texas  USA  | -- J.H.Goldfuss

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] mysql_fetch_array limit? - more details

2002-07-30 Thread Andrey Hristov

Yeaah!
I am a fool. My biggest excuses.
Sorry Rasmus and everyone else.

Andrey

- Original Message -
From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
To: "Andrey Hristov" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, July 30, 2002 8:11 PM
Subject: Re: [PHP-DB] mysql_fetch_array limit? - more details


> The only reason it uses two is if the code using persistent connections
> connects with different credentials.  ie. you have 2 different apps on the
> same server that connects as 2 different user ids and they are both using
> persistent connections.  Eventually every httpd will have 2 connections.
>
> -R
>
> On Tue, 30 Jul 2002, Andrey Hristov wrote:
>
> >   Hello,
> > last week I read this article :
> > http://phplens.com/lens/php-book/optimizing-debugging-php.php
> > It is long one. Extract from it (look where is it and read around it):
> > [snip]
> > Overload on 40 connections
> >
> > When we pushed the benchmark to use 40 connections, the server
overloaded
> > with 35% failed requests. On further investigation, it was because the
MySQL
> > server persistent connects were failing because of "Too Many
Connections".
> >
> > The benchmark also demonstrates the lingering behavior of Apache child
> > processes. Each PHP script uses 2 persistent connections, so at 40
> > connections, we should only be using at most 80 persistent connections,
well
> > below the default MySQL max_connections of 100. However Apache idle
child
> > processes are not assigned immediately to new requests due to latencies,
> > keep-alives and other technical reasons; these lingering child processes
> > held the remaining 20+ persistent connections that were "the straws that
> > broke the Camel's back".
> >
> > The Fix
> >
> > By switching to non-persistent database connections, we were able to fix
> > this problem and obtained a result of 5.340 seconds. An alternative
solution
> > would have been to increase the MySQL max_connections parameter from the
> > default of 100.
> >
> > [/snip]
> >
> > Andrey
> >
> > - Original Message -
> > From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
> > To: "Andrey Hristov" <[EMAIL PROTECTED]>
> > Cc: "Paul Worthington" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> > Sent: Tuesday, July 30, 2002 7:59 PM
> > Subject: Re: [PHP-DB] mysql_fetch_array limit? - more details
> >
> >
> > > What do you mean it uses 2?  It does not.
> > >
> > > On Tue, 30 Jul 2002, Andrey Hristov wrote:
> > >
> > > > Maybe it will help you but I've read that when using persistent
> > connections
> > > > PHP uses 2 on every request.
> > > > So if in one moment you have 10 scripts,that use persistent
connections,
> > > > running you will have 20 connections used to the mysql.
> > > >
> > > > Regards,
> > > > Andrey
> > > > - Original Message -
> > > > From: "Paul Worthington" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Tuesday, July 30, 2002 5:34 PM
> > > > Subject: [PHP-DB] mysql_fetch_array limit? - more details
> > > >
> > > >
> > > > > I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5.
> > > > >
> > > > > In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1
> > TEXT.
> > > > > According to the manual, TEXT will give me a maximum space of
65,536
> > > > > bytes per field. I've entered text in this field in the amount of
> > > > > approximately
> > > > > 500 characters.
> > > > >
> > > > > I'm using this PHP code, very simple and straightforward, to
select
> > two
> > > > > columns into an array and then display the results in an HTML
table:
> > > > >
> > > >
> >

> > > > > ..
> > > > > $db = mysql_connect("localhost", "user1");
> > > > > mysql_select_db("testdb",$db);
> > > > > $sql = "SELECT * FROM tmp ORDER BY Name";
> > > > > $result = mysql_query($sql,$db);
> > > > >
> > > > > echo "\n";
> > > > > echo "\nPlace Name\nDescription\n\n";
> > > > >

Re: [PHP-DB] mysql_fetch_array limit? - more details

2002-07-30 Thread Rasmus Lerdorf

The only reason it uses two is if the code using persistent connections
connects with different credentials.  ie. you have 2 different apps on the
same server that connects as 2 different user ids and they are both using
persistent connections.  Eventually every httpd will have 2 connections.

-R

On Tue, 30 Jul 2002, Andrey Hristov wrote:

>   Hello,
> last week I read this article :
> http://phplens.com/lens/php-book/optimizing-debugging-php.php
> It is long one. Extract from it (look where is it and read around it):
> [snip]
> Overload on 40 connections
>
> When we pushed the benchmark to use 40 connections, the server overloaded
> with 35% failed requests. On further investigation, it was because the MySQL
> server persistent connects were failing because of "Too Many Connections".
>
> The benchmark also demonstrates the lingering behavior of Apache child
> processes. Each PHP script uses 2 persistent connections, so at 40
> connections, we should only be using at most 80 persistent connections, well
> below the default MySQL max_connections of 100. However Apache idle child
> processes are not assigned immediately to new requests due to latencies,
> keep-alives and other technical reasons; these lingering child processes
> held the remaining 20+ persistent connections that were "the straws that
> broke the Camel's back".
>
> The Fix
>
> By switching to non-persistent database connections, we were able to fix
> this problem and obtained a result of 5.340 seconds. An alternative solution
> would have been to increase the MySQL max_connections parameter from the
> default of 100.
>
> [/snip]
>
> Andrey
>
> - Original Message -
> From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
> To: "Andrey Hristov" <[EMAIL PROTECTED]>
> Cc: "Paul Worthington" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Tuesday, July 30, 2002 7:59 PM
> Subject: Re: [PHP-DB] mysql_fetch_array limit? - more details
>
>
> > What do you mean it uses 2?  It does not.
> >
> > On Tue, 30 Jul 2002, Andrey Hristov wrote:
> >
> > > Maybe it will help you but I've read that when using persistent
> connections
> > > PHP uses 2 on every request.
> > > So if in one moment you have 10 scripts,that use persistent connections,
> > > running you will have 20 connections used to the mysql.
> > >
> > > Regards,
> > > Andrey
> > > - Original Message -
> > > From: "Paul Worthington" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Tuesday, July 30, 2002 5:34 PM
> > > Subject: [PHP-DB] mysql_fetch_array limit? - more details
> > >
> > >
> > > > I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5.
> > > >
> > > > In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1
> TEXT.
> > > > According to the manual, TEXT will give me a maximum space of 65,536
> > > > bytes per field. I've entered text in this field in the amount of
> > > > approximately
> > > > 500 characters.
> > > >
> > > > I'm using this PHP code, very simple and straightforward, to select
> two
> > > > columns into an array and then display the results in an HTML table:
> > > >
> > >
> 
> > > > ..
> > > > $db = mysql_connect("localhost", "user1");
> > > > mysql_select_db("testdb",$db);
> > > > $sql = "SELECT * FROM tmp ORDER BY Name";
> > > > $result = mysql_query($sql,$db);
> > > >
> > > > echo "\n";
> > > > echo "\nPlace Name\nDescription\n\n";
> > > > while ($myrow = mysql_fetch_array($result)) {
> > > >   printf("%s%s\n", $myrow[Name],
> > > > $myrow[txtSWDesc1]);
> > > > }
> > > > echo "\n";
> > > >
> > >
> 
> > > > ...
> > > > What happens is I'm only getting the first 256 characters of
> txtSWDesc1
> > > > displayed in my table. I am assuming the problem is in
> > > > mysql_fetch_array(), that it must have some size limitation that
> > > > truncates whatever data it has read to exactly 256 chars. Another
> > > > possibility is that the mysql_query() could be trunc

Re: [PHP-DB] mysql_fetch_array limit? - more details

2002-07-30 Thread Andrey Hristov

  Hello,
last week I read this article :
http://phplens.com/lens/php-book/optimizing-debugging-php.php
It is long one. Extract from it (look where is it and read around it):
[snip]
Overload on 40 connections

When we pushed the benchmark to use 40 connections, the server overloaded
with 35% failed requests. On further investigation, it was because the MySQL
server persistent connects were failing because of "Too Many Connections".

The benchmark also demonstrates the lingering behavior of Apache child
processes. Each PHP script uses 2 persistent connections, so at 40
connections, we should only be using at most 80 persistent connections, well
below the default MySQL max_connections of 100. However Apache idle child
processes are not assigned immediately to new requests due to latencies,
keep-alives and other technical reasons; these lingering child processes
held the remaining 20+ persistent connections that were "the straws that
broke the Camel's back".

The Fix

By switching to non-persistent database connections, we were able to fix
this problem and obtained a result of 5.340 seconds. An alternative solution
would have been to increase the MySQL max_connections parameter from the
default of 100.

[/snip]

Andrey

- Original Message -
From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
To: "Andrey Hristov" <[EMAIL PROTECTED]>
Cc: "Paul Worthington" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, July 30, 2002 7:59 PM
Subject: Re: [PHP-DB] mysql_fetch_array limit? - more details


> What do you mean it uses 2?  It does not.
>
> On Tue, 30 Jul 2002, Andrey Hristov wrote:
>
> > Maybe it will help you but I've read that when using persistent
connections
> > PHP uses 2 on every request.
> > So if in one moment you have 10 scripts,that use persistent connections,
> > running you will have 20 connections used to the mysql.
> >
> > Regards,
> > Andrey
> > - Original Message -----
> > From: "Paul Worthington" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, July 30, 2002 5:34 PM
> > Subject: [PHP-DB] mysql_fetch_array limit? - more details
> >
> >
> > > I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5.
> > >
> > > In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1
TEXT.
> > > According to the manual, TEXT will give me a maximum space of 65,536
> > > bytes per field. I've entered text in this field in the amount of
> > > approximately
> > > 500 characters.
> > >
> > > I'm using this PHP code, very simple and straightforward, to select
two
> > > columns into an array and then display the results in an HTML table:
> > >
> >

> > > ..
> > > $db = mysql_connect("localhost", "user1");
> > > mysql_select_db("testdb",$db);
> > > $sql = "SELECT * FROM tmp ORDER BY Name";
> > > $result = mysql_query($sql,$db);
> > >
> > > echo "\n";
> > > echo "\nPlace Name\nDescription\n\n";
> > > while ($myrow = mysql_fetch_array($result)) {
> > >   printf("%s%s\n", $myrow[Name],
> > > $myrow[txtSWDesc1]);
> > > }
> > > echo "\n";
> > >
> >

> > > ...
> > > What happens is I'm only getting the first 256 characters of
txtSWDesc1
> > > displayed in my table. I am assuming the problem is in
> > > mysql_fetch_array(), that it must have some size limitation that
> > > truncates whatever data it has read to exactly 256 chars. Another
> > > possibility is that the mysql_query() could be truncing the result.
I've
> > > checked my data directly in MySQL, and all the characters are there in
> > > direct SELECTs.
> > >
> > > Can someone please help? I've checked all manuals and FAQs I can, but
I
> > > can't figure out why I'm having this problem. It should not be
happening
> > > at all. Is there some size limitation to the array created via
> > > mysql_fetch_array()? Is there some other function that will accomodate
> > > my data? Is there any custom code to handle my data correctly?
> > >
> > > Thanks,
> > > Paul Worthington
> > > [EMAIL PROTECTED]
> > >
> > >
> > > --
> > > The views expressed here are those of the user, not necessarily those
of
> > > Evolving Systems, Inc.
> > >
> > >
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] mysql_fetch_array limit? - more details

2002-07-30 Thread Rasmus Lerdorf

What do you mean it uses 2?  It does not.

On Tue, 30 Jul 2002, Andrey Hristov wrote:

> Maybe it will help you but I've read that when using persistent connections
> PHP uses 2 on every request.
> So if in one moment you have 10 scripts,that use persistent connections,
> running you will have 20 connections used to the mysql.
>
> Regards,
> Andrey
> - Original Message -
> From: "Paul Worthington" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, July 30, 2002 5:34 PM
> Subject: [PHP-DB] mysql_fetch_array limit? - more details
>
>
> > I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5.
> >
> > In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT.
> > According to the manual, TEXT will give me a maximum space of 65,536
> > bytes per field. I've entered text in this field in the amount of
> > approximately
> > 500 characters.
> >
> > I'm using this PHP code, very simple and straightforward, to select two
> > columns into an array and then display the results in an HTML table:
> >
> 
> > ..
> > $db = mysql_connect("localhost", "user1");
> > mysql_select_db("testdb",$db);
> > $sql = "SELECT * FROM tmp ORDER BY Name";
> > $result = mysql_query($sql,$db);
> >
> > echo "\n";
> > echo "\nPlace Name\nDescription\n\n";
> > while ($myrow = mysql_fetch_array($result)) {
> >   printf("%s%s\n", $myrow[Name],
> > $myrow[txtSWDesc1]);
> > }
> > echo "\n";
> >
> 
> > ...
> > What happens is I'm only getting the first 256 characters of txtSWDesc1
> > displayed in my table. I am assuming the problem is in
> > mysql_fetch_array(), that it must have some size limitation that
> > truncates whatever data it has read to exactly 256 chars. Another
> > possibility is that the mysql_query() could be truncing the result. I've
> > checked my data directly in MySQL, and all the characters are there in
> > direct SELECTs.
> >
> > Can someone please help? I've checked all manuals and FAQs I can, but I
> > can't figure out why I'm having this problem. It should not be happening
> > at all. Is there some size limitation to the array created via
> > mysql_fetch_array()? Is there some other function that will accomodate
> > my data? Is there any custom code to handle my data correctly?
> >
> > Thanks,
> > Paul Worthington
> > [EMAIL PROTECTED]
> >
> >
> > --
> > The views expressed here are those of the user, not necessarily those of
> > Evolving Systems, Inc.
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] mysql_fetch_array limit? - more details

2002-07-30 Thread Paul Worthington

No I don't have PhpMyAdmin installed. I work directly in MySQL via a
terminal, so all my checking is with native calls anyway. Working natively
in MySQL, all my data is there and everything works the way I expect it to.
Using mysql_fetch_array() in PHP results in a truncated result set. And I am
trying to figure out why, and how I can work around this problem.
Thanks again,
Paul Worthington
[EMAIL PROTECTED]

"Andrey Hristov" <[EMAIL PROTECTED]> wrote in message
01ed01c237ea$0d0fcf10$1601a8c0@nik">news:01ed01c237ea$0d0fcf10$1601a8c0@nik...
> Do you have PhpMyAdmin installed? If you have try with it to see the
> results. It uses native mysql functions.
>
> Andrey
>
> - Original Message -
> From: "Paul Worthington" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, July 30, 2002 7:53 PM
> Subject: Re: [PHP-DB] mysql_fetch_array limit? - more details
>
>
> > Thank you for that idea. I don't think that's it, though, because this
> > script is the only one I'm ever running on this site. The problem is
> > perfectly consistent and repeatable, which leads me to believe it's
> > something in the way the array is being built.
> >
> > Paul Worthington
> > [EMAIL PROTECTED]
> >
> > "Andrey Hristov" <[EMAIL PROTECTED]> wrote in message
> > 01cd01c237e8$7e1438b0$1601a8c0@nik">news:01cd01c237e8$7e1438b0$1601a8c0@nik...
> > > Maybe it will help you but I've read that when using persistent
> > connections
> > > PHP uses 2 on every request.
> > > So if in one moment you have 10 scripts,that use persistent
connections,
> > > running you will have 20 connections used to the mysql.
> > >
> > > Regards,
> > > Andrey
> > > - Original Message -
> > > From: "Paul Worthington" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Tuesday, July 30, 2002 5:34 PM
> > > Subject: [PHP-DB] mysql_fetch_array limit? - more details
> > >
> > >
> > > > I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5.
> > > >
> > > > In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1
> TEXT.
> > > > According to the manual, TEXT will give me a maximum space of 65,536
> > > > bytes per field. I've entered text in this field in the amount of
> > > > approximately
> > > > 500 characters.
> > > >
> > > > I'm using this PHP code, very simple and straightforward, to select
> two
> > > > columns into an array and then display the results in an HTML table:
> > > >
> > >
> >
>

> > > > ..
> > > > $db = mysql_connect("localhost", "user1");
> > > > mysql_select_db("testdb",$db);
> > > > $sql = "SELECT * FROM tmp ORDER BY Name";
> > > > $result = mysql_query($sql,$db);
> > > >
> > > > echo "\n";
> > > > echo "\nPlace Name\nDescription\n\n";
> > > > while ($myrow = mysql_fetch_array($result)) {
> > > >   printf("%s%s\n", $myrow[Name],
> > > > $myrow[txtSWDesc1]);
> > > > }
> > > > echo "\n";
> > > >
> > >
> >
>

> > > > ...
> > > > What happens is I'm only getting the first 256 characters of
> txtSWDesc1
> > > > displayed in my table. I am assuming the problem is in
> > > > mysql_fetch_array(), that it must have some size limitation that
> > > > truncates whatever data it has read to exactly 256 chars. Another
> > > > possibility is that the mysql_query() could be truncing the result.
> I've
> > > > checked my data directly in MySQL, and all the characters are there
in
> > > > direct SELECTs.
> > > >
> > > > Can someone please help? I've checked all manuals and FAQs I can,
but
> I
> > > > can't figure out why I'm having this problem. It should not be
> happening
> > > > at all. Is there some size limitation to the array created via
> > > > mysql_fetch_array()? Is there some other function that will
accomodate
> > > > my data? Is there any custom code to handle my data correctly?
> > > >
> > > > Thanks,
> > > > Paul Worthington
> > > > [EMAIL PROTECTED]
> > > >
> > > >
> > > > --
> > > > The views expressed here are those of the user, not necessarily
those
> of
> > > > Evolving Systems, Inc.
> > > >
> > > >
> > > >
> > > > --
> > > > PHP Database Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > > >
> > >
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] mysql_fetch_array limit? - more details

2002-07-30 Thread Andrey Hristov

Do you have PhpMyAdmin installed? If you have try with it to see the
results. It uses native mysql functions.

Andrey

- Original Message -
From: "Paul Worthington" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 30, 2002 7:53 PM
Subject: Re: [PHP-DB] mysql_fetch_array limit? - more details


> Thank you for that idea. I don't think that's it, though, because this
> script is the only one I'm ever running on this site. The problem is
> perfectly consistent and repeatable, which leads me to believe it's
> something in the way the array is being built.
>
> Paul Worthington
> [EMAIL PROTECTED]
>
> "Andrey Hristov" <[EMAIL PROTECTED]> wrote in message
> 01cd01c237e8$7e1438b0$1601a8c0@nik">news:01cd01c237e8$7e1438b0$1601a8c0@nik...
> > Maybe it will help you but I've read that when using persistent
> connections
> > PHP uses 2 on every request.
> > So if in one moment you have 10 scripts,that use persistent connections,
> > running you will have 20 connections used to the mysql.
> >
> > Regards,
> > Andrey
> > - Original Message -
> > From: "Paul Worthington" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, July 30, 2002 5:34 PM
> > Subject: [PHP-DB] mysql_fetch_array limit? - more details
> >
> >
> > > I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5.
> > >
> > > In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1
TEXT.
> > > According to the manual, TEXT will give me a maximum space of 65,536
> > > bytes per field. I've entered text in this field in the amount of
> > > approximately
> > > 500 characters.
> > >
> > > I'm using this PHP code, very simple and straightforward, to select
two
> > > columns into an array and then display the results in an HTML table:
> > >
> >
>

> > > ..
> > > $db = mysql_connect("localhost", "user1");
> > > mysql_select_db("testdb",$db);
> > > $sql = "SELECT * FROM tmp ORDER BY Name";
> > > $result = mysql_query($sql,$db);
> > >
> > > echo "\n";
> > > echo "\nPlace Name\nDescription\n\n";
> > > while ($myrow = mysql_fetch_array($result)) {
> > >   printf("%s%s\n", $myrow[Name],
> > > $myrow[txtSWDesc1]);
> > > }
> > > echo "\n";
> > >
> >
>

> > > ...
> > > What happens is I'm only getting the first 256 characters of
txtSWDesc1
> > > displayed in my table. I am assuming the problem is in
> > > mysql_fetch_array(), that it must have some size limitation that
> > > truncates whatever data it has read to exactly 256 chars. Another
> > > possibility is that the mysql_query() could be truncing the result.
I've
> > > checked my data directly in MySQL, and all the characters are there in
> > > direct SELECTs.
> > >
> > > Can someone please help? I've checked all manuals and FAQs I can, but
I
> > > can't figure out why I'm having this problem. It should not be
happening
> > > at all. Is there some size limitation to the array created via
> > > mysql_fetch_array()? Is there some other function that will accomodate
> > > my data? Is there any custom code to handle my data correctly?
> > >
> > > Thanks,
> > > Paul Worthington
> > > [EMAIL PROTECTED]
> > >
> > >
> > > --
> > > The views expressed here are those of the user, not necessarily those
of
> > > Evolving Systems, Inc.
> > >
> > >
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] mysql_fetch_array limit? - more details

2002-07-30 Thread Paul Worthington

Thank you for that idea. I don't think that's it, though, because this
script is the only one I'm ever running on this site. The problem is
perfectly consistent and repeatable, which leads me to believe it's
something in the way the array is being built.

Paul Worthington
[EMAIL PROTECTED]

"Andrey Hristov" <[EMAIL PROTECTED]> wrote in message
01cd01c237e8$7e1438b0$1601a8c0@nik">news:01cd01c237e8$7e1438b0$1601a8c0@nik...
> Maybe it will help you but I've read that when using persistent
connections
> PHP uses 2 on every request.
> So if in one moment you have 10 scripts,that use persistent connections,
> running you will have 20 connections used to the mysql.
>
> Regards,
> Andrey
> - Original Message -
> From: "Paul Worthington" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, July 30, 2002 5:34 PM
> Subject: [PHP-DB] mysql_fetch_array limit? - more details
>
>
> > I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5.
> >
> > In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT.
> > According to the manual, TEXT will give me a maximum space of 65,536
> > bytes per field. I've entered text in this field in the amount of
> > approximately
> > 500 characters.
> >
> > I'm using this PHP code, very simple and straightforward, to select two
> > columns into an array and then display the results in an HTML table:
> >
>

> > ..
> > $db = mysql_connect("localhost", "user1");
> > mysql_select_db("testdb",$db);
> > $sql = "SELECT * FROM tmp ORDER BY Name";
> > $result = mysql_query($sql,$db);
> >
> > echo "\n";
> > echo "\nPlace Name\nDescription\n\n";
> > while ($myrow = mysql_fetch_array($result)) {
> >   printf("%s%s\n", $myrow[Name],
> > $myrow[txtSWDesc1]);
> > }
> > echo "\n";
> >
>

> > ...
> > What happens is I'm only getting the first 256 characters of txtSWDesc1
> > displayed in my table. I am assuming the problem is in
> > mysql_fetch_array(), that it must have some size limitation that
> > truncates whatever data it has read to exactly 256 chars. Another
> > possibility is that the mysql_query() could be truncing the result. I've
> > checked my data directly in MySQL, and all the characters are there in
> > direct SELECTs.
> >
> > Can someone please help? I've checked all manuals and FAQs I can, but I
> > can't figure out why I'm having this problem. It should not be happening
> > at all. Is there some size limitation to the array created via
> > mysql_fetch_array()? Is there some other function that will accomodate
> > my data? Is there any custom code to handle my data correctly?
> >
> > Thanks,
> > Paul Worthington
> > [EMAIL PROTECTED]
> >
> >
> > --
> > The views expressed here are those of the user, not necessarily those of
> > Evolving Systems, Inc.
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] mysql_fetch_array limit? - more details

2002-07-30 Thread Andrey Hristov

Maybe it will help you but I've read that when using persistent connections
PHP uses 2 on every request.
So if in one moment you have 10 scripts,that use persistent connections,
running you will have 20 connections used to the mysql.

Regards,
Andrey
- Original Message -
From: "Paul Worthington" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 30, 2002 5:34 PM
Subject: [PHP-DB] mysql_fetch_array limit? - more details


> I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5.
>
> In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT.
> According to the manual, TEXT will give me a maximum space of 65,536
> bytes per field. I've entered text in this field in the amount of
> approximately
> 500 characters.
>
> I'm using this PHP code, very simple and straightforward, to select two
> columns into an array and then display the results in an HTML table:
>

> ..
> $db = mysql_connect("localhost", "user1");
> mysql_select_db("testdb",$db);
> $sql = "SELECT * FROM tmp ORDER BY Name";
> $result = mysql_query($sql,$db);
>
> echo "\n";
> echo "\nPlace Name\nDescription\n\n";
> while ($myrow = mysql_fetch_array($result)) {
>   printf("%s%s\n", $myrow[Name],
> $myrow[txtSWDesc1]);
> }
> echo "\n";
>

> ...
> What happens is I'm only getting the first 256 characters of txtSWDesc1
> displayed in my table. I am assuming the problem is in
> mysql_fetch_array(), that it must have some size limitation that
> truncates whatever data it has read to exactly 256 chars. Another
> possibility is that the mysql_query() could be truncing the result. I've
> checked my data directly in MySQL, and all the characters are there in
> direct SELECTs.
>
> Can someone please help? I've checked all manuals and FAQs I can, but I
> can't figure out why I'm having this problem. It should not be happening
> at all. Is there some size limitation to the array created via
> mysql_fetch_array()? Is there some other function that will accomodate
> my data? Is there any custom code to handle my data correctly?
>
> Thanks,
> Paul Worthington
> [EMAIL PROTECTED]
>
>
> --
> The views expressed here are those of the user, not necessarily those of
> Evolving Systems, Inc.
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] mysql_fetch_array limit? - more details

2002-07-30 Thread Paul Worthington

I'm running MySQL 3.23.47 and PHP 4.1.2 on Mac OS X 10.1.5.

In my table, I've got two fields: Name VARCHAR(35) and txtSWDesc1 TEXT.
According to the manual, TEXT will give me a maximum space of 65,536
bytes per field. I've entered text in this field in the amount of
approximately
500 characters.

I'm using this PHP code, very simple and straightforward, to select two
columns into an array and then display the results in an HTML table:

..
$db = mysql_connect("localhost", "user1");
mysql_select_db("testdb",$db);
$sql = "SELECT * FROM tmp ORDER BY Name";
$result = mysql_query($sql,$db);

echo "\n";
echo "\nPlace Name\nDescription\n\n";
while ($myrow = mysql_fetch_array($result)) {
  printf("%s%s\n", $myrow[Name],
$myrow[txtSWDesc1]);
}
echo "\n";

...
What happens is I'm only getting the first 256 characters of txtSWDesc1
displayed in my table. I am assuming the problem is in
mysql_fetch_array(), that it must have some size limitation that
truncates whatever data it has read to exactly 256 chars. Another
possibility is that the mysql_query() could be truncing the result. I've
checked my data directly in MySQL, and all the characters are there in
direct SELECTs.

Can someone please help? I've checked all manuals and FAQs I can, but I
can't figure out why I'm having this problem. It should not be happening
at all. Is there some size limitation to the array created via
mysql_fetch_array()? Is there some other function that will accomodate
my data? Is there any custom code to handle my data correctly?

Thanks,
Paul Worthington
[EMAIL PROTECTED]


--
The views expressed here are those of the user, not necessarily those of
Evolving Systems, Inc.



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] mysql_fetch_array() doesn't work

2001-09-27 Thread Rick Emery

change coding to (note, each line is enclosed in quotes and ends withn "."):

$query="select user_id, user_name, time, status, comment from users".
"where sign=1".
"order by user_name".
"limit $offset, $step";
print $query;  //sanity check...contents of $query
$res=mysql_query($query) or die(mysql_error());   //note the die() clause

-Original Message-
From: Web user [mailto:[EMAIL PROTECTED]]
Sent: 27 September 2001 05:48
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mysql_fetch_array() doesn't work


System: PHP4.06 + Mysql3.23.41 Win32 + Apache 1.3.20 Win32 + Win98

When PHP is running at the line: $arr=mysql_fetch_array($res);
The IE always show info as below:
"Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in c:\program files\apache
group\apache\htdocs\web\site1\list.php on line --[the number of line]"

What's the problem wiht mysql_fetch_array() or other?
What does the T_STRING' or `T_VARIABLE' or `T_NUM_STRING' mean?

THANKS
Mike


The full code below:


-

User
Added timeStatus";
$num=mysql_num_rows($res);
for($i=0; $i<$num; $i++) {
$arr=mysql_fetch_array($res);   /* HERE is line where the error
occurs!!!
*/
echo "
$arr['user_name']>";
echo "$arr['time']";
echo "$arr['status']";
echo "$arr['comment']";
}

echo "";

echo "";  /* show others in multi-pages */
for($i=0; $i<$pages; $i++){
echo "
echo ($i+1)."";
echo "  ";
}
echo "";

?>



-
create table users (
user_id int not null auto_increment primary key,
user_name varchar(30),
time datetime,
status tinyint(1),
comment text,
sign tinyint(1) default '1'
);






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] 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:


It makes it MUCH easier to read and maintain, and seperates the PHP code 
from the HTML content as much as possible.

Any questions, please ask me.

-Jason Garber
Lead Programmer - www.pulseaday.com
[EMAIL PROTECTED]

At 12:48 PM 9/27/2001 +0800, you wrote:
System: PHP4.06 + Mysql3.23.41 Win32 + Apache 1.3.20 Win32 + Win98

When PHP is running at the line: $arr=mysql_fetch_array($res);
The IE always show info as below:
"Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in c:\program files\apache
group\apache\htdocs\web\site1\list.php on line --[the number of line]"

What's the problem wiht mysql_fetch_array() or other?
What does the T_STRING' or `T_VARIABLE' or `T_NUM_STRING' mean?

THANKS
Mike


The full code below:


User
Added timeStatus";
$num=mysql_num_rows($res);
for($i=0; $i<$num; $i++) {
$arr=mysql_fetch_array($res);   /* HERE is line where the error occurs!!!
*/
echo "
$arr['user_name']>";
echo "$arr['time']";
echo "$arr['status']";
echo "$arr['comment']";
}

echo "";

echo "";  /* show others in multi-pages */
for($i=0; $i<$pages; $i++){
echo "
echo ($i+1)."";
echo "  ";
}
echo "";

?>


-
create table users (
user_id int not null auto_increment primary key,
user_name varchar(30),
time datetime,
status tinyint(1),
comment text,
sign tinyint(1) default '1'
);







-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



RE: [PHP-DB] mysql_fetch_array() doesn't work

2001-09-26 Thread Dave Watkinson

that's not a mysql_fetch_array() error it's a coding error

-Original Message-
From: Web user [mailto:[EMAIL PROTECTED]]
Sent: 27 September 2001 05:48
To: [EMAIL PROTECTED]
Subject: [PHP-DB] mysql_fetch_array() doesn't work


System: PHP4.06 + Mysql3.23.41 Win32 + Apache 1.3.20 Win32 + Win98

When PHP is running at the line: $arr=mysql_fetch_array($res);
The IE always show info as below:
"Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in c:\program files\apache
group\apache\htdocs\web\site1\list.php on line --[the number of line]"

What's the problem wiht mysql_fetch_array() or other?
What does the T_STRING' or `T_VARIABLE' or `T_NUM_STRING' mean?

THANKS
Mike


The full code below:


-

User
Added timeStatus";
$num=mysql_num_rows($res);
for($i=0; $i<$num; $i++) {
$arr=mysql_fetch_array($res);   /* HERE is line where the error
occurs!!!
*/
echo "
$arr['user_name']>";
echo "$arr['time']";
echo "$arr['status']";
echo "$arr['comment']";
}

echo "";

echo "";  /* show others in multi-pages */
for($i=0; $i<$pages; $i++){
echo "
echo ($i+1)."";
echo "  ";
}
echo "";

?>



-
create table users (
user_id int not null auto_increment primary key,
user_name varchar(30),
time datetime,
status tinyint(1),
comment text,
sign tinyint(1) default '1'
);






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] mysql_fetch_array() doesn't work

2001-09-26 Thread Web user

System: PHP4.06 + Mysql3.23.41 Win32 + Apache 1.3.20 Win32 + Win98

When PHP is running at the line: $arr=mysql_fetch_array($res);
The IE always show info as below:
"Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in c:\program files\apache
group\apache\htdocs\web\site1\list.php on line --[the number of line]"

What's the problem wiht mysql_fetch_array() or other?
What does the T_STRING' or `T_VARIABLE' or `T_NUM_STRING' mean?

THANKS
Mike


The full code below:

-

User
Added timeStatus";
$num=mysql_num_rows($res);
for($i=0; $i<$num; $i++) {
$arr=mysql_fetch_array($res);   /* HERE is line where the error occurs!!!
*/
echo "
$arr['user_name']>";
echo "$arr['time']";
echo "$arr['status']";
echo "$arr['comment']";
}

echo "";

echo "";  /* show others in multi-pages */
for($i=0; $i<$pages; $i++){
echo "
echo ($i+1)."";
echo "  ";
}
echo "";

?>


-
create table users (
user_id int not null auto_increment primary key,
user_name varchar(30),
time datetime,
status tinyint(1),
comment text,
sign tinyint(1) default '1'
);






-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] mysql_fetch_array() doesn't work

2001-09-25 Thread Web user

System: PHP4.06 + Mysql3.23.41 Win32 + Apache 1.3.20 Win32 + Win98

http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] mysql_fetch_array missing first record

2001-08-07 Thread Jamie Saunders

This was indeed the problem, I was calling the mysql_fetch_array earlier in
the code.
Once removed it worked fine.

Thanks.

Jamie

"Paul Burney" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> on 8/7/01 1:41 PM, Jamie ([EMAIL PROTECTED]) wrote:
>
> > while ($previews = mysql_fetch_array($result) {
> >   code to display record here...
> > }
> >
> > For some reason it refuses to display the very first record in the
table.
> > Why is this and how can I get round it?
>
> Are you calling mysql_fetch_array before this in your code, perhaps to see
> if there is a result?  If so, that's the problem.  Each call to
> mysql_fetch_array (mysql_fetch_row) increments the array pointer.
>
> If that isn't your problem, please post more of the code so that we can
make
> a better diagnosis.
>
> Sincerely,
>
> Paul Burney
>
> +-+-+
> | Paul Burney | P: 310.825.8365 |
> | Webmaster && Programmer | E: <[EMAIL PROTECTED]>   |
> | UCLA -> GSE&IS -> ETU   | W:  |
> +-+-+
>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] mysql_fetch_array missing first record

2001-08-07 Thread Paul DuBois

At 9:41 PM +0100 8/7/01, Jamie wrote:
>Hi,
>
>I have this code to display records from a table by reading them into an
>array:
>
>while ($previews = mysql_fetch_array($result) {
> code to display record here...
>}
>
>For some reason it refuses to display the very first record in the table.

The first record in the table, or the first record in the result set?


>Why is this and how can I get round it?

Hard to say without seeing the surrounding context.


>
>Thanks.
>
>Jamie Saunders


-- 
Paul DuBois, [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] mysql_fetch_array missing first record

2001-08-07 Thread Paul Burney

on 8/7/01 1:41 PM, Jamie ([EMAIL PROTECTED]) wrote:

> while ($previews = mysql_fetch_array($result) {
>   code to display record here...
> }
> 
> For some reason it refuses to display the very first record in the table.
> Why is this and how can I get round it?

Are you calling mysql_fetch_array before this in your code, perhaps to see
if there is a result?  If so, that's the problem.  Each call to
mysql_fetch_array (mysql_fetch_row) increments the array pointer.

If that isn't your problem, please post more of the code so that we can make
a better diagnosis.

Sincerely,

Paul Burney

+-+-+
| Paul Burney | P: 310.825.8365 |
| Webmaster && Programmer | E: <[EMAIL PROTECTED]>   |
| UCLA -> GSE&IS -> ETU   | W:  |
+-+-+


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] mysql_fetch_array missing first record

2001-08-07 Thread Jamie

Hi,

I have this code to display records from a table by reading them into an
array:

while ($previews = mysql_fetch_array($result) {
code to display record here...
}

For some reason it refuses to display the very first record in the table.
Why is this and how can I get round it?

Thanks.

Jamie Saunders



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] mysql_fetch_array

2001-07-30 Thread bryan

mysql_fetch_array places 2 records for each one returned (example)
 
Array
(
[0] => 56
[location_id] => 56
)
 
Is there any way to delimate that and have the key present only once?
here is my code :
 
/*
 *
 *
 *  Start code 
 *
 *
 */
 
while ($aRow = mysql_fetch_array($sResult) ) {
print_r($aRow);
 

foreach ($aRow as $key => $sValue) {

$sData[$key] = "SELECT * FROM location WHERE region='$sValue' AND region
!='yes'";
$sDataResult[$key] = mysql_query($sData[$key], $sDbcnx) or
die(mysql_error());
 
/* print Main heading linking to no where */
 
print "".$sValue."";

 
while($aData[$key] = mysql_fetch_array($sDataResult[$key]) ) { 
 
/* grab the data from the main heading and print all the info for that
record */
 
print
"   ".trim($aData[$key]['location'])."\
n";

} /* end while */
 

} /* end foreach */
 
} /* end main while */
 
/*
 *
 *
 * End Code
 *
 *
 */



Re: [PHP-DB] mysql_fetch_array problem

2001-07-09 Thread bleythbe

I was having the same problem for a while... although, I
was using this:

for($i=0;$i

Good luck,
Ben

Quoting BrianSander <[EMAIL PROTECTED]>:

> Greetings,
> 
> I'm experiencing the strangest problem and I was
> wondering if anyone
> else has had the same problem.
> 
> I have a fairly simple script setup that queries
> a mySQL database and
> displays the records in a HTML table. Everything
> works fine except it
> keeps omitting the first record. Running the
> query directly on the
> database returns 3 records but only 2 are
> displayed in the table.
> 
> I just upgraded to PHP 4.0.6 and I'm still
> having the problem. I've also
> tried using mysql_fetch_array and
> mysql_fetch_object, both produce the
> same results. The first record is left out every
> time.
> 
> Any idea as to what the problem might be?
> 
> 
> Thanks. 
> 
> -- 
> PHP Database Mailing List
> (http://www.php.net/)
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] mysql_fetch_array problem

2001-07-09 Thread BrianSander

Greetings,

I'm experiencing the strangest problem and I was wondering if anyone
else has had the same problem.

I have a fairly simple script setup that queries a mySQL database and
displays the records in a HTML table. Everything works fine except it
keeps omitting the first record. Running the query directly on the
database returns 3 records but only 2 are displayed in the table.

I just upgraded to PHP 4.0.6 and I'm still having the problem. I've also
tried using mysql_fetch_array and mysql_fetch_object, both produce the
same results. The first record is left out every time.

Any idea as to what the problem might be?


Thanks. 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] mysql_fetch_array problem...!

2001-03-05 Thread JJeffman

You must use a loop to show each row of your query.
"mysql_fetch_array($result)" only get the current row.

while($row = mysql_fetch_array($result) ){

// do something

}

The "mysql_fetch_array" function returns an associative array where you can
use the field names  to have access to its value :

$row = mysql_fetch_array($result) ;
$v1 = $row["fieldname1"] ;
$v2 = $row["fieldname2"] ;
$v3 = $row["fieldname3"] ;

You're going to  use the alias names you are creating on the query.

See more details on php manual at mysql functions.

HTH.

Jayme.

-Mensagem Original-
De: Trond Erling Hundal <[EMAIL PROTECTED]>
Para: PHP-DB-LIST <[EMAIL PROTECTED]>
Enviada em: segunda-feira, 5 de março de 2001 09:56
Assunto: [PHP-DB] mysql_fetch_array problem...!


> I want to run a query to my db, fetching different fields from three
> different tables.
> In order to recognise the individual fields I give them names:
>
> select portal.portal as portal, portal.portalid as id... etc etc
>
>
> How can I refer to one specific row in this query..?
> What I mean is, how can i refer to result row number 4...?
>
> If I only selected rows from one table I could do something like this:
>
> $i = mysql_fetch_array($sql) ;
>
> echo "$i[4]" ;
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] mysql_fetch_array problem...!

2001-03-05 Thread Darryl Friesen

> How can I refer to one specific row in this query..?
> What I mean is, how can i refer to result row number 4...?
>
> If I only selected rows from one table I could do something like this:
>
> $i = mysql_fetch_array($sql) ;
> echo "$i[4]" ;

Actually, no.  mysql_fetch_array return the _current row_ from the query
(use this function in a loop to process each row of the resulting data).
$i[4] in your case is the fourth field in the current row.

If you really don't want to process the rows in order, look at the
documentation for mysql_data_seek; it can be used to jump around the result
set.


- Darryl

 --
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education & Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] mysql_fetch_array problem...!

2001-03-05 Thread Andrew Hill

Trond,

What is your table structure?
I'm guessing you need a different query.

Also, be aware that mysql_fetch_array returns an array with the field name
as value, so:

$sql="select fields from table where id = $id";

$connection_handle=(mysql_connect($user, $pass, $host);
mysql_select_db($database, $connection_handle);
$result=(mysql_query($sql, $connection_handle);
$i = mysql_fetch_array($result);
echo $i[fieldname];

will produce a single result item.


Best regards,
Andrew
--
Andrew Hill - OpenLink Software
Director Technology Evangelism
eBusiness Infrastructure Technology
http://www.openlinksw.com


> -Original Message-
> From: Trond Erling Hundal [mailto:[EMAIL PROTECTED]]
> Sent: Monday, March 05, 2001 7:56 AM
> To: PHP-DB-LIST
> Subject: [PHP-DB] mysql_fetch_array problem...!
>
>
> I want to run a query to my db, fetching different fields from three
> different tables.
> In order to recognise the individual fields I give them names:
>
> select portal.portal as portal, portal.portalid as id... etc etc
>
>
> How can I refer to one specific row in this query..?
> What I mean is, how can i refer to result row number 4...?
>
> If I only selected rows from one table I could do something like this:
>
> $i = mysql_fetch_array($sql) ;
>
> echo "$i[4]" ;
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] mysql_fetch_array problem...!

2001-03-05 Thread Trond Erling Hundal

I want to run a query to my db, fetching different fields from three
different tables.
In order to recognise the individual fields I give them names:

select portal.portal as portal, portal.portalid as id... etc etc


How can I refer to one specific row in this query..?
What I mean is, how can i refer to result row number 4...?

If I only selected rows from one table I could do something like this:

$i = mysql_fetch_array($sql) ;

echo "$i[4]" ;




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]