HighDots Forums  

PHP screenshot of the week

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss PHP screenshot of the week in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
rG]Courage-D-
 
Posts: n/a

Default PHP screenshot of the week - 11-26-2004 , 09:12 AM






This is very!!! Very hard!! I think it is hard to understand because 1: my
English is very bad. And 2: what I want is very complicated Ok, I want to make
a ?screenshot of the week? on my website. Allowing people to upload there
screen shot, and then store the path and upload date in my phpmysql table (that
is easy) Now let?s say there are 10 peoples will upload a picture this week,
then I want next week to take a random picture, out of all 10 pictures that
where uploaded the week before. And show that one on the whole week long. Next
week again there will be taken a random picture from all pictures uploaded the
week before. But, when there are no pictures uploaded that week before.. I
want to show just a random picture from all pictures ever uploaded. What I can
do: create a forum that will upload a picture, and store it in a folder ( and
the date and path in my database) But I just can?t make a script that will
cycle a screen shot every week, as I explained above. If there is someone who
can help me some way, that would be awesome!


Reply With Quote
  #2  
Old   
Mark
 
Posts: n/a

Default Re: PHP screenshot of the week - 11-26-2004 , 10:20 AM






I did something similar for quotes. Here's the code

<?php
mysql_select_db($database_mydata, $mydata);
$query_Recordset1 = "SELECT * FROM oc_quote ORDER BY qu_company ASC"; // you
need to add to this bit to select by date range
$Recordset1 = mysql_query($query_Recordset1, $mydata) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php
mysql_data_seek($Recordset1, rand(0, ($totalRows_Recordset1 - 1) )); // this
bit gets a random record
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
?>





"rG]Courage-D-" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
This is very!!! Very hard!! I think it is hard to understand because 1:
my
English is very bad. And 2: what I want is very complicated Ok, I want to
make
a ?screenshot of the week? on my website. Allowing people to upload there
screen shot, and then store the path and upload date in my phpmysql table
(that
is easy) Now let?s say there are 10 peoples will upload a picture this
week,
then I want next week to take a random picture, out of all 10 pictures
that
where uploaded the week before. And show that one on the whole week long.
Next
week again there will be taken a random picture from all pictures uploaded
the
week before. But, when there are no pictures uploaded that week before..
I
want to show just a random picture from all pictures ever uploaded. What
I can
do: create a forum that will upload a picture, and store it in a folder
( and
the date and path in my database) But I just can?t make a script that
will
cycle a screen shot every week, as I explained above. If there is someone
who
can help me some way, that would be awesome!




Reply With Quote
  #3  
Old   
rG]Courage-D-
 
Posts: n/a

Default Re: PHP screenshot of the week - 11-26-2004 , 11:11 AM



heej, thanks a lot, now how can i make it select all images that where post last week?

(date is stored as: 0000-00-00 00:00:00 witch is: year:month: day houre:minute:sec)

Reply With Quote
  #4  
Old   
Mark
 
Posts: n/a

Default Re: PHP screenshot of the week - 11-26-2004 , 12:03 PM



If you wanted it from the beginning of last century to as far forward as
MySQL can handle it's

19000101000000 to 20371231235959

You need to adapt that. To automate it get the server date, subtract 7 days
then do your SQL range compare.

"rG]Courage-D-" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
heej, thanks a lot, now how can i make it select all images that where
post last week?

(date is stored as: 0000-00-00 00:00:00 witch is: year:month: day
houre:minute:sec)




Reply With Quote
  #5  
Old   
Gary White
 
Posts: n/a

Default Re: PHP screenshot of the week - 11-26-2004 , 01:02 PM



rG]Courage-D- wrote:

Quote:
heej, thanks a lot, now how can i make it select all images that where
post last week?

(date is stored as: 0000-00-00 00:00:00 witch is: year:month: day
houre:minute:sec)

Perhaps something like this untested example:

SELECT * FROM mytable WHERE YEARWEEK(col)=YEARWEEK(NOW()-1)

Where "col" is the column name of the field that holds your date.


Gary


Reply With Quote
  #6  
Old   
rG]Courage-D-
 
Posts: n/a

Default Re: PHP screenshot of the week - 11-26-2004 , 01:07 PM



oh sorry, i don't understand (still a bit of a noob i am )

$query_Recordset1 = 'SELECT * FROM screenshots';

how can i make it select only the screen shots that where uploaded the week before?

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.