[PHP-DB] Re: Table results returning 2 sets of the same row

2001-08-18 Thread Hugh Bothwell


Ron Gallant [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 And my table results are shown 2 times per row.
 http://www.chizeledlight.com/test.php

... at a guess, you requested the same field twice
in your SELECT statement.

I don't like the sample code given because it just
iterates through the rows rather than using their
names - if you alter your SQL, it could change the
column order, which is kinda non-intuitive.

 I also don't know how to specify the column I want the result from.  Like
 $columnName.

Try this instead:

$query =
 SELECT field1,field2,field3 
.FROM tablename ;
$result = mysql_query($query);

while ($row = mysql_fetch_array($result)) {
explode($row);
echo \ntrtd$field1/tdtd$field2/tdtd$field3/td/tr;
}



-- 
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] Re: Table results returning 2 sets of the same row

2001-08-18 Thread Ron Gallant

I get
Warning: Wrong parameter count for explode() in
/www/chizeledlight/test.php on line 39
when I use this code.

The line in error is
explode($row);


Hugh Bothwell [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 Ron Gallant [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  And my table results are shown 2 times per row.
  http://www.chizeledlight.com/test.php

 .. at a guess, you requested the same field twice
 in your SELECT statement.

 I don't like the sample code given because it just
 iterates through the rows rather than using their
 names - if you alter your SQL, it could change the
 column order, which is kinda non-intuitive.

  I also don't know how to specify the column I want the result from.
Like
  $columnName.

 Try this instead:

 $query =
  SELECT field1,field2,field3 
 .FROM tablename ;
 $result = mysql_query($query);

 while ($row = mysql_fetch_array($result)) {
 explode($row);
 echo \ntrtd$field1/tdtd$field2/tdtd$field3/td/tr;
 }





-- 
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] Re: Table results returning 2 sets of the same row

2001-08-18 Thread Ron Gallant

OK, I got it...

I used
$date = $row[date];
 $news = $row[news];
to define the rows.  Thats great.  I am a Cold Fusion user by trade and am
diving head first into PHP.  I like it a bunch.


Ron Gallant [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I get
 Warning: Wrong parameter count for explode() in
 /www/chizeledlight/test.php on line 39
 when I use this code.

 The line in error is
 explode($row);


 Hugh Bothwell [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 
  Ron Gallant [EMAIL PROTECTED] wrote in message
  [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   And my table results are shown 2 times per row.
   http://www.chizeledlight.com/test.php
 
  .. at a guess, you requested the same field twice
  in your SELECT statement.
 
  I don't like the sample code given because it just
  iterates through the rows rather than using their
  names - if you alter your SQL, it could change the
  column order, which is kinda non-intuitive.
 
   I also don't know how to specify the column I want the result from.
 Like
   $columnName.
 
  Try this instead:
 
  $query =
   SELECT field1,field2,field3 
  .FROM tablename ;
  $result = mysql_query($query);
 
  while ($row = mysql_fetch_array($result)) {
  explode($row);
  echo \ntrtd$field1/tdtd$field2/tdtd$field3/td/tr;
  }
 
 





-- 
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] Re: Table results returning 2 sets of the same row

2001-08-18 Thread Hugh Bothwell

Doh!  I meant extract($row);

Ron Gallant [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I get
 Warning: Wrong parameter count for explode() in
 /www/chizeledlight/test.php on line 39
 when I use this code.

 The line in error is
 explode($row);



-- 
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]