View Single Post
  #1 (permalink)  
Old 10-21-08, 12:47 PM
tirengarfio tirengarfio is offline
Newbie Coder
 
Join Date: Oct 2008
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Trying to read and write from a table

Hi,

im trying to write a code which writes and reads a string in a field of a table, but i get this error below at the line that starts with "$row = mysql_fet..."

Code:
 "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL 
result resource in /opt/lampp/htdocs/Sites/prueba.php on line 23"

This is the code:

PHP Code:

<?php


$nombre
="Javier";

$nombre2;


if (!(
$link=mysql_connect("localhost","","")))
{
echo 
"Error conectando a la base de datos.";
exit();
}

mysql_db_query("ejemplo""insert into clientes(nombre) values('$nombre')");

$result mysql_db_query("ejemplo""select * from clientes");

$row mysql_fetch_array($result);

echo 
$row["nombre"];


?>

Anyone can help me?

Ciao
Reply With Quote