Hi there,

I am taking over someone elses code and do not work in php.

None of this guys pages actually work!

The one I am starting on is at http://www.vri.ca/gallery/surroundphoto/restaurant

When you click on any of his links you get the same picture so I am assuming that the php code line that has !$mov is the default when the $mov variable is not found.

you can see the source for the page and the php section that is filling in the part after the <embed src tag is a bunch of similar lines to the following:

<?php

if (!$mov) {echo "'entrance_to_privateers.mov' width='420' height='210' Scale='1'"; }
if ($mov == 1) {echo "'entrance_to_privateers.mov' width='420' height='210' Scale='1'"; }
if ($mov == 2) {echo "'crawback.mov' width='420' height='210' Scale='1'"; }

etc, etc

?>


But it doesn't work - any thoughts about where the error is? I have tried to look around at some of the basic syntax for php but cannot find anything to follow. Any links to use as a study guide once I get this done would also be appreciated.


Thanks a lot
Mark

if the mov value is numeric, then the code should look like if ($mov = 1).
if the value is integer, the if ($mov == "1")

if the mov value is numeric, then the code should look like if ($mov = 1).
if the value is integer, the if ($mov == "1")

Actually, whether it's numeric or string, the same rules apply. A single equal sign will assign a value to a variable. A double equal sign is a TRUE/FALSE comparison. There is a triple equal sign that has a special use to test that a value is really FALSE and not just null or zero.

/*
Compare a numeric value.
*/
if ($mov == 1) {
echo "mov is equal to 1";
} else {
echo "mov is not equal to 1";
}
 
/*
Compare a string value. You can use single or double quotes.
*/
if ($mov == "one") {
echo "mov is equal to 'one'";
} else {
echo "mov is not equal to 'one'";
}
This article has been dead for over six months. Start a new discussion instead.