×

Error

Please login first

insert values into mysql

17 years 5 months ago #25294 by jono32
insert values into mysql was created by jono32
Hi, I'm wondering i'm trying to insert a value from a form diplayed in a tab in community builder into a database but am having some trouble with the script


function getDisplayTab($tab,$user,$ui) {
//(globals)

global $HTTP_POST_VARS, $database, $my;


$base_url=$this->_getAbsURLwithParam(array());
$params = $this->params;
$return="";
$adsLimit = $params->get('adsLimit','');

$this->FORM = $HTTP_POST_VARS;
$userid = $my->id;
$trackid = $this->FORM[trackid];
$submit = $this->FORM[submit];

if ($submit == "add") {

$Query = "INSERT INTO jos_userplaylist (trackid,userid)
VALUES('$trackid','$userid')";

$database->setQuery($query);
$database->query();

$return .="trackid=".$trackid." userid=".$userid."submit = ".$submit."";;

}


all the values are being passed correctly but the problem appears to be with this part of the script

$Query = "INSERT INTO jos_userplaylist (trackid,userid)
VALUES('$trackid','$userid')";

$database->setQuery($query);
$database->query();

i've added $database to the functions globals and all the values are being passed correctly (both $trackid, $userid and $submit)

Is there something missing here ? any help would be greatly appreciated if you'd like to see full code pm me.

Thanks in advance

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.167 seconds

Facebook Twitter LinkedIn