I have this little slide show script but it doesn't seem to work. I think it's a problem with the if statements because each time the script is reloaded the if statements are run even if they aren't true. What's the problem with this?
---------------------------------
if ($pid=$nid) {
$ppid="--$pid";
$npid="++$pid";
printf ("<a href= onMouseOut=MM_swapImgRestore() onMouseOver=MM_swapImage('previous','',' name=previous border=0 src= width=16 height=17 align=absmiddle></a><img name=next border=0 src= width=16 height=17 align=absmiddle>", $mid, $ppid, $nid);
} else {
if ($pid = "1" {
$npid=2;
printf ("<img name=previous border=0 src= width=16 height=17 align=absmiddle><a href= onMouseOut=MM_swapImgRestore() onMouseOver=MM_swapImage('next','',' name=next border=0 src= width=16 height=17 align=absmiddle></a>", $mid, $npid, $nid);
} else {
$ppid="--$pid";
$npid="++$pid";
printf ("<a href= onMouseOut=MM_swapImgRestore() onMouseOver=MM_swapImage('previous','',' name=previous border=0 src= width=16 height=17 align=absmiddle></a><a href= onMouseOut=MM_swapImgRestore() onMouseOver=MM_swapImage('next','',' name=next border=0 src= width=16 height=17 align=absmiddle></a>", $mid, $ppid, $nid, $mid, $npid, $nid);
}
}
---------------------------------
if ($pid=$nid) {
$ppid="--$pid";
$npid="++$pid";
printf ("<a href= onMouseOut=MM_swapImgRestore() onMouseOver=MM_swapImage('previous','',' name=previous border=0 src= width=16 height=17 align=absmiddle></a><img name=next border=0 src= width=16 height=17 align=absmiddle>", $mid, $ppid, $nid);
} else {
if ($pid = "1" {
$npid=2;
printf ("<img name=previous border=0 src= width=16 height=17 align=absmiddle><a href= onMouseOut=MM_swapImgRestore() onMouseOver=MM_swapImage('next','',' name=next border=0 src= width=16 height=17 align=absmiddle></a>", $mid, $npid, $nid);
} else {
$ppid="--$pid";
$npid="++$pid";
printf ("<a href= onMouseOut=MM_swapImgRestore() onMouseOver=MM_swapImage('previous','',' name=previous border=0 src= width=16 height=17 align=absmiddle></a><a href= onMouseOut=MM_swapImgRestore() onMouseOver=MM_swapImage('next','',' name=next border=0 src= width=16 height=17 align=absmiddle></a>", $mid, $ppid, $nid, $mid, $npid, $nid);
}
}