[PHP-DB] Problem with my first script

2001-07-24 Thread Fernando Gonzalez

I'm trying to retrieve data from a MySql Database

I have the following php script:

?
echo Resultados de tabla Empresas;
echobr;
$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'trtd/tdNombretdDireccion/tdtdTelefono/tdtdFax
/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
 trtd$nombre/tdtd$direccion/tdtd$telefono/tdtd$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??



-- 
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] Problem with my first script

2001-07-24 Thread leo g. divinagracia iii

i havent tested it yet... but...

Fernando Gonzalez wrote:
 

 $num=mysql_num_rows($result);
 $cur=1;
 while($num=$cur){
 $myrow=mysql_fetch_array ($result);
  ^^  

you got a space after the function and the open paren.  NO SPACES 
(as i found before that took about 10 minutes of debugging on a similar
debugging session...)   ;-)))


-- 
Leo G. Divinagracia III
[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] Problem with my first script

2001-07-24 Thread Craig Vincent

snip
$myrow=mysql_fetch_array ($result);
/snip

Remove the space in the function call and it should work fine for you

ie.

$myrow=mysql_fetch_array($result);

Sincerely,

Craig Vincent

-- 
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] Problem with my first script

2001-07-24 Thread Fernando Gonzalez

Thanks, but it wont work.
I have eliminate the space but still the same message.
I have realized that the problem is below that line:
the problem is pointing to the line where i fetch the first variable:
$nombre=$myrow(nombre);

Any other Ideas
thanks

?
echo Resultados de tabla Empresas;
echobr;
$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'trtd/tdNombretdDireccion/tdtdTelefono/tdtdFax
/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
 trtd$nombre/tdtd$direccion/tdtd$telefono/tdtd$fax/td;
 $cur++;
}
echo /table;
?





- Original Message -
From: leo g. divinagracia iii [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, July 24, 2001 7:52 PM
Subject: Re: [PHP-DB] Problem with my first script


 i havent tested it yet... but...

 Fernando Gonzalez wrote:
 

  $num=mysql_num_rows($result);
  $cur=1;
  while($num=$cur){
  $myrow=mysql_fetch_array ($result);
   ^^

 you got a space after the function and the open paren.  NO SPACES
 (as i found before that took about 10 minutes of debugging on a similar
 debugging session...)   ;-)))


 --
 Leo G. Divinagracia III
 [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] Problem with my first script

2001-07-24 Thread leo g. divinagracia iii

1.  safe to assume that there is a column named nombre?
2.  try using index numbers instead, i.e;, instead of $myrow(nombre),
try $myrow(1)...


Fernando Gonzalez wrote:
 
 Thanks, but it wont work.
 I have eliminate the space but still the same message.
 I have realized that the problem is below that line:
 the problem is pointing to the line where i fetch the first variable:
 $nombre=$myrow(nombre);
 


-- 
Leo G. Divinagracia III
[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] Problem with my first script

2001-07-24 Thread Paul Burney

on 6/24/01 7:23 PM, Fernando Gonzalez at [EMAIL PROTECTED] wrote:

 I have eliminate the space but still the same message.

 $myrow=mysql_fetch_array ($result);

 Fatal error: Call to undefined function: array() in
 /home/fergonza/mod_php4/index.php on line 18

I wonder if somehow you have an invisible control character between the
mysql_fetch_ and the array part.  Try deleting the line and retyping:

$myrow = mysql_fetch_array($result);

Hope that helps.

Sincerely,

Paul Burney

++
Paul Burney
Webmaster  Open Source Developer
UCLA - GSEIS - ETU
(310) 825-8365
[EMAIL PROTECTED]
http://www.gseis.ucla.edu/
++



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