Problem with my first script
| From: | Fernando Gonzalez | Date: | Sun, 24 Jun 2001 23:56:22 +0000 |
| Subject: | Problem with my first script | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-10726@lists.php.net to get a copy of this message | ||
I'm trying to retrieve data from a MySql Database
I have the following php script:
<?
echo "Resultados de tabla Empresas";
echo"<br>";
$link = mysql_connect ("localhost:3306", "root", "")
or die ("Could not connect");
print ("Connected successfully");
mysql_select_db ("seguros");
$sql="select * from mae_companias";
$result=mysql_query($sql,$link);
echo "<table
align='center'><tr><td></td>Nombre<td>Direccion</td><td>Telefono</td><td>Fax
</td>";
$num=mysql_num_rows($result);
$cur=1;
while($num>=$cur){
$myrow=mysql_fetch_array ($result);
$nombre=$myrow("nombre");
$direccion=$myrow("direccion");
$telefono=$myrow("telefono");
$fax=$myrow("fax");
echo
"<tr><td>$nombre</td><td>$direccion</td><td>$telefono</td><td>$fax</td>";
$cur++;
}
echo "</table>";
?>
When I call this page I get the following error:
Fatal error: Call to undefined function: array() in
/home/fergonza/mod_php4/index.php on line 18
Line 18 is refwrring to the line where I have "$myrow=mysql_fetch_array
($result);"
Anyone can help??????