On Saturday 08 June 2002 19:42, Bård Tommy Nilsen wrote:
> I am trying to store several results from an mysql_query into an "int" I
> want to produce several lines into $result, so i can include $result Into
> my email, or is there a better way to do this ?

> $query = mysql_query("select * from $table");
> $number = mysql_numrows($query) ;
> $i = 0;
> while ($i < $number) {
>  $id = mysql_result($query,$i,"id");
>  $Name = mysql_result($query,$i,"Name");
>
>
> ## WHAT MUST I DO HERE ??? ##
>
>
> $i++;
> }

The above can be rewritten as:

  $query = mysql_query("select * from $table");
  while ($row = mysql_fetch_array($query)) {
    $id   = $row('id');
    $Name = $row('Name');
    $result .= "$id $Name<br>";
  }

Salt and pepper to taste.

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

/*
If you see an onion ring -- answer it!
*/


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

Reply via email to