Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/10/2010, 14:28
Avatar de fedefrankk
fedefrankk
 
Fecha de Ingreso: agosto-2007
Mensajes: 871
Antigüedad: 16 años, 8 meses
Puntos: 7
Pregunta No encuentro solucion a este error.

Hola el error se encuentra cuando pongo la variable, $a, en el select, tambien probe con poner
Código PHP:
$sql "SELECT * FROM directorio WHERE id=".$_POST['id']; 
El error que sale es el siguiente

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 '' at line 1


Código PHP:
<form  method="post" action="editar.php">
<input  type="text  "id="valor">
<input type="submit" name ="submit" value="enviar">
</form>
<?php
include ("includes/config.php");
include (
"includes/funciones.php");


//nos conectamos a mysql
$cnx conectar ();
//consulta para mostrar los datos.
$a=$_POST['valor'];
$sql "SELECT * FROM directorio WHERE id=".$a;
$resmysql_query($sql) or die (mysql_error());
if( 
mysql_num_rows($res) >0){
    
//si hay resultados hacemos la forma.
?>
<form name="form1" method="post" action="editar.php">
<table width="400" border="1" cellpadding="0" cellspacing="0">
<?
Gracias de antemano
Saludos a todos
PD: Alguien tiene un codigo para modificar mysql con php sencillo.?
Gracias