Hi everyone!

I have traced the variables that stores the data. All i have to do is to save all these in a table. Pls help. Here are the variables and its content:

Variables:
$pmaster_id = get_param("master_id");
//test------------------------------
print "master ID = $pmaster_id";
$master_id = $pmaster_id;
$id = explode("-", $master_id);
echo "<br>client id = $id[0]\n";
echo "<br>subject id = $id[1]";
echo "<br>matter id = $id[2]";
echo "<br>extra = $id[3]";
//test end---------------------------

$bsnum=get_param("bsnum");
//test------------------------------------------------------------------
echo "<br>BS Number: $bsnum";
//tets end--------------------------------------------------------------

Output:

master ID = 0708-11-0001-00
client id = 0708
subject id = 11
matter id = 0001
extra = 00
BS Number: 000001

Please help me on how to save these values into database. I am new both to Php4 and MySQL as well as to the third party that is the Code Charge Studio. Thanks...

Hi everyone!

I have traced the variables that stores the data. All i have to do is to save all these in a table. Pls help. Here are the variables and its content:

Variables:
$pmaster_id = get_param("master_id");
//test------------------------------
print "master ID = $pmaster_id";
$master_id = $pmaster_id;
$id = explode("-", $master_id);
echo "<br>client id = $id[0]\n";
echo "<br>subject id = $id[1]";
echo "<br>matter id = $id[2]";
echo "<br>extra = $id[3]";
//test end---------------------------

$bsnum=get_param("bsnum");
//test------------------------------------------------------------------
echo "<br>BS Number: $bsnum";
//tets end--------------------------------------------------------------

Output:

master ID = 0708-11-0001-00
client id = 0708
subject id = 11
matter id = 0001
extra = 00
BS Number: 000001

Please help me on how to save these values into database. I am new both to Php4 and MySQL as well as to the third party that is the Code Charge Studio. Thanks...

once you have your array of values ($id) you only then need to use this to construct your sql statement, in this case ...
"insert into table values '{$id[0]}', '{$id[1]}', '$id[2]}', '$id[3]}','$bsnum'".
As long as there are no other fields in the table, apart from the master_id,client_id,subject_id,matter_id,extra and BSNumber, this should save fine (I am also making the assumption that the field types are text since it appears you want to preserve the zero paddings).

you could achieve the same effect less verbosely with the following ... "insert into table values ( ' " . implode (" ',' ", $id) . " ' ) ".

Hope this helps :)

Thanks for help. I already find solution to my problem through internet searching. I did the same thing like what you have suggested. I very much appreciate your help. Thanks a lot buddy!

This question has already been answered. Start a new discussion instead.