[HELP] array codeigniter

i have tried to make sql code in CI, the problem is the ID_LABEL at t_publisher is filled with 0 where it should filled with number that taken from t_label..

$sql['query1'] = "INSERT into t_user (USER_NAME, USER_PASS, USER_STATUS, USER_TYPE) values ('$user', '$pass','1','publisher')";
$sql['query2'] = "INSERT INTO t_label (LABEL) values('$user')";
$id_label = "select id_label from t_label where label ='".$user."'";
$id = $this->db->query($id_label)->result();
$sql['query3'] = "INSERT INTO t_publisher (PUBLISHER, ARTIS, ID_LABEL) values('$user', 'Various Artist', '$id')";
$result = array();
foreach($sql as $key => $value){

$result[$key] = $this->db->query($value);

please help Smile

$sql[‘query3’] = “INSERT INTO t_publisher (PUBLISHER, ARTIS, ID_LABEL) values(’$user’, ‘Various Artist’, ‘$id->id_label’)”;
Generating query results: http://ellislab.com/codeigniter/user-gui...sults.html

And escape your queries. Please read last two sections from user guide: http://ellislab.com/codeigniter/user-gui...eries.html

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.