0

Hello dear friends,
I’ve one problem. I hope you guys help in this…!

Actually, I have two array.
One array carry ‘title’ of my sms text messages.
Second array carry ‘description of sms messages.

Problem is that…! i want to got these two array result in my foreach loop.
As you know foreach loop carry one time one array result….!
How its possible I’ll get these two array result in one loop???
Please, let me know how to declare these two array in foreach….!

thanks waiting for your reply....!

2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by ahmedeqbal
0

Why do you want to use a foreach loop is in this case?
If I were you I would do a for loop from 0 to size of your arrays and use that index to get the same position values in both arrays.

0

$sms_title = $title[0]; // this array contain sms title

$sms_detail = $detail[0]; // this array contain sms detail

foreach () {


i want to get Result of >> $sms_title

i want to get Result of >> $sms_detail

After this>>

i want to use Mysql INSERT query to insert $sms_title, $sms_detail in to database

}

***if you have another solution please, explain with example....! please..... :(

1

Now I don't understand what you want to do...
I thought you need something like:

$sizeOfArrays = count($sms_titles);

for ($i = 0; $i < $sizeOfArrays; $i++) {
    INSERT into DB -> $sms_titles[i] and $sms_details[i]
}

Edited by Daiva: n/a

Votes + Comments
Daiva Reply very helpful for me. :)
0

Daiva, thanks dear...!

you are right...! For loop is right solution...!

thanks again.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.