twisted-dev twisted-dev - 1 year ago 58
MySQL Question

how to break array to obtain an individual data from it?

Well I have this array which has data in

[0] => 1
[1] => 4

the 1 and 4 are the id of data in the database
now I want the data 1 4 individually so that I can compare it with the id of other datas in the database when running a query.
I am new can anyone help me??

Answer Source

You can access it directly like this

$data = array(1,4);
echo $data[0];// 1
echo $data[1];// 4

or dynamically

foreach($data as $id){

echo $id;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download