SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    ********* Addict
    Join Date
    Feb 2000
    Location
    NE FL, USA
    Posts
    301
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need a cron to set values

    I need a cron to set values of one row of a table to 0. Here's what I'm trying to use right now:
    Code:
    #!/usr/local/bin/php
    <?php
    	 define('IN_PHPBB', true);
    	 $phpbb_root_path = '/home/america1/public_html/forum/';
    	 include_once($phpbb_root_path . 'config.php');
      $sql = 'Update phpbb_album_rate SET rate_user_ip=0';
      
    ?>
    I'm trying to get the cron to clear out the IP values so that my guests at http://www.americanmotorcycleclub.co...t.php?cat_id=1 can vote once per day with me having to manually set the all of the values in the table row to 0.

    Any help please?
    Brain Bucket Magazine - Biker News, Views, and Event Coverage.

  2. #2
    SitePoint Guru
    Join Date
    Jul 2005
    Location
    Orlando
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure what's in the config file. if it doesn't contact to the database then you must do that manually.

    If it does, then you must take the $sql and run it through the mysql_query() function.

    Without knowing the database table structure I can't help you to tell if the query would work or not.

  3. #3
    ********* Addict
    Join Date
    Feb 2000
    Location
    NE FL, USA
    Posts
    301
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm sorry. I'm using phpBB with Smartor's Album add on. The config file connects. Here's the table structure:

    --
    -- Table structure for table `phpbb_album_rate`
    --
    CREATE TABLE `phpbb_album_rate` (
    `rate_pic_id` int(11) unsigned NOT NULL default '0',
    `rate_user_id` mediumint(8) NOT NULL default '0',
    `rate_user_ip` char(8) NOT NULL default '0',
    `rate_point` tinyint(3) unsigned NOT NULL default '0',
    KEY `rate_pic_id` (`rate_pic_id`),
    KEY `rate_user_id` (`rate_user_id`),
    KEY `rate_user_ip` (`rate_user_ip`),
    KEY `rate_point` (`rate_point`)
    ) TYPE=MyISAM;
    Brain Bucket Magazine - Biker News, Views, and Event Coverage.

  4. #4
    SitePoint Guru
    Join Date
    Jul 2005
    Location
    Orlando
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And I assume rate_user_ip has a value of 0 when they can vote?

    What happens if you just add mysql_query( $sql ) to the bottom of your script?

  5. #5
    ********* Addict
    Join Date
    Feb 2000
    Location
    NE FL, USA
    Posts
    301
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Warning: mysql_query(): Access denied for user: 'america1@localhost' (Using password: NO) in /home/america1/public_html/forum/album_mod/album_cron.php on line 9

    Warning: mysql_query(): A link to the server could not be established in /home/america1/public_html/forum/album_mod/album_cron.php on line 9

    I guess I need to connect in this code. How would I do that?
    Brain Bucket Magazine - Biker News, Views, and Event Coverage.

  6. #6
    SitePoint Guru
    Join Date
    Jul 2005
    Location
    Orlando
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  7. #7
    ********* Addict
    Join Date
    Feb 2000
    Location
    NE FL, USA
    Posts
    301
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're the tizzle. Thank you! Thank you so much!
    Brain Bucket Magazine - Biker News, Views, and Event Coverage.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •