SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Mar 2011
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Adding to table and extracting from table

    Hi there,

    If I add to a database MySQL Table on line 20 of the code in the page, then I extract from THE SAME MYSQL table on line 40 (of the same page) will this work?

    Matt.

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    72 Post(s)
    Tagged
    0 Thread(s)
    As long as you execute the query on line 20, then Yes, that record will exist when you query the table on line 40. the database connection is a fluid connection, not a snapshot.

  3. #3
    SitePoint Evangelist
    Join Date
    Mar 2011
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cool - I just wondered whether it might be too quick to expect the data to be available?

    I thought it would take 0.3 seconds to add to database and 0.2 seconds to load/view the page. This would mean the data is not in the table!

    This is for my basket system. There will be about 10-15 fields added to the database. Should they be in the database quick enough to be used in the same page?! Is there a limit?

    Matt.

  4. #4
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    72 Post(s)
    Tagged
    0 Thread(s)
    queries are not asynchronous - PHP will wait for the database server to reply before it continues processing, and the server will only send a reply once it's done doing whatever the query was.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •