Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi All,
I have problem using while() inside a For Loop in the code below.Code: Select all
<?php
$allprop_id = explode(",", $prop_id1);
for($i = 0; $i < $selected; $i++)
{
$test = $allprop_id[$i];
echo "$test <br />";
// [color=red]displaying the correct values of $test for the current values of $i[/color]
$sqlprop = "SELECT * FROM property where prop_id ='$test'";
$resultprop = mysql_query($sqlprop);
while ($row=mysql_fetch_assoc($resultprop))
{
$email=$row["$email"]; $prop_id = $row["$prop_id"] ...........;
$sqlfn_new = "INSERT INTO enquiry (email, prop_id, ......) VALUES('$email, '$prop_id', ......)";
$resultfn_new = mysql_query($sqlfn_new);
// [color=red]inserting the same first values next subsequent values of $i [/color]
echo "$test <br />";
// [color=red]keep on displaying the same value of $test for $i = 1[/color]
}
echo "$test <br />";
// [color=red]outside the while loop displaying the correct values of $test for the current values of $i[/color]
}
?>Please I need your help.
The Ninja Space Goat | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]