2 Mysql Operations Cause Delay?

free web hosting
Open Discussion > CONTRIBUTE > Computers

2 Mysql Operations Cause Delay?

leiaah
I'm doing an Inventory system using PHP and MySQL. It's almost done now but I've been having a problem with this particular code. This is a function that does two things. It updates a table with edited values and then inserts values to another table. It's working fine except that the status bar of my browser indicates that the page (with this function) is still loading when in fact the function has been terminated and it did its job already (I've checked the dbase) and there's no command after calling the function. Could the delay be because I have two mysql operations here? Or is something I missed in the code? I hope this post is understood. wink.gif Thanks.

QUOTE
function edit(){
$id = $_GET['id'];
$PID = $_GET['pid'];
$orig = $_GET['orig'];
$beg_qty = $_GET['beg_qty'];
$supplier = $_GET['supplier'];
$pur_price =$_GET['pur_price'];
$sel_price = $_GET['sel_price'];
$date_pur = $_GET['date_pur'];
$exp = $_GET['exp'];

@ $db = mysql_pconnect('localhost', 'xx', 'xx');
mysql_select_db('avh');

if (!$db)
{
echo 'Error: Could not connect to database. Please try again later.';
exit;
}

$query = "update Item_In_Stock set Date_Purchased='".$date_pur."', Expiration='".$exp."', Beginning_qty=".$beg_qty.",Supplier_ID='".$supplier."' where purchase_ID='".$PID."'";
$result = mysql_query($query) or die(mysql_error());
if($orig!=$sel_price){
$qry = "insert into Item_Price(Purchase_ID,Price,Price_date) values (".$PID.", ".$sel_price.",'".$date."')";
$res = mysql_query($query) or die(mysql_error());
}
}

 

 

 


Reply

Yarrgh
Using mysql operations twice shouldn't do anything to the page loading. It could be the browser not disconnecting from the server? try to use "exit;" at the end of your code. If it doesn't do anything then don't worry about it. At least your code is working.

Just for an example

CODE
<?php

// All of your code

exit; // Halts your code so it doesn't keep doing stuff.

?>

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Similar Topics

Keywords : 2, mysql, operations, delay

  1. Mysql Changing Date Format
    Need a bit of help changi ng the date format in a table (3)
  2. What Is A Blob (mysql)
    and how do i use it (4)
    hey everyone! i just started using mysql so i could integrate it on my site. i'm trying to
    create a comment section and store the data on mysql. i've defined my table having a field type
    of varchar with max value 5000. but when i created it on phpmyadmin on my free hosting account, it
    said that the maximum value for a varchar is just 255. it said that i should use a blob. what is it
    and how can i access the data using php? i've searched from the net and it said that blob is
    used for images and document data. and i also found out that the data stored in a ....
  3. Cheat Sheets
    PHP, MySQL, CSS, RGB Hex Color, mod_rewrite (4)
    here are some cheat sheets for PHP, MySQL, CSS, RGB Hex Color, and mod_rewrite. choose one, choose
    all. /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> can be printed as a
    handy reference guide when you are working with any of the above-mentioned interests. just let it
    reside within your reach in your desk, and you'll save some time looking up things online. makes
    a webmaster's life a little bit easier. /smile.gif' border='0' style='vertical-align:middle'
    alt='smile.gif' /> enjoy! http://www.ilovejackdaniels.com/cheat-sheets/ ....
  4. Delphi 2005 + Mysql
    how to connect mysql with delphi 2005? (2)
    Anyone knows how to connect mysql with delphi 2005? Thanks! /smile.gif' border='0'
    style='vertical-align:middle' alt='smile.gif' /> ....
  5. How Do I Delete Info From Mysql Database Through My Cpanle?
    - help (1)
    I want to delete some info in a MySql database. Can I do that through my cPanle? if not, I need to
    know even through command prompt. Thanks\ nickmealey ....
  6. Running Php/mysql/html Offline
    (11)
    Is there programs or a way to run PHP/CGI/MySQL/HTML and other web programming languages offline? I
    am trying to learn website design, and uploading accumulates a very precious part of my time, and
    being able to run the modified file offline would be a -very- great timesaver. Is there anyway to
    install PHP, MySQL and the other languages to your computer so that you may work on things offline,
    like I said?....

    1. Looking for 2, mysql, operations, delay

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for 2, mysql, operations, delay

*MORE FROM TRAP17.COM*
advertisement



2 Mysql Operations Cause Delay?



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE