alexander007 Posted October 11, 2007 Share Posted October 11, 2007 I have this... <?php include"include/config.php"; $tbl_name="clientes"; $nombre=$_POST['nombre']; $telefono=$_POST['telefono']; $email=$_POST['email']; $usuario=$_POST['usuario']; $referido=$_POST['referido']; if($nombre==NULL|$telefono==NULL|$email==NULL|$usuario==NULL) { echo "<h3><center>Favor de llenar todos los campos.</center></h3>"; } else { mysql_query("INSERT INTO `$tbl_name` VALUES (NULL, '$nombre', '$telefono', '$email', '$usuario', NULL)"); mysql_query("UPDATE `$tbl_name` SET referidos=referidos+1 WHERE usuario='$referido'"); } mkdir("/home/content/m/a/u/maunalava/html/dev-netteampr/travel/".$usuario, 0777) ?> I dont know why is not inserting the values on the table... Link to comment https://forums.phpfreaks.com/topic/72715-whats-wrong-here/ Share on other sites More sharing options...
cooldude832 Posted October 11, 2007 Share Posted October 11, 2007 don't post mysql errors until you have added or die(mysql_error()); to a query this will lead you to the problem 99% of the time. Link to comment https://forums.phpfreaks.com/topic/72715-whats-wrong-here/#findComment-366742 Share on other sites More sharing options...
darkfreaks Posted October 11, 2007 Share Posted October 11, 2007 why do you have single quotes in a query which is already parsed by double quotes? my advice remove the singles Link to comment https://forums.phpfreaks.com/topic/72715-whats-wrong-here/#findComment-366743 Share on other sites More sharing options...
alexander007 Posted October 11, 2007 Author Share Posted October 11, 2007 Query was empty...I dont understant why the query is empty ??? Link to comment https://forums.phpfreaks.com/topic/72715-whats-wrong-here/#findComment-366749 Share on other sites More sharing options...
darkfreaks Posted October 11, 2007 Share Posted October 11, 2007 did u remove the single quotes only from the php variables in the sql? ??? Link to comment https://forums.phpfreaks.com/topic/72715-whats-wrong-here/#findComment-366750 Share on other sites More sharing options...
alexander007 Posted October 11, 2007 Author Share Posted October 11, 2007 yes Link to comment https://forums.phpfreaks.com/topic/72715-whats-wrong-here/#findComment-366752 Share on other sites More sharing options...
cooldude832 Posted October 11, 2007 Share Posted October 11, 2007 mysql_query("INSERT INTO `$tbl_name` VALUES (NULL, '$nombre', '$telefono', '$email', '$usuario', NULL)"); Insert Into is the structure of Insert Into `Table` Fields() Values() so try addressing the fields. Also you need to be consistent about quoting I prefer to do queries like this as its easier to see errors <?php $q = "INSERT INTO `".$tbl_name."`Fields(field1, field2, field3, field4, field5) VALUES (NULL, '".$nombre."', '".$telefono."', '".$email."', '".$usuario."', NULL)"; $r = mysql_query($q) or die(mysql_error()); ?> Note how I have the values quoted and then I escape and put in the variable the '".$var."' that seems to never fail for me Link to comment https://forums.phpfreaks.com/topic/72715-whats-wrong-here/#findComment-366754 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.