toasty Posted June 10, 2007 Share Posted June 10, 2007 I'm attempting to customize a script but so far haven't had any luck. As a possible work around I thought I would create a Cron Job that would automatically upload a new record into a specific table on my MySQL database at night. But I'm not sure how to do this. I was wondering if anyone could provide me with the syntax of: 1) The cron job itself. I of course have to fill in the server/database/table specific information but I don't have any a clue where to start. 2) How should I format the .sql file (or whatever) so that it goes into the database correctly where it's supposed to and doesn't screw anything up? Here are two screen shots showing the structure and browse (from phpMyAdmin) of the specific table in the database I want to edit. If necessary at all here are some details: server: localhost table: comikaze_news I really, super, duper, insanely appreciate it guys! Quote Link to comment https://forums.phpfreaks.com/topic/55019-im-trying-to-create-a-cronjob-to-update-a-database-table/ Share on other sites More sharing options...
fenway Posted June 11, 2007 Share Posted June 11, 2007 I'm not sure exactly what this script is going to do. Quote Link to comment https://forums.phpfreaks.com/topic/55019-im-trying-to-create-a-cronjob-to-update-a-database-table/#findComment-272412 Share on other sites More sharing options...
toasty Posted June 11, 2007 Author Share Posted June 11, 2007 The script itself handles uploading/posting/navigation for a comic and related news post. I'm basically trying to get it to do more then what it was designed for. In this thread I wasn't exactly looking for help on the script (though I'd be happy to have it), instead I'm looking to work around the script by creating a cron job that will insert data into a table of an existing database. I hope that makes some sense. If it helps at all, here's some server info: MySQL: 4.1.20-1.RHEL4.1 PHP: 4.3.9-3.22 Apache: 2.57-centos4.2.build81061129.22 Quote Link to comment https://forums.phpfreaks.com/topic/55019-im-trying-to-create-a-cronjob-to-update-a-database-table/#findComment-272420 Share on other sites More sharing options...
fenway Posted June 11, 2007 Share Posted June 11, 2007 Yeah, but you're asking about insert/update statements.... Quote Link to comment https://forums.phpfreaks.com/topic/55019-im-trying-to-create-a-cronjob-to-update-a-database-table/#findComment-272425 Share on other sites More sharing options...
toasty Posted June 11, 2007 Author Share Posted June 11, 2007 Yeah, but you're asking about insert/update statements.... Ah, okay that sounds familiar! (My php/mysql experience is limited to reverse engineering the scripts that make my site run). So I guess what I'm looking for is what's the syntax I'd use for a cron job to insert/update the tables database? I imagine I'd have to load the applicable data into a file (csv?) and stick it somewhere on the server. Quote Link to comment https://forums.phpfreaks.com/topic/55019-im-trying-to-create-a-cronjob-to-update-a-database-table/#findComment-272429 Share on other sites More sharing options...
bubblegum.anarchy Posted June 11, 2007 Share Posted June 11, 2007 Read the following page: http://www.ss64.com/bash/crontab.html Quote Link to comment https://forums.phpfreaks.com/topic/55019-im-trying-to-create-a-cronjob-to-update-a-database-table/#findComment-272752 Share on other sites More sharing options...
immanuelx2 Posted June 12, 2007 Share Posted June 12, 2007 toasty, you should consider making time_posted a unix timestamp.... that way you can manipulate it and put it in any form you like Quote Link to comment https://forums.phpfreaks.com/topic/55019-im-trying-to-create-a-cronjob-to-update-a-database-table/#findComment-272870 Share on other sites More sharing options...
toasty Posted June 12, 2007 Author Share Posted June 12, 2007 Read the following page: http://www.ss64.com/bash/crontab.html Thanks Bubblegum, I'll take a look at it and see what I can glean from it. It really seems like what I'm trying to accomplish should be easy, but like I said, my experience with coding is limited so it's all new stuff to me. toasty, you should consider making time_posted a unix timestamp.... that way you can manipulate it and put it in any form you like If I knew how to rewrite the code I would. Initially when the script would output the datestamp for the news posts (which is what I'll be importing with the cron job if I can get it to work) it was coded to print out YYYY-MM-DD. It took me forever and a ton of forum posts to figure out how to get it do print it out in the Unix format I wanted. Here's the site that all this coding and customization is going towards. Quote Link to comment https://forums.phpfreaks.com/topic/55019-im-trying-to-create-a-cronjob-to-update-a-database-table/#findComment-272930 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.