Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Javasscript array in PHP

deekshasdeekshas Posts: 2Member
I want to create a single javascript array in PHP as shown in the code:
<?

while($row=mysql_fetch_array($result))
{
list($width, $height, $type, $attr) = getimagesize($row[photoPath]);
if(($width < 600) && ($height <= 900))
{
for ($i; $i<=1; $i++)
{

echo "show image";

}
echo "show image";
//Value for javascript array row will come here

}
else
{
for ($i; $i<=1; $i++)
{

echo "show image";

}
echo "show image";

//Value for javascript array row will come here

}

}


?>

Any help will be appreciated

Thanks,
Srinivas

Comments

  • pseudocoderpseudocoder Posts: 673Member ✭✭
    I don't really follow you. What values are you placing in the array, and is it more than one array? I don't know if it will help you or not.

    [code]
    $n = 1;

    echo "
    ";

    while($n <= 5) {

    echo "var arr" . $n . " = new Array(";

    for($i=0; $i < 10; $i++) {
    echo ($i < 9 ? $i . ", " : $i . ");
    ");
    }

    $n++;
    }

    echo "</script>";
    [/code]
Sign In or Register to comment.