PHP/mySQL Running Tasks Automatically?
I have a MySQL DB with all my client details (name, email address etc).
I want to use PHP to retrieve records from the DB and email each of these clients (easy enough) BUT I want the system to automatically do this at pre-defined times.
I have thought about using the UNIX/Linux CRON utility to perhaps call a PHP script that would retrieve specific records (based on a timestamp perhaps?) and then have it email based upon those records.
Does this sound feasible? Are there better ways to do this?
View Complete Forum Thread with Replies
Related Forum Messages:
Running A Script Automatically
I have a script which I need to run automatically.. Literally what it does is add data from one database into the other. Literally between a forum and a e-commerce script. So when they sign up which the forum they are also signed up at the e-commerce site. How would I make it so the script ran automatically every 15 minutes.
View Replies !
PHP/MySQL: Using PHP To Probe MySQL Db And Send An Email Automatically
Let's say you have a login feature on your site... and a user forgets their password which is stored along side their email address in a MySQL database. Is it possible to use PHP to automatically send the password to that email address upon request? If so, please provide a detailed solution. If not, can Java be used in some way to accomplish this?
View Replies !
PHP Tasks
some times i get this error on my script: Internal Server Error i researched very much on why this error happens and i get to: i forgot to close some php tasks in my script. now i know only mysql_close() for closing one of php tasks. what are others php tasks that need to closing?
View Replies !
Automatically Reshuffling The IDs In MySQL?
Everytime I make a new table, I would firstly declare an ID field. (yeah I guess thats the root of the problem.) Take for example, we have 5 entries. If I delete entry 3, then the IDs will still be... 1 2 4 5 instead of getting the favoured 1,2,3,4 How, or what should I do to prevent this? I don't see any default ID fields in MySQL...is there any?
View Replies !
List Into MySQL Automatically?
I want to insert the names of these links into my MySQL database, and assign them an auto-incrementing id number. The auto-increment isn't a problem, I want to know if there is a way to insert the names of these school names, without having to type them in individually which would be a very painstaking process.
View Replies !
How Can I Automate PHP Tasks?
I am currently running the same task multiple times a day and I'm sure there is a way to automate it. It is a simple one, but with limited PHP knowledge I'm not sure of the best way to do this. Here's what I need to do 1) log-in to a 3rd party site 2) Download the CSV 3) Upload to my db
View Replies !
Cron Tasks
I'm building an auction site which needs scripts automatically launched to scan the closing auctions. I'll use Linux's crontab. I'd prefer to avoid installing Php as a cgi and prefer to keep my apache module config. I'd also prefer to avoid the use of a browser as lynx to do this job because I fear the time-out How I can launch my scripts?
View Replies !
Background Tasks
I'm using some weather rss feeds in a web site. The feeds are updated once every hour and cached in a local file. My problem is that every time the weather report is updating I get a long wait (not that long.. 2 or 3 secs) before the page is displayed. This happens becauses the teplate engine that parses the page is waiting for the weather section to be parsed and cached. Is there a ay I can start the weather parsing as a background thread and return immediatly to the template engine to continue to parse the page? And if so How?
View Replies !
Automated Tasks
I have an auction site running. Now I want the auction to be able to automatically send a mail msg to the seller after it expires. How do I do it? Obviously there is some sort of way that I can employ so that this task does not require an operator (such as me) to run manually. This task will involve accessing the database and sending an email. Can somebody enlighten me on this?
View Replies !
Directory Tasks
Im looking to do some work with directories. Basically, there are some directories which I want my website users to access fully, and see all the files in there. My server allows index of directories automatically, where users can see all the files in the directory (unless there is an index page). Code:
View Replies !
Automatically Add Unique Id To Existing Mysql Db
I am working on a MySQL db (+/- 18000 items) which was converted from FoxPro. But is doesn't have a unique id-field and I was wondering how to add such a field and the incremented numbers in it automatically, without having to enter 18000 unique numbers.
View Replies !
Automatically Upload A MySql Tabel
I have a non-profit group that wants to upload water quality testing stats on a nightly basis to the web server database. Currently, the info is sampled by sensors in a pond, then transmitted to their local server (probably Windows type). They then want the info converted to MySql, then automatically get transported in the the web server database on a nightly basis. Now, all the up font stuff is no problem, but I have not gotten in to CRON jobs yet, and wonder if a php routine can be built that would upload the MySql table automatically every night. I have seen them for just the opposite (downloading table info), but not uploading.
View Replies !
Using PHP For Nightly Backend Tasks?
I have to develop a script to be run nightly to go through a database and send emails based on conditions. It's a large database, and there are several thousands of emails to be sent during the week everyday. The script will be run with a cron job at midnight or so. I was wondering if PHP is suitable for this, or may it be problematic, for instance would its execution abort after a certain amount of time? Or is it perfectly fine for this task?
View Replies !
How To Schedule Tasks On Website.
I am trying to figure out how to schedule tasks on my website. For example, PAGE1 should perform a different task in the morning than in the afternoon. And at the end of the day, I have to extract some data from the database and put them into a file. This should be done automatically.
View Replies !
Script In Windows Tasks
I would like to know how do i work with php in windows tasks. i developed a php web application and i would like to recieve to my email every day a certain report which will be produced by a php script.
View Replies !
Cron/scheduled Tasks
Im running my site on a web server, and want to add something so that every hour the variable $gold = $gold*($workers*3.1) +($banks*30); and the way to do this is cron jobs from what ive gathered from searching google. BUT not only haven't i found a good tutorial, but I haven't found a single example taht isn't with CGI or a download.
View Replies !
Break MySQL Records Into CSS Columns Automatically
I'm making a page of links, each assigned a category. There are two tables - "favourites_links" and "favourites_categories". This is how the links currently appear: Category 1 Name Link 1 Link 2 Link 3 Category 2 Name Link 1 Link 2 Link 3 What I want to do is break my page into columns. Basically, set a number of columns (e.g. 3), count the total records, and work out how many records to show per column. Each column should be enclosed in a <div class="column"> wrapper, which floats to the left. Code:
View Replies !
List Box - Automatically Load From A Mysql Table
i have a form with a drop down menu on it where the user can select a team from a list. how do i get this list to be automatically on page load from a mysql table called teams on the page load? I have tried several things before but i always seem to get the php code just appearing on the page rather than going off and processing the code. and i have used the <?php ?> tags.
View Replies !
No Mysql When Running Phpinfo.PHP?
I am a newbie and was just getting started working on a guestbook tutorial when I got an error message upon running my PHP code: Fatal error: Call to undefined function mysql_connect() in C:Program FilesApache GroupApache2htdocsadd.php on line 6 So I searched the web for hours trying stuff to no avail. I think something needs to be copied/pasted from a directory to another or something needs to be enabled in php.INI. But what? When I run localhost/phpinfo.PHP there is no mention of Mysql, I know it should be in there. I am running Windows XP pro/Apache server/PHP 5/Mysql. Mysql works fine at the prompt, I create, delete tables and databases at will. One more point I do have the libMySQL.dll in C:WINDOWSSYSTEM32.
View Replies !
How To Check If Mysql Is Running
I have just installed mySQL win32 version and i dont really know how to get the service to run or if it is actually running. is there any php code that will check to see if it is running. if it is running, can someone tell me how i am actually suppose to manage and add new databases etc?
View Replies !
Running Out Of Mysql-connections
I'm having a flash-file (swf) which is requesting info from a PHP-file every ten seconds. The PHP-file connects to a mysql-database, make a short query, and then close the connection, before it returns the info to the swf. Like this: $mysqli = mysqli_connect($dbhost, $dbusername, $dbuserpassword, $default_dbname, $port); //open connection $number = getNumber(); //the function makes a query, and return a number mysqli_close($mysqli); // closing connection echo "&number=$number"; // returns the number to yhe swf The problem is that it seems like the mysqli-connection will not close from time to time. I have a limitation of 1000 connections, which should be enough really. But if I run the flash-file for hours (say 8 hours), the limitation of 1000 OPEN connection is reached, even if I was hoping there should only be ONE open connection at a time.
View Replies !
Can't Get Mysql Monitor Running
I have installed xampp and it seems to be OK. i am now reading a book on php and it tells me to "open the MySQL monitor in a root shell window, or a Command Prompt window on windows systems, then type "show databases" at the mysql>prompt to see all databases".
View Replies !
Mysql Running Slow
I'm a php guy and db system issues are not my thing. My server (linux) is running mysql 4.0.15, and running SLOW, very slow. I did a search for the slow query log file that the docs mention but could not find it. I have started changing the file types to myisam from innoDB. I'm wondering if the system is screwed up becuase the size of ibdata1 (where innodb data is stored) is 1344274432 bytes (about 1.1 GB), but as I convert tables from innodb to myisam (lots of them with lots of data), the file size of ibdata1 is not going down.
View Replies !
Cron Jobs / Tabs / Tasks And More
I'm building a site with a mySQL db behind it. There are going to be a lot of records in it with products. Now i have recently discovered cron jobs, and i thought it would be a good idea to use those to backup the database. i have a few questions: - If i back up the database, does it put the backup in an actual different db, or just in the same db but other tables? (Silly question maybe, but i'm new to this) - Can the DB still be queried bij site-visitors though it's being backed up? - Is it possible to just backup new/updated records instead of the entire db? - Imagine i backup once a month. can the cron job notice if the DB is dameged/ has errors, so it'll stop backing up so it doesn't overwrite the previous backup... or doesn't backup delete the previous backup?
View Replies !
Some Files Created Automatically In Mysql Database Folder
i have created one database in mysql. first i have created all tables are of innodb type then i converted all tables to myisam type. i know that for each myisam type table three files are created tablename.frm tablename.myi and tablename.myd. i have created database before one month. today i checked database and i show somefiles exist in database folder named (1)#sql-644_27.frm (2)#sql-644_1.frm (3)#sql-638_1.MYI (4)#sql-638_1.MYD (5)#sql-638_1.frm (6)#sql-478_5.frm can anyone tell me what is these files and why is these files?
View Replies !
Warning: Invalid Argument Supplied For Foreach() Running On A OS X Machine Running Apache 1.x And PHP 4.x.
The following script was running on a OS X machine running Apache 1.x and PHP 4.x. I just moved the script over to a Linux machine running Apache 2.0.51 and PHP 4.3.8, and now the foreach line does not work. It says Warning: Invalid argument supplied for foreach() in /var/www/localhost/htdocs/warehouse/whse_order_submit.php on line 39 Here is the script: <?php //get the variables from the other page $id=$_POST['id_no']; $sku=$_POST['sku']; $description=$_POST['description']; $order=($_POST['order_qty']); $store=$_POST['store']; $comment=$_POST['comment']; $ip=$REMOTE_ADDR; //check if store is empty if(empty($store)) { die("Store is required. Please press the back button and enter in your store."); } //connect to the database require('../inc/database_conn.php'); //$month=getdate(mon); //$day=getdate(mday); //$year=getdate(year); //$today=$year . "-" . $month . "-" . $day $today=date('Y-m-d'); // create the unique order number $headerqry = "INSERT INTO misc_order_header (order_date, store, comment, ip) VALUES ('$today', '$store', '$comment', '$ip')"; mysql_query($headerqry, $conn) or die(mysql_error()); $order_no=mysql_insert_id(); foreach($order_qty as $id_no => $val) { if($order_qty[$id_no] > 0) { $detailqry = "INSERT INTO misc_order_detail (order_no, id_no, sku, order_qty, order_date, store) VALUES ('$order_no', '$id_no', '$sku', '".$order_qty[$id_no]."', '$today', '$store')"; mysql_query($detailqry, $conn) or die(mysql_error() . "<BR>" . $detailqry); } }
View Replies !
Running Php Included From A Mysql Database
I'd like to include php-code out of a mysql (or odbc) database on a php-page and run that code. Is that possible? I know howto include normal text(&html) from a database to a php-page. But I'd like to work with templates, therefore in need just a little bit php-code in my database. (and included on my pages).
View Replies !
Running Mysql Stored Procedures?
Hi I've a stored procedure on a mysql 5 database and I'm trying to run it. Here's my code $rsDepartment = "CALL sp_Departments_List('fintan');"; $department = new Get_MYSQL_RS(); $department_rslts = $department->MYSQL_LOOP($rsDepartment); print_r($department_rslts); The class just connects to the mysql database & runs mysql_query($rsDepartment) then bangs it into different array types. Here's the error I'm getting Could not run CALL sp_Departments_List('fintan'); query PROCEDURE ucc.sp_Departments_List can't return a result set in the given context I can run the sp using any gui based tool with the same username/password combo. So it can't be a permissions problem.
View Replies !
Anyone Running ISAPI And Mysql Succesfully?
I have the following setup: Windows XP Prof, IIS, PHP5 PHP5 works no problem with either PHP-CGI.EXE and mySQL, PHP5 also works no problem with php5isapi.dll as long as I dont use mySQL. When I use mysql It just gives an error or nothing when I try to execute any mysql function (e.g. mysql_connect). I have put the PHP.INI in C:Windows but no luck. I have also setup the PHPRC variable but no luck. I even put the IniFilePath in the registry as per docs. Every time I reboot. Can anyone tell me the exact steps to get ISAPI to work with mysql in IIS?
View Replies !
Running Multiple MySQL Queries With One Call
I've been trying to figure out how to run multiple MySQL queries with one database call. In phpMyAdmin, I can seperate sever queires with a ";", but mysql_query() doesn't seem to support this. (I get an error when trying to do it). mysql_query("SELECT blah FROM tbl1; SELECT this FROM tbl2 WHERE x = ƈ' INSERT INTO tbl1 VALUES (NULL,something)");
View Replies !
Creat The Table In Mysql By Running The File
How do I make this creat the table in mysql by running the php file. PHP Code: <?php CREATE TABLE `wichita_frgn1`.`Registrations` ( `id` int( 10 ) unsigned NOT NULL auto_increment , `First_Name` text NOT NULL , `Last_Name` text NOT NULL , `Address` text NOT NULL , `City` text NOT NULL , `State` text NOT NULL , `Zip_Code` text NOT NULL , `Home_Phone` text NOT NULL , `Cell_Phone` text NOT NULL , `E_Mail` text NOT NULL , `Membership_No` text NOT NULL , `Roar_No` text NOT NULL , `First_Class` text NOT NULL , `Transmitter_Frequency` text NOT NULL , ........................
View Replies !
Executing PHP Tasks While Letting A User Continue To Browse?
I was wondering if someone could help me out with the following two situations. In a lot of my web apps, it seems that if i launch a PHP script that takes a long time to complete, the user is unable to browse/use the rest of the website until the tasks completes. Is there a way to avoid this? Specifically, app #1 let's a user choose which files to include in a zip file, then PHP makes the .zip file on the server and streams it to the user via fopen/fread. So, as the user is downloading a file on the side (it presents them with the open/save dialog) they are unable to browse the rest of the PHP-based site until the download completes; clicking on any links to pages does nothing, the browser just sits there until the file has been downloaded, THEN the screen advances. I am experiencing a similar thing with a PHP mail delivery system. I tried to create a work-around: a pop-up window that sends an 'exec' command to the a php-script that sends the email to a few hundred recipients. Again, even though this action is being done in a pop-up window (and via the command line, no less), the user is paralyzed in the main window until the action completes.
View Replies !
Sending Mails Without Using Scheduled Tasks (crone Jobs)
Can we set up a mail program that the mail can sent frequently..ie may be daily or weekly or monthly... with out using scheduled tasks or crone jobs. for eg .. can we create a page that works like the scheduled tasks page( there we can set up the time at which time the program will execute )..that means we have options in our webpage to set up the time at which the mail will sent. for eg..every monday.. can we set up this in the program without using scheduled tasks or crone jobs. can we run our page frequently without using crone jobs .
View Replies !
Running PHP/Apache On A User Mode Linux Machine, Where To Stick Mysql?
I hope no one minds me running this past them. I'm running a linux machine with with apache, php and mysql. This is not accessable from the internet. I want a server that is visable to the internet. For that purpose I am running a user mode linux machine and using apache on that as the external looking web server. This means that stuff I want to see on the outside is on a copy of apache that is doing little and does not get messed around with as much as my main copy of apache. I am not using mysql with it at the moment. If I do am I better running mysql on the user mode machine or running a second copy of mysql on a different port on the 'main' machine. I'm beginning to think the latter has advantages.
View Replies !
Form To Update Automatically By Using A Form Processed By Php And MySQL.
I have a page that we are trying to database. Its a trade show page has the list of the shows and the dates of them. well we want the form to update automatically by using a form processed by php and MySQL. So I was wondering if there was a way when entering the data into MySQL through the form that the shows would sort by recent dates to long range dates automatically instead of sorting it when you call the table to view the shows?
View Replies !
Automatically Add Row
i have a section of a form where you enter vehicle expenses for a taxi shift, the way it is set up at the moment is so that there are 20 values in a vehicle expenses array so that you can enter up to 20 different expenses. Is there a way that i can have it so that it only shows one of the 20 arrays and when value1 is filled in it adds a new row below to enter value2 etc...? Code:
View Replies !
PHP Add Crontab Automatically
I need to create an install file, the purpose is that user don't have to go to CPANEL and add CRON JOBS manually. I need one file, that add CRON JOBS automatically without log into CPANEL. Here is my function : function addLynxCron() { $time = time(); //dump crontab list to text file $command1 = "crontab -l > ./tempCronLynx$time.txt &"; exec($command1); chmod ("./tempCronLynx.txt", 0777); $forFile = ""; $url = $_SERVER['SERVER_NAME']; $path = $_SERVER['PHP_SELF']; $cronCommand1 = "lynx -dump */15 * * * * http://$url/cron.php"; $cronCommand2 = "lynx -dump */15 * * * * http://$url/email_cron.php"; $forFile .="$cronCommand1"; $forFile .="$cronCommand2"; $fp2=fopen("./tempCronLynx2$time.txt", "w"); fwrite($fp2, $forFile); fclose($fp2); //create new cron jobs $command1 = "crontab tempCronLynx2$time.txt "; exec($command1); echo "crontab successfully added."; } The function above is not working... when I check the file tempCronLynx2$time.txt is correctly written with the cron jobs I want. But it failed when added the new cron jobs using that files $command1 = "crontab tempCronLynx2$time.txt "; exec($command1); anyone please help with this problems...
View Replies !
Run Program Automatically
I want to create the option for my clients to create their own e-mail address. When I do this in Telnet, I have to run the command 'vadduser' It then asks me for a username, I want to assign this automatically. (1,2,3,4 etc etc) It then asks me for a password, I want this to be something the user has already given in a form (before the script was run). It then has to be retyped. Those two things can be done automatically. It then asks if I want to assign a disk quota (YES) and then asks for the number of megabytes (1) That's it. Are there any examples available of how to do this?
View Replies !
Best Way To Automatically Log Out After Certain Time
What is the best practice for automatically logging out users after certain amount time after the last page request? Is this a php job or a javascript job? It seems that javascript can't be relied on, and that php might have to store something in a database. Perhaps the php version could use a $_session var. I could be reset every page request and compared. But then that wouldn't change the browser display. Maybe a mixture of php and javascript?
View Replies !
Automatically Add Slashes
Is there a function that automatically adds the extra slashes needed for html inside echo statements and such? It's a real pain to go back and edit. There has to be an easier way besides using template systems.
View Replies !
|