I've got several questions for you about this, but I guess the best would be to ask if you've
put a line above the switch statement echoing the value of $id.  This would show you
whether the error is in your switch statement or before that.

It looks to me like you're mixing programming constructs here as well.  If you want to
change the value of $id like in your lines where you set $id = 1 or $id = 9 if $id is ever
below 1 or above 9 respectively, put if-then statements ahead of your switch statement. 
Switch statements are supposed to exactly match on individual cases, and then have a
default "catch-all" statement.

Hope this helps!



--- In [email protected], "Adam Yusfan Edwin" <[EMAIL PROTECTED]> wrote:
>
> hi...
>
> i have this code in my website
>
> ==========================================
>                               <?
>                                     switch ($id)
>                                     {
>                                     case $id < 1;
>                                     $id  = 1;
>                                     echo "<script>document.write('<img
> src="" width=\"300\"
> height=\"427\">');</script>";
>                                        break;
>                                    
>                                     case "":
>                                     echo "<script>document.write('<img
> src="" width=\"300\"
> height=\"427\">');</script>";
>                                        break;
>                                    
>                                        case "1":
>                                        echo "<script>document.write('<img
> src="" width=\"300\"
> height=\"427\">');</script>";
>                                        break;
>                                        case "2":
>                                        echo "<script>document.write('<img
> src="" width=\"300\"
> height=\"427\">');</script>";
>                                        break;
>                                        case "3":
>                                        echo "<script>document.write('<img
> src="" width=\"300\"
> height=\"427\">');</script>";
>                                        break;
>                                        case "4":
>                                        echo "<script>document.write('<img
> src="" width=\"300\"
> height=\"427\">');</script>";
>                                        break;
>                                        case "5":
>                                        echo "<script>document.write('<img
> src="" width=\"300\"
> height=\"427\">');</script>";
>                                        break;
>                                        case "6":
>                                        echo "<script>document.write('<img
> src="" width=\"300\"
> height=\"427\">');</script>";
>                                        break;
>                                     case "7":
>                                        echo "<script>document.write('<img
> src="" width=\"300\"
> height=\"427\">');</script>";
>                                        break;
>                                     case "8":
>                                        echo "<script>document.write('<img
> src="" width=\"300\"
> height=\"427\">');</script>";
>                                        break;
>                                     case "9":
>                                        echo "<script>document.write('<img
> src="" width=\"300\"
> height=\"427\">');</script>";
>                                        break;
>                                     case $id > 9:
>                                     $id = 9;
>                                        echo "<script>document.write('<img
> src="" width=\"300\"
> height=\"427\">');</script>";
>                                        break;
>                                    
>                                     }
>                                     ?>
>                                     </div></td>
>                                    
>                       </tr>
>                     </table>
>                     <p align="center"><a href="" echo
> $id - 1;?>">back</a> | <a
> href="" | <a
> href="" echo $id + 1;?>">next </a></p>
>
>
=======================================================
=
>
> the function is if visitor visit pranikah.php file with id=1 then
> the foto-prewedding1.jpg will displayed.
>
> example :
> http://www.imelstudio.com/pranikah.php?id=1
>
> if id = 2 then the foto-prewedding1.jpg will displayed.
>
> the sample page is
> http://www.imelstudio.com/index.php?halaman=foto_pranikah
>
> the url contain the thumbnail of images, if you click then the
> pranikah.php will open with the large images.
>
> but its not working??? the images always displaying thr
> foto-prewedding1.jpg image. the $id dont work :(
>
> please help
>
>
> best regards
>
> adam
>







The php_mysql group is dedicated to learn more about the PHP/MySQL web database possibilities through group learning.



YAHOO! GROUPS LINKS




Reply via email to