I want to make a short query into a db through a php script sending variables troughout POST. With mysql_error() it says that I have an error in the query : Select...
Can somebody help me with this?
[php]
<?
extract($_POST);
$ref_art=trim($ref_art);
$exi_art=trim($exi_art);
if (!$ref_art || !$exi_art)
{
echo 'No has introducido la referencia o las unidades';
header("Location: index.php"

;
}
$sref_art = addslashes($ref_art);
$exi_art = addslashes($exi_art);
@ $conn=mysql_pconnect("localhost","",""

;
if(!$conn){
echo "no existe tal bd";
}
mysql_select_db("tienda"

;
echo "hola";
//Ejecucion de la sentencia SQL
$query = "Select * From fal_art Where ref_art = '$ref_art'";
$result = mysql_query($query);
if($result){
$filas = mysql_num_rows($result);
echo "$filas";
}else{
echo mysql_error();
}
?>
[/php]