Hey🙂
my forms and sessions are working🙂 thanks again for you help🙂
now i would like to store this informations into the database.
So i have a tablle called jos_serial with 3 field (id (autoincrement, primarykey), iduser,serial)
i want my submit button to insert information on the database
so here is my code :
But it's not working, i dont have any error, and nothing on my table.
but if i do
is working...
i dont realy understand why...
iduser is INT, SN is VARCHAR(10).
my variable $sn is correct beacause "echo $sn" is working well..
Do you have an idea ?
thanks😉
my forms and sessions are working🙂 thanks again for you help🙂
now i would like to store this informations into the database.
So i have a tablle called jos_serial with 3 field (id (autoincrement, primarykey), iduser,serial)
i want my submit button to insert information on the database
so here is my code :
<?php $session =& JFactory::getSession();
$sn=$session->get('sn');
echo $sn;
$user =& JFactory::getUser();
$usr_id = $user->get('id');
$db =& JFactory::getDBO();
$query= 'INSERT INTO #__serial (iduser,SN)' . ' VALUES ('.$usr_id.','.$sn.')';
$db->setQuery($query);
$db->query();
?>
But it's not working, i dont have any error, and nothing on my table.
but if i do
$query= 'INSERT INTO #__serial (iduser,SN)' . ' VALUES ('.$usr_id.',"blabla")';
is working...
i dont realy understand why...
iduser is INT, SN is VARCHAR(10).
my variable $sn is correct beacause "echo $sn" is working well..
Do you have an idea ?
thanks😉