Hello everyone,
    I am brand new to php, so any replies I get are very much appreciated.
My goal is to retrieve one entire table from my database and post the
information on the web.  My query seems successful, but I am having trouble
getting the information out from the variable $result.  My table has 4
fields, the primary key, "location," "organization," and "charge."   Any
suggestions?   A million thanks.  Here is the code:

<html>
<body>
<?
   /* Connectiong*/
@ $db = mysql_connect("localhost", "NAME","PASS");

   if (!$db)
{
      echo "Error, please try again.";
      exit;
}
/* Selecting database*/
$db2 = mysql_select_db ("DATABASE");
if (!$db2)
{
  echo "error again";
  exit;
}
     /*sending query */
        $query = "select * from `$mytable` where $i";
        $result = mysql_query($query);

        /*testing to see if result has the data */
        if (!$result){echo "result is empty";}

for ($a=0;$a<4;$a++)
{
     for($i=0;$i<4;$i++)
{
          $row = mysql_fetch_array($result);
        echo $row[i]["organization"]."<br>";
        echo $row[i["location"]."<br>";
         echo $row[i]["charge"];
  }
}

?>
</body>
</html>

-- Jonathan



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

Reply via email to