Closed Thread
Results 1 to 5 of 5

Thread: Problem in fetching rows from mysql in php?

  1. #1
    shikha985 is offline Newbie
    Join Date
    Mar 2010
    Posts
    1
    Rep Power
    0

    Problem in fetching rows from mysql in php?

    I tried:
    I inserted a row in mysql using php in the first webpage and second webpage i tried to retrieve it.
    I got:
    But in the next page i did not get the lastely inserted row.
    When inserted the another row, i was able to get the first inserted row and not the lastest row.

    So every time i miss the last inserted row the first time and when then i was able to get it as soon as i insert another row.

    How to solve this issue? Is it something related to commit i am missing here?
    Last edited by Orjan; 03-09-2010 at 01:25 AM. Reason: Removed spam

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: Problem in fetching rows from mysql in php?

    What is your table structure? Do you have an indicator of when something was added?
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  4. #3
    joyo is offline Newbie
    Join Date
    Feb 2010
    Posts
    17
    Rep Power
    0

    Re: Problem in fetching rows from mysql in php?

    I also don't know this problem , I want to know the reason too.

  5. #4
    abdul.gafur's Avatar
    abdul.gafur is offline Learning Programmer
    Join Date
    Mar 2010
    Location
    Salo, Riau, Indonesia
    Posts
    42
    Rep Power
    0

    Re: Problem in fetching rows from mysql in php?

    if you use a primary key that auto increment, you can get the last row with
    "select * from yourtable order by yourid desc"

  6. #5
    joyo is offline Newbie
    Join Date
    Feb 2010
    Posts
    17
    Rep Power
    0

    Re: Problem in fetching rows from mysql in php?

    Quote Originally Posted by abdul.gafur View Post
    if you use a primary key that auto increment, you can get the last row with
    "select * from yourtable order by yourid desc"
    good, also you can append " LIMIT 1" to the sql script , it would imporve the Execution efficiency.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to fix MySQL Count Rows?
    By Hunter100 in forum Database & Database Programming
    Replies: 3
    Last Post: 10-20-2011, 02:46 PM
  2. [SOLVED] Combining multiple rows to one row in MySQL
    By Metalhead in forum Database & Database Programming
    Replies: 1
    Last Post: 01-22-2011, 03:28 AM
  3. counting the number of rows in a mysql database
    By welton122 in forum PHP Development
    Replies: 6
    Last Post: 01-08-2011, 04:34 AM
  4. Replies: 11
    Last Post: 12-15-2010, 05:11 PM
  5. mySQL Rows in PHP
    By Affix in forum PHP Tutorials
    Replies: 0
    Last Post: 02-16-2009, 11:34 PM

Tags for this Thread

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