|
Posted by Iván Sánchez Ortega on 02/10/07 16:14
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
zek2005 wrote:
> Sorry Jeey for the misunderstanding. I added the mysql_error and I
> only get the "Connection OK" message from the function, but I don't
> receive the result of the select (the table "usuarios" has 4 rows)
>
> I'm going crazy!!!!!
>
> Ezequiel
OK... Please run this, and tell us if it works or not:
<?php
mysql_connect("localhost","myuser","mypass");
$r = mysql_query("select * from usuarios");
if (!$r)
echo mysql_error();
else
while($row = mysql_fetch_array($r))
print_r($row);
?>
Possible errors you are making so far:
- - The database connection is being established two times, and it's making
things go weird (By the sample code you posted, you are calling
Conectarse() twice).
- - The SQL columns are lowercase, so mysql_fetch_array returns an array with
lowercase indexes; and you're accesing it with mixed-case ( $row['Nombre']
instead of $row['nombre']. Check that by doing print_r($row).
- --
- ----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-
Me encanta la humanidad (firmado un caníbal).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFFze9sR56dWuhgxGgRAlLdAJ4kOy32iqHH7RRU8O5mRm5H08MU3QCdFtSo
/2hpwB/MGdWdl+fhOdONZtE=
=iz0R
-----END PGP SIGNATURE-----
Navigation:
[Reply to this message]
|