Javasscript array in PHP - Programmers Heaven

Howdy, Stranger!

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

Categories

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: 691Member ✭✭✭
    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.