Delete Query Takes HOURS
why on EARTH would this query: Code:
DELETE FROM `test_zip_assoc` WHERE id > 100000
take an entire day when there are 10 million records in this database:
Code:
+--------------+------------------+------+-----+---------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+------------------+------+-----+---------------+----------------+
| id | int(12) unsigned | | PRI | NULL | auto_increment |
| f_id | int(12) unsigned | | | 0 | |
| zip | varchar(5) | | | | |
| lat_radians | decimal(12,11) | | MUL | 0.00000000000 | |
| long_radians | decimal(12,11) | | MUL | 0.00000000000 | |
+--------------+------------------+------+-----+---------------+----------------+
View Complete Forum Thread with Replies
Related Forum Messages:
Auto Delete Record/Send Email After X Hours
What I have is a MySQL database which stores records that each have a date stamp on them (2 of them - one for record created date and one for record last updated date), what I want to do is try and have it so that records that haven't been updated in say 72 hours are automatically removed from the database, or the record is updated to set a flag as being out of date, or an email is sent to alert a user of the out of date record etc. I can easily write the script with the SQL query to check the records by the datestamp and perform the actions needed if the records are out of date, however that requires someone to physically visit that page to run the script and clean up the out dated records. What I want to try and do is have this happen automatically on its own without someone needing to actually visit the page to run the script. A good example is on eBay how emails are sent to you to let you know when your auctions are about to expire, i wouldnt imagine that eBay would rely on people visiting their website to make those queries run on the database so there must be a way of doing some automated script executio or having a scheduled task run on the server to have a PHP script run each day at midnight or something? Anyone know how to do this?
View Replies !
Query Takes 30-40 Seconds To Return The Results.
I operate a small nich search engine with about 22,200 pages indexed. When I go to do a query, it takes sometimes 30-40 seconds to return the results. Then if I do another query, it returns results in 1-2 seconds and the same for every query after that. But if I let it go 15 minutes without any activity, it'll go to lagging on the next query. My webhost says it's me, but if I try to login to my cPanel when the query is lagging, the login lags also and then the second I get logged in, the query returns results.
View Replies !
Query Based On Last 24 Hours
i have tried googling for the syntax to run a query that can count the amount of new entries into a database based on todays date. I have a field in my database called sign_up_date which is of type datetime and has a default of 00-00-0000 00:00:00 $query = "SELECT COUNT(id) FROM users WHERE signup_date=........... ?
View Replies !
Mysql Delete - $query = Mysql_query("DELETE
how would i do the following ? $query = mysql_query("DELETE notes, datestamp, abs_value, ID FROM absence_mgt WHERE datestamp='$date' AND ID='$vtc_login' ") or die(mysql_error()); im just getting "Unknown table 'notes' in MULTI DELETE" ?
View Replies !
Find Difference In Hours- Edit Code From Days To Hours?
I'm trying to find the difference in hours between one date from another, and my code currently finds the difference in days- could somebody edit the code to use hours instead of days? $expirationdate[0] = $row3[datetillcompletion]; $startdate[0] = date('Y-m-d'); $startdate = strtotime($startdate[0]); $expirationdate = strtotime($expirationdate[0]); $delta = $expirationdate - $startdate; $final=round($delta/86400);
View Replies !
Delete Query
Here’s what I’m trying to do: - Output the last 60 results in my db - works - Delete a record – does not work Can anyone see why my delete query won’t work? It seems to have two problems: 1) It does not delete a record 2) The header re-direct says can’t modify header information Code:
View Replies !
Delete Query Successful
How can I test whether a delete query on any other query for that matter has been successful deleting a record. I tried below but it does'nt return if the query deleted a record. $deletequery= "DELETE FROM details WHERE id='$line[id]' AND orderid='$orderid' AND location='".LOCATION."'"; mysql_query($deletequery) or die(ErrorDB($realname)) ; $message = (!$deletequery) ? 'ERROR' : "<font color='#FF0000'>DONE</font>"; echo "$message<br>";
View Replies !
Mysql Query : Delete From *
When I use phpmyadmin, and run this sql query, it will tell me that it affected X amount of rows (lets say 10). However, when i run my script, it doesnt' tell me that. Code:
View Replies !
Simple Delete Query
This code should delete a row from the database where ID = ID however it doesn't seem to be doing its job PHP Code: <? if(isset($_GET['id'])) { Â Â Â Â Â Â Â Â $query = "DELETE FROM mynews WHERE id = '" . $_GET['id'] . "'"; Â Â Â Â mysql_query($query); Â Â Â Â echo "<p align='center'>Deleted</p>"; Â Â Â Â } else { Â Â Â Â Â echo "<p align='center'>Not Deleted</p>"; } ?>
View Replies !
Dates 23.00 Hours To 0.00 Hours.
I have the following code $day1 = mktime (0,0,0,1,1,$year); $days = ($week - 1) * 7; $d = strtotime ("+$days days", $day1); $dow = date('w', $d); $sunday = strtotime ("-$dow days", $d); $saturday = strtotime ("+6 days", $sunday); to give me the timestamp on sunday and saturday for a given week and year. The problem I have is that it's giving it at 23.00 hours when i need it at 0.00 hours. 1179010800 translates to Saturday, May 12th 2007, 23:00:00 (GMT) Can anyone see the problem?
View Replies !
Delete Query Not Working As Expected
I have 2 different php forms. One makes sure that a user has chosen an unique user name (below): $query_rsApp = "SELECT * FROM users where UserName=".$Registered." "; This Select query works right every time (as far as I can tell). I have a form that I want to use to delete user records. This Delete query works fine if the username and password are both numeric... But if the username or password is text, it returns the error "UNKNOWN FIELD 'whatever'" where whatever is my search criteria that I am trying to use.
View Replies !
Delete Query - Error In Your SQL Syntax; Check The Manual That Corresponds To Your MySQL Server
I have tried to make a delete query but it won't work it gives me a syntax error but I'm unsure where i have gone wrong.... this is what i have got at the moment: Quote$Deletesoldhouses = "DELETE * FROM soldhouses WHERE SoldHouseID = '$HouseID'"; mysql_query($Deletesoldhouses) or die(mysql_error()); Can any one see what i did wrong? Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM soldhouses WHERE SoldHouseID = '1'' at line 1
View Replies !
Mysql_data_seek Takes...0.15 Seconds
On my testing machine (P4 2ghz, WinXP, Apache, PHP 4, mysql 4.1), when I do a mysql_data_seek it takes up to 0.15 seconds. My query that returns all results takes an average of 0.05 seconds on my machine. The mysql_data_seek on this query result takes 0.15. How it is possible ? It's there any bug ? I know my ISP is much faster, and I can't compare with my computer, but this let me thing that I should better execute a query for the desired records instead of doing a data_seek. They are about 170 records in the result, taken from 20 tables of an average of 10 fields each, with around 3000 records in each table. I do show only 10 results on my page, and when I do click on next or previous page, I then "seek" the 10 next records. Also I've 2 possibilites to improve performances: 1: Execute 2 queries: one that count the result's ID and an the same wich returns the result of 10 records 2: Execute the complete query and count from there. Also use seek to show the correct results. for now I use the second choice, but performances are very poor. Since I can't pass the query result from a page to another, at any time I change the page, I 've to execute the query again....
View Replies !
Script Takes A Few Minutes To Run
I'm running a script that takes a few minutes to run. I set the max execution time in php.ini to 3600 seconds but the script still crashes after 8-17 minutes, saying "page cannot be found". I tried running it on 2 different machines more than once on each. What can I change to keep it from crashing?
View Replies !
Session_start() Takes 10-25 Seconds
I'm running a php/mysql database application that stores a database description structure in a session variable. The database schema is on the large side, so this structure can probably be as big as 500kb. Recently, I've begun having a problem where on some pages, the session_start() function call takes a really long time to return, as long as 25 seconds. This happens in both a single-user and multi-user environment, but it is inconsistent - on some pages it happens every second or third reload, on some pages it doesn't happen at all. I'm not sure that its related to the size of my structure in a session variable, because the structure has been this big for a long time, but the session_start() problem is relatively new. Does anyone have any suggestions for why this could be taking so long? Is it a bad idea to store a 500kb structure in a session variable?
View Replies !
Script Takes 99% Of Resources
the front page of my site is not dynamic. I have it so when I'm done updating, I click on a link to activate a script that prints the results in a php file. This is then included on my index when someone eneter my site. The index page loads superfast and I love it. The problem I have is that when run the update script, it takes 25-30 seconds to run and no one can access the site during that time (97-98-99% CPU usage). Needless to say, that is too long and I lose people who don't like to wait as the browser hangs. I do this about 4-10 times a day so it ads up. I don't know if I'm losing the visitor will make me $100 or just waste bandwidth :), but I rather not lose anyone. I have talked to the programmer, paid extra and he tried 3 times already, but it's still too resource intensive. The DB schema, and several sorting options might be to blame.
View Replies !
Delete Record - When The Delete Link Is Clicked The Next Page Is Blank And Nothing Is Deleted.
This is my "delete.php" and this "todo/delete.php?id=64" an example of a link to it generated from the index.php page. When the delete link is clicked the next page is blank and nothing is deleted. What have I done wrong? <? include("dbinfo.inc.php"); mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $id="delete from todo where id='$id'"; mysql_query($id); mysql_close(); ?>
View Replies !
Mail() Function Takes To Long.
I wrote a simple mail script, when executed it sends a mail to a specified address. It works fine except for the fact that it takes around 45secs to complete. I'm on a 10mbit LAN, and it shoudn't take that long at all. The mail server is on the same subnet as I am. Does anyone know of a solution to speed up the mail()ing process ? I've looked into maybe a DNS problem, but I don't see anything wrong. One thing I noticed, when the box is booting up through the INIT scripts, sendmail sits there for about a minute. I know the problem has to be with sendmail, just don't know what. The Box: Slackware Linux mail() using sendmail as the MTA. One more thing, in the php.ini file you can specify an smtp server, but why does it say windows only ?
View Replies !
Gzipped Page Takes 15 Mins?
We are compressing dynamic webpages with ob_start("ob_gzhandler"); This works most of the time but some times some clients try and load a page and it takes 15 minutes to load. The request was served its like it just sits for 15 mins trying to parse it on the clients end. Its on different pages for different clients and there doesnt really seem to be a connection. I know proxy servers can screw it up possibly but wouldnt it do it for all pages and why would it still pull up after 15 mins.
View Replies !
ImageMagick Takes Forever Thumbing
I have created a dynamic image viewer akin to mapquest for viewing images. This code depends on ImageMagick. Basically, I am resizing and cropping JPG source images (about 2.5 Megs a piece) into manageable 600x600 pixel JPGS. My problem? The images take FOREVER to load, and sometimes they simply do not load whatsoever. I am running IE and the status bar reads "Downloading Picture URL" There is nothing wrong with the way I am converting the image, as I can type the exact same line in the command prompt without a problem. There is nothing wrong with the PHP code as far as I can tell, I turned on error_reporting (E_ALL); and dont get anything helpful.
View Replies !
Takes The Rating And Displays A Corresponding Image.
I'm making a site where people can make posts which are then rated 1-5. I want to write a php code that takes the rating and displays a corresponding image. I have written this: function ratingImage($overallrating) { if ($overallrating == 0){ echo "<img src="images atingzero.jpg">"; } elseif ($overallrating == 1){ echo "<img src="images atingone.jpg">"; } elseif ($overallrating == 2){ echo "<img src="images atingtwo.jpg">"; } elseif ($overallrating == 3){ echo "<img src="images atingthree.jpg">"; } elseif ($overallrating == 4){ echo "<img src="images atingfour.jpg">"; } elseif ($overallrating == 5){ echo "<img src="images atingfive.jpg">"; }} echo ratingImage($overallrating); This codes works perfectly in safari, but when I view the page in firefox or netscape navigator, the images do not appear. Can anyone think of why this code would not work in these two browsers?
View Replies !
One Forum That Takes Threads From Other Forums
I am looking to create a site that takes threads from a few other forums and displays them on my 'forum'. The responses, login, auth, creditials, etc... dont need to be handeled by my site, I just want to display some threads with links to the actual site where the thread was created. Code:
View Replies !
Create A Cookie That Takes Its Name/value From A Form?
i'm learning PHP at the moment and i'm having a bit of trouble with cookies. I know how to create a single cookie with a set name, but how do I create a cookie that takes its name/value from a form? The form itself is in a loop that spits out info from a database, and the form name also is taken from the database as it loops through. I was trying to use the Post method but it didn't work so obviously this isn't the way to do it.
View Replies !
_SELF Takes Me To Unauthorised Page
I am have cobbled together with help from your forums a MYSQL database of students at school. We want to use a web interface to issue merits to students - it works, except for the final page, where the teacher must check merits issued and delete errors. On my local machine (laptop) the code works using Apache server. On the Win2000 server, I'm running PHP over IIS. Code:
View Replies !
Session Timeout Takes 2 Clicks
I have read the other articles here related to session timeouts, but this seems weird to me: My session timeouts dont redirect to the login page until the user clicks the second time. Basically it seems like: after the session expires the first page the user goes to does not realize the session has actually expired. I have set my php ini file session.gc_probability to 100% (for testing) and everything else should be default settings.
View Replies !
Joomla CMS Takes More System Resource, Is It True ?
i am an engineering student form Indian ,recently i attended one project contest(fossconf) there i came to know that joomla cms is not recommended to use for creating a web application that reads citizens detail and stores in database , because it take some system resource like CPU and other stuffs, is it true ?...
View Replies !
Header Shows Takes Couple Seconds
I have a website in php. It has a header.php, footer.php and then the content pages. When the each page loads the header shows up quickly but then it takes couple seconds (sometimes even 10 sec) until the page loads.
View Replies !
Baffling! Redirects With Header() Takes Minutes To Respond.
Something odd is happening. Scripts on several sites that collect form data, save it to a DB, then redirect the user to another page are slowing to a crawl during the redirect using the header() function. For example: header("Location:member.php"). I tried changing the header() command in a few ways: header("Location:/member.php"), header("Location:./member.php"), header("Location:http://www.site.com/member.php"). But none of these made any difference. I then discovered that if I put "exit;" after the header() function, there's no more delay and the redirect is instantaneous again. What's odd is that these pages worked just fine without the exit command until recently. I've made no changes to those scripts, or to PHP, so, I can't figure out why this all of a sudden started happening. Has anyone else noticed this? Is putting an "exit;" right after a header() now required in PHP? Because I never had to do this before and it always worked fine. Using PHP 4.3.2 on Linux Red Hat ES 3.0 server. Tested this in Safari, Firefox and MS IE, with the same (slow) redirect results (until "exit;" was added).
View Replies !
Create A Form That Takes A Number That The User Enters
I need to create a form that takes a number that the user enters, and duplicates a question the number of times the user entered. For instance, if the customer enters 5 on the first page, when they press next the form generates "How old are you?" 5 times on the page. The customer will answer all 5 questions then press next. Finally, all the local variables get dynamically created and written to a database. I have already taken care of dynamically creating the question five times. Using a simple WHILE clause, this generates the correct number of questions. What I am having an issue with at this point, is how to dynamically create the local variables.For instance, for the question "How old are you?" I would need a unique variable for each instance; using something like $Age(n). So that for five times, it would automatically created variables $Age1 through $Age5. I have carried over the number to the submit page by creating the variable $Number and passing it along as hidden button on the form. $Age'$Number' seemed to work for creating the variable, but $_post["Age'$Number'"] doesn't work for referencing the global variable. I would need some way of looping through and dynamically creating the variables.
View Replies !
Create A Website That Takes Reservations For Different Events Each Year
I am trying to create a website that takes reservations for different events each year. I have set up my sql tables and am trying to query and insert data into them. I found some helpful tutorials on php classes and so opted for that route to help keep my code tidy. My problem is that I am not sure how to access some of the data once i have retrieved it from my DB. Code:
View Replies !
Checkboxes - Loop That Takes The Values And Processes And Writes The Changes To The Database.
I generate a form page from my MySQL database. let's say the table structure is: Table A > ID, title, active the number of rows generated by the query is dynamic. If a field's value is 1, then the form output appears as <input type=checkbox name=$ID checked> $title and if not <input type=checkbox name=$ID> $title At the bottom of the form there is a submit button. The visitor can check/uncheck rows and then submit the form. I need to write a loop (possibly foreach) that takes the values and processes them and writes the changes to the database.
View Replies !
Function That Takes In A Variable Number Of Parameters And Processing It Using Func_get_args
When writing a function that takes in a variable number of parameters and processing it using func_get_args or a similar technique, I'm assuming that one is only able to use the pass by value method of parameter passing. Can someone confirm or deny this for me? Below is a trivial example of what I'm talking about. I'm assuming the function below does nothing useful. <?php function squares( ) { $params=function_get_args(); $numparams= func_num_args(); for ($i=0;$i<$numparams;$i++) $params[$i]*=$params[$i]; } ?>
View Replies !
Hours &
I'm selecting from a database a time looks like this: 1170229906. I'm trying to find a way to print the hours & minuted differences between each couple, when I'm using while ($rs=mysql_fetch_assoc($result)) {. For example, if the first time is 1170229906 and the second is 1170240253 - the result should be 2:53.
View Replies !
Add One Day (24 Hours) To A Date From
I'm having some trouble getting a grip on PHP's date handling. I've got my dates stored in a MySQL "datetime" column and I'm wondering, what is the best way to add one day (24 hours) to a date from that column?
View Replies !
Add Hours To A Date
I want to show a date coming from mysql (datetime format) to users, logging on from different timezones. Each user has it's own time:When a user logs on a session is created which hold the the time difference from the servertime e.g. user John has $_SESSION['mytime']=2; which means user John is in a timezone 2 hours later than the server. Now if a servertime gives a datetime value of 2002-20-10 18:15:05 How can I make it display 2 hours later, so it will show 2002-20-10 20:15:05? I know mysql has a Date_add function, but I want to keep my queries as they are already, and keep my datedifferences calculation in my include file. So I am looking for a PHP-coded solution.
View Replies !
Add 16 Hours To Datetime
I have a mysql database table that gets the "datetime" column automatically filled when a user fills in the php form page. $curdate = date("Y-m-d H:i:s"); Trouble is, the database server is in the USA which is 16 hours behind my time. Does anyone know a way to change this so that the 16 hours get added to the datetime?
View Replies !
Allow To Edit Within X Hours
I have data that is inserted into a database, one of the fields is named 'time_stamp' and is a "datetime; 0000-00-00 00:00:00" type. I was wondering how one could make an if statement that will show code (code is just the editing portion of the page) if the 'time_stamp' is less than the 'time_stamp' + 72 hours. Other wise, don't show the code and inform them that they can no longer edit.
View Replies !
Mins To Hours
i have a form when submitted hte php file the data is picked up by uses the timespan function to work out the time between two times given byt the user then it converts it into minutes. no on anouther page i want to be abe to convert it back into hours but when i put /60 after the variable it doesnt work it out correctly instead of the time being 11:59 hours it says 11.983333333333 . so how can i get it to convert back into 11:59?
View Replies !
Date() Being Off By 23 Hours
I have the Unix time stamp "1184616000" which I place into date('F j, Y h:i:s A', 1184616000) and I have tested it on two servers which produce "July 17, 2007 12:00:00 AM" but on some other servers it produces "July 16, 2007 01:00:00 PM". Since it is a pregenerated timestamp the date() output should be identical regardless of where it is executed. I am trying to figure out which is right and which is wrong. Can some people please try this out and let me know what you get?
View Replies !
Convert Hours
I've been trying to figure it out for hours and I'm tired because I know it isn't that difficult. guess it's just late and I can't think right. Anyways, so I have a lot of hours. Let's go with 8786 hours for example. I need to convert that to look like"___ years ____ days ____ hours".
View Replies !
|