Jump to content

Help! My 'SQL=INSERT INTO' broke!!


durins_day

Recommended Posts

I'm trying to place user variables into a new SQL table, however im not having any luck at all. Can anyone explain to me why the following code fails to insert a new table into omg_usuarios?

 

 

 

$db  =& JFactory::getDBO(); //Get SQL database.
$user	=& JFactory::getUser(); //Get the logged in username, email, and real name


$username = $user->get('username');
$name = $user->get('name');
$email = $user->get('email');
$password = 'whatever';


// Create New usertable

$sql = "INSERT INTO `omg_usuarios` (`id`, `nome`, `usuario`, `contrasinal`, `contrasinal_tmp`, `email`, `estado`, `admin`, `id_grupo`, `mantemento`, `descargas_maximo`, `cambiar_datos`) VALUES

(NULL, '$name', '$username', '$password', '', '$email', '1', '0', '2', CURDATE(),'150000', '1')";
$result = mysql_query($sql);

 

In the end I don't even get an empty table, nothing! If I use print($username); the logged in user's name, email, and username shows up as expected. I'm so lost!

 

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/97397-help-my-sqlinsert-into-broke/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.