|
Posted by zek2005 on 02/10/07 11:32
Hi !!
Here is my problem. I can connect to data base through PHP (I receive
a "Connection OK" message)
<?php
function Conectarse()
{
if (!($link=mysql_connect("localhost","myuser","mypass")))
{
echo "Error to connect to DB.";
exit();
}
if (!mysql_select_db("users1",$link))
{
echo "Error selecting DB.";
exit();
}
return $link;
}
$link=Conectarse();
echo "Connection OK.<br>";
mysql_close($link); //
?>
Then I try to execute a simple select * query, but I dont receive
results:
<?php
include("test.php"); // test.php refers to the file with the
function above
$link=Conectarse();
$result=mysql_query("select * from usuarios",$link);
while($row = mysql_fetch_array($result)) {
printf($row["Nombre"],$row["Apellido"]);
}
mysql_free_result($result);
mysql_close($link);
?>
I also try other types of queries (update, as example), but it doesnt
work
Could it be a setting problem in my site?
Thanks in advance for your answer.
Ezequiel
Navigation:
[Reply to this message]
|