473,701 Members | 2,450 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why is my script not updating my db table ?

290 Contributor
Hi,
I am trying to run my simple analysis script on an existing database table that I have.

I have increased my php time out to 5 minutes and the same with
my apache server config file - 300 seconds, so should be plenty of time.

My script is below.
If there is any way I can speed it up, that would be useful to know ;-)

The echo in the script, only display after about 5 minutes of waiting
even though I have exited after only processing 300 records !

Here is the last few lines of the output:


299 ) Processing Clickbankid: CANDOCO1
Written new row in cb_main: CANDOCO1, Business to Business, A+ Teachers' Interview Edge.
Written new row in cb_data: CANDOCO1, 0, 1.08
300 ) Processing Clickbankid: PDFPRO2
Written new row in cb_main: PDFPRO2, Business to Business, Create, View, Write And Print PDF.
Written new row in cb_data: PDFPRO2, 0, 2.36

This is my script:


Expand|Select|Wrap|Line Numbers
  1. while($row = mysql_fetch_assoc($result)){
  2.     $the_id = $row['id'];
  3.  
  4. echo "<br>$ctr ) Processing Clickbankid: $the_id";         
  5.  
  6.     $sql_main = "SELECT Mid FROM cb_main WHERE Mid = '$the_id' ";
  7.     $result_main = mysql_query($sql_main)
  8.                     or die("could not FIND ID in cb_main.". mysql_error()); 
  9.  
  10.     $num = mysql_num_rows($result_main);
  11.  
  12.     if ($num == 0 ) {     // If the product is NEW
  13.     extract($row);
  14.        $sql_ins = "INSERT INTO cb_main
  15.     (Mcb_date, Mday_no, Mid, Mcat, Mpop, Mtitle, Mdescrip, Mrecurr, Mgrav, Mearn, Mpercent, Mtotearn, Mrebill, Mrefer, Mcomm, Mthis_ave, Mlast_ave)
  16.     VALUES 
  17.     ('$cb_date', '$day_no', '$id', '$cat', '$pop', '$title', '$descrip', '$recurr', '$grav', '$earn', '$percent', '$totearn', '$rebill', '$refer', '$comm','$grav','$grav' )";
  18.  
  19.     $result_ins = mysql_query($sql) or die("could not execute INSERT to cb_main.". mysql_error());           
  20.  
  21. echo "<br>Written new row in cb_main: $id, $cat, $title";         
  22.  
  23.        $sql_ins = "INSERT INTO cb_data
  24.     (cb_date, day_no,id, pop, grav, rebill, this_ave, last_ave)
  25.     VALUES 
  26.      ('$cb_date', '$day_no', '$id', '$pop', '$grav', '$rebill', '$grav','$grav' )";
  27.  
  28.     $result_ins = mysql_query($sql) or die("could not execute INSERT to cb_data.". mysql_error());           
  29.  
  30. echo "<br>Written new row in cb_data: $id, $day_no, $grav";         
  31.  
  32.     }
  33. $ctr++; 
  34. if ( $ctr > 300 ) exit;
  35. } // end while
  36. echo "<br>Finished";
  37. ?> 
  38.  
Pretty basic script, but it does NOT update the two tables.

When I check their contents - there is zero rows :(

Can anyone see what I did wrong ?
Jan 1 '10 #1
0 1251

Sign in to post your reply or Sign up for a free account.

Similar topics

1
7592
by: Matik | last post by:
Hello, I need to change collation in my database (more databases acctualy). Therefore, I wanted to make a script, which will do it at one more time. I already have a cursor, updating collation on all tables (fields) in database. The problem is, before I will to update the collations, I need to drop all constrains and pk's.
7
7610
by: Dr. Know | last post by:
I am working on an ASP page that writes to several databases, ranging from MDBs to x-base. One of the tasks involves using an existing highest value from the DB and incrementing it before inserting a new record. I am using Application.Lock and .Unlock together with an application variable to negotiate access to the DB routine to one session (user) at a time. This is to ensure that the ID numbers are cleanly incremented, and that no...
10
2042
by: Nimit | last post by:
Hi, I wasn't sure which forum this post belongs to, so I've posted it to a couple forums that I thought may be appropriate. In giving me advice, please consider me a beginner. Below is a synopsis of my problem/question: SOME BACKGROUND: - I am writing a php based web application. - There is a very data intensive task I need to do that requires reading and lookup of a lot of data.
10
2557
by: shumaker | last post by:
I don't need a detailed description of a solution(although I wouldn't mind), but I am hoping someone could tell me in general the best path to go about accomplishing a task, since I don't know all the capabilities of what I have available. I can learn the details myself I think. I am trying to set this up to be as simple to use as possible since others will be importing data on a weekly or daily basis. I need to import some text files,...
10
5670
by: jaYPee | last post by:
does anyone experienced slowness when updating a dataset using AcceptChanges? when calling this code it takes many seconds to update the database SqlDataAdapter1.Update(DsStudentCourse1) DsStudentCourse1.AcceptChanges() i'm also wondering because w/ out AcceptChanges the data is still save into the database and it is now faster.
4
2372
by: Geoff | last post by:
Hi I'm hoping somebody can help me with the following problem that has occurred to me. Suppose I have two tables in an SQL Server database. Let's call these tables A and B. Assume that A has two fields: a primary key and another holding a string. In table B there are three fields: a primary key, a foreign key (which links to the primary key in A) and other field holding a string.
5
11363
by: BF | last post by:
Hi, I have a problem: I am writing an update script for a database and want to check for the version and Goto the wright update script. So I read the version from a table and if it match I want to "Goto Versionxxx" Where Versionxxx: is set in the script with the right update script.
7
4200
by: Jaros³aw Kozik | last post by:
how to create script - update database development code using MSSQL 2000 Enterprise Manager i'm trying in this way all tasks -genetate sql script .... ( in this way I can generate only CREATE Database SCRIPT ... )
0
8649
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9083
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8975
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8934
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6569
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4410
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3102
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.