Jump to content

Recommended Posts

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.