|EN - Bugreport • sc_randompic.php|
|26.03.2010, 11:30 - webdede - webSPELL newbie - 30 Posts
I was reading the sc_randompic.php file to adapt if for a sc_lastpic.php ( a new file ) and I think there is a littke mistake of coding in this file :
I know the "==" or the "!=" but what is "!==" ?
I think it was "!=" instead. So maybe php ignore the test and it continue to work but I think if you want the test to be done you must replace the "!==" condition by the a "!=", exact ?
By the way I was trying to have the lastpic of the thumbs from the galery instead of a randompic from the user pics.
So I have replace :
$picpath = './images/userpics/';
$picpath = './images/gallery/thumb/';
$the_pic = $pic_array[rand(0,($anz-1))];
$the_pic = $pic_array[$anz-1];
but it doesnt display me the latest one but another one :/ Any idea ?
|26.03.2010, 11:56 - blue.tiger - Administrator - 3188 Posts
Operators with three characters are also checking for the type of the comparison parameters.
If you want to select the latest galery picture, you shouldn't use this way. Select the latest picture by using an mysql query instead:
|26.03.2010, 12:02 - webdede - webSPELL newbie - 30 Posts
Oh ok sorry I didnt know this operator ! I'm not a pro in web coding
For the code you mention to get the latest picture, ok, I will try your way.
But what makes my way to fail ? I mean if I have understood the code correctly, the code list all the pics in a table and then pick a random one between [0;size-1] of the table. So I was quite sure that if I was replacing the random(0;size-1) by only (size-1) I will get the latest one, but it looks like it's not the case, indeed.
So actually I was even thinking that the random function was not picking among the total ammount of picture given that (size-1) doesnt look like to refer to the latest one.
I must be wrong somewhere ^^
|26.03.2010, 13:08 - webdede - webSPELL newbie - 30 Posts
Hm I have tried with your mysql request and in $last_picture I have "Array" returned. No pic ID.
|26.03.2010, 13:42 - webdede - webSPELL newbie - 30 Posts
Here is my code :
Any idea what could be wrong ?