![]() |
apache configuration question. PHP error.
I've a website running a php script that displays a random photo.
On my live site everything works fine, but locally I get an error message. These are shown in the attached JPGs. A similar issue happens to the social icons on the left. Since the sites are identical, I assume this is a problem with my local server configuration. Can anyone help me fix this? Any help will be appreciated. Thank you. leifbaker@nj.rr.com http://leifbaker.net/error/lbd.jpg http://leifbaker.net/error/lbd_errors.jpg |
That's a PHP error.
Looks to me that you may be using the wrong datatype. max/min work with arrays or with two separate arguments, but these have been provided with a single scalar argument. If you have 2x arguments, one low and one high, you provide both for your rand: PHP Code:
|
Thanks, Fou-Lu,
but that's not the problem. The page runs fine on the live site (and the social icons suffer also). The problem is in my local php configuration, but I don't know how to fix it. |
No, the problem is your PHP versions.
The document doesn't state a change, but its clearly there. 5.2x for sure accepts the arguments in either order. By 5.3.10 it tosses the above error if you have the maximum value before the minimum value. So your arguments are backwards. |
Ok.
I'm no php whiz, I'm a designer. But here's my script: <?php $total = "1"; $file_type = ".jpg"; $image_folder = "images/rotate2"; $start = "112"; $random = mt_rand($start, $total); $image_name = $random . $file_type; $url = "pics/pic_" . $random . '.php'; echo "<a href=\"$url\" target=\"_blank\"><img src=\"$image_folder/$image_name\" /></a>" ?> Do you know how I can fix it to make it 5.3 compliant? Thanks for the help. |
Yeah, swap the $start, $total arguments in mt_rand. $start = 112 and $total = 1. So they are backwards.
Alternatively to keep it more dynamic, use this: PHP Code:
|
Thanks
That did it. Thanks a lot.
|
| All times are GMT +1. The time now is 12:27 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.