Ver Mensaje Individual
  #3 (permalink)  
Antiguo 15/08/2009, 17:51
betodaniel61
Usuario no validado
 
Fecha de Ingreso: abril-2009
Ubicación: Buenos Aires
Mensajes: 413
Antigüedad: 15 años
Puntos: 3
Respuesta: Funcion PHP con select MySQL

Amigo, la funcion ahora quedo asi:

<?php
function qtabla($tabla,$campo,$valor){
$result=mysql_query("select '$campo' from '$tabla' where numero = '$valor'") or die(mysql_error());
$registro=mysql_fetch_array($result);
return($registro[$campo]);
}
?>

y me tira el siguiente error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''secciones' where numero = '4'' at line 1

secciones es el nombre de la tabla y numero el campo que tiene que ser 4, (es numerico), puede ser por eso??.

Muchas Gracias