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 '±a FROM bienvenida WHERE usuario=NULL AND contraseña=NULL' at line 1
la pagina y el codigo donde me da el error es la siguiente:
Código:
y la base de datos mysql consta de una tabla llamada bienvenida<?php require_once('../Connections/acceso_control.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } ?><?php // *** Validate request to login to this site. if (!isset($_SESSION)) { session_start(); } $loginFormAction = $_SERVER['PHP_SELF']; if (isset($_GET['accesscheck'])) { $_SESSION['PrevUrl'] = $_GET['accesscheck']; } if (isset($_POST['ctext_usuario'])) { $loginUsername=$_POST['ctext_usuario']; $password=$_POST['ctext_clave']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "../bienvenida.php"; $MM_redirectLoginFailed = "../diseno.php"; $MM_redirecttoReferrer = false; mysql_select_db($database_acceso_control, $acceso_control); $LoginRS__query=sprintf("SELECT usuario, contraseña FROM bienvenida WHERE usuario=%s AND contraseña=%s", GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); $LoginRS = mysql_query($LoginRS__query, $acceso_control) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && false) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Control de Acceso</title> <style type="text/css"> <!-- body { background-color: #E4E8EB; } #apDiv1 { position:absolute; left:300px; top:200px; width:340px; height:12px; z-index:1; } .Estilo4 { font-size: small; color: #FFFFFF; } .Estilo8 {color: #DA241C; font-size: x-small; } .Estilo10 {color: #0000FF} .Estilo12 { color: #FFFFFF; font-family: Tahoma; } --> </style></head> <body> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" summary="Tabla de diseño"> <tr> <td rowspan="2"> </td> <td colspan="4" valign="bottom"> </td> <td width="30" rowspan="2"> </td> </tr> <tr> <td colspan="3" valign="bottom"><img height="9" alt="img_sombra_sup" src="imagenes/marco_01_0000.jpg" width="788" /></td> <td valign="bottom"> </td> </tr> <tr> <td rowspan="5"> </td> <td width="32" rowspan="4"><img height="450" alt="img_sombra_der" src="imagenes/marco_02_0000.jpg" width="32" /></td> <td height="56" bgcolor="#FFFFFF"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" summary="encabezado"> <tr> <td width="200" bgcolor="#FFFFFF"><img src="../imagenes/barras_banner1.png" alt="img_sup" width="200" height="11" align="top" longdesc="imagen barra superior" /></td> <td width="284" rowspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td scope="col"><img src="../imagenes/barras_banner1.png" alt="img_sup" width="300" height="11" align="top" longdesc="imagen barra superior" /></td> </tr> <tr> <td scope="col"><img src="../imagenes/banner_1.png" alt="" width="300" height="56" align="top" /></td> </tr> </table></td> <td width="200"><img src="../imagenes/barras_banner1.png" alt="img_sup" width="221" height="11" align="top" longdesc="imagen barra superior" /></td> </tr> <tr> <td bgcolor="#FFFFFF"><img src="../imagenes/logo_azul_almac_mod1.png" width="200" height="56" /></td> <td width="200"><img src="../imagenes/log_der.png" alt="" width="221" height="56" align="top" /></td> </tr> </table></td> <td width="35" height="450" rowspan="4" align="right"><img src="imagenes/marco_04_0000.jpg" alt="img_sombra_izq" width="35" height="450" align="left" /></td> <td rowspan="4"> </td> <td width="30" rowspan="5"> </td> </tr> <tr> <td bgcolor="#FFFFFF"><img src="../imagenes/barras_banner1.png" alt="" width="721" height="10" /></td> </tr> <tr> <td height="103" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <th bgcolor="#FFFFFF" scope="col"> </th> <th bgcolor="#FFFFFF" scope="col"> </th> <td bgcolor="#FFFFFF" scope="col"> </td> </tr> <tr> <th bgcolor="#FFFFFF" scope="row"> </th> <td width="260" bgcolor="#FFFFFF"><table width="100%" border="1" cellpadding="1" cellspacing="1" background="../imagenes/fondo_img.png"> <tr> <th background="../imagenes/fondo_img.png" bgcolor="#FFFFFF" scope="col"><span class="Estilo4">Por favor introduzaca su nombre de usuario y contraseña</span></th> </tr> </table></td> <td bordercolor="#FFFFFF" bgcolor="#FFFFFF"> </td> </tr> <tr> <th bgcolor="#FFFFFF" scope="row"> </th> <td width="260" bgcolor="#FFFFFF"><form id="form_acceso" name="form_acceso" method="POST" action="<?php echo $loginFormAction; ?>"> <label></label> <table width="100%" border="0" cellspacing="1" cellpadding="0"> <tr> <th bordercolor="#FFFFFF" background="../imagenes/fondo_img.png" bgcolor="#DA241C" class="Estilo4" scope="col"><div align="right" class="Estilo12">Usuario:</div></th> <th bordercolor="#FFFFFF" scope="col"> <div align="center"> <input type="text" name="ctext_usuario" id="ctext_usuario" accesskey="u" tabindex="1" /> </div></th> </tr> <tr> <th bordercolor="#FFFFFF" background="../imagenes/fondo_img.png" bgcolor="#DA241C" class="Estilo4" scope="row"><div align="right"><span class="Estilo12">Contraseña:</span></div></th> <td bordercolor="#FFFFFF"><div align="center"> <input type="password" name="ctext_clave" id="ctext_clave" accesskey="c" tabindex="2" /> </div></td> </tr> <tr> <th colspan="2" scope="row"><input type="submit" name="boton_enviar" id="boton_enviar" value="Enviar" accesskey="b" tabindex="3" /></th> </tr> </table> </form></td> <td bgcolor="#FFFFFF"> </td> </tr> <tr> <th height="142" bgcolor="#FFFFFF" scope="row"> </th> <td bgcolor="#FFFFFF"> </td> <td bgcolor="#FFFFFF"> </td> </tr> </table></td> </tr> <tr> <td width="693" height="16" valign="bottom" bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <th scope="col"><p align="center" class="Estilo8"><strong>*<span class="Estilo10">De</span></strong><br /> <strong>Ciudad</strong> <strong><span class="Estilo10">Con </span>*Todos</strong> <br /> <span class="Estilo10"><strong>*Para</strong></span></p></th> <th scope="col"><p align="center" class="Estilo8">Terminal de Pasajeros Puerto Ordaz Sector Alta Vista* <br /> Estado Bolívar, Venezuela<br /> Telf.: 0286-3162717</p></th> <th scope="col"><img src="../imagenes/logo_inf.png" width="109" height="59" /></th> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <th scope="col"><img src="imagenes/marco_05_0000.jpg" alt="img_sombra_inf" width="721" height="18" align="bottom" /></th> </tr> </table></td> </tr> <tr> <td colspan="4"> </td> </tr> <tr> <td> </td> <td colspan="4"> </td> <td width="30"> </td> </tr> </table> </body> </html>
con 3 campos
Id ----> int(11)
usuario ----> varchar(40)
contraseña ----> varchar(10)
Dice que tengo un problema en la sintanxis en la primera linea pero no se cual es.
Si alguien me podria ayudar se lo agredeceria mucho...