Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Program stopped adding new entries at end of db; inserts them out of chrono order

  1. #11
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,723
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    No worries. I wish it were part of the default options, but that does not appear to be the case any longer. For more options when editing a post choose the Go Advanced button on the lower right of the page and there will be more formatting options. Alternately you can put your code in [CODE] [/CODE] tags.

    For information on normalized tables I have found that this is a good place to start:

    http://mikehillyer.com/articles/an-i...normalization/
    To choose the lesser of two evils is still to choose evil. My personal site

  2. The Following User Says Thank You to james438 For This Useful Post:

    Anne Arbor (01-23-2014)

  3. #12
    Join Date
    Jul 2010
    Location
    Near Albany, NY
    Posts
    56
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    Here is the relevant code, including the formatting info. I realize that the mysql queries should be changed to mysqli. And that other aspects of this are probably embarrassing. I really have only a slight grasp of what I am doing much of the time.


    Code:
    		$query = "SELECT * FROM temps WHERE user_idm = $_SESSION[user_id]";
    
    		$result = mysql_query($query) or die(mysql_error());
    
    	echo "<table border='1'>";
    	echo "<tr> <th>Temperature</th> <th>Notes</th> <th>When entered</th></tr>";
    
    		// Print the results, row by row, into a table; using a while loop:
    
    	// Use a while loop, to print the results, row by row:
    
    
    	while ($row = mysql_fetch_array($result )) {
    
    	// Print out the contents of each row into the table
    
    	echo "<tr><td>";
    	echo $row['temp'];
    	echo "</td><td>";
    	echo $row['notes'];
    	echo "</td><td>";
    	echo $row['time_entered2'];
    	echo "</td></tr>";
    }
    
    echo "</table>";

  4. #13
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,723
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    Have you tried changing:
    Code:
    $query = "SELECT * FROM temps WHERE user_idm = $_SESSION[user_id]";
    to
    Code:
    $query = "SELECT * FROM temps WHERE user_idm = $_SESSION[user_id] ORDER by time_entered2";
    To choose the lesser of two evils is still to choose evil. My personal site

  5. The Following User Says Thank You to james438 For This Useful Post:

    Anne Arbor (01-23-2014)

  6. #14
    Join Date
    Jul 2010
    Location
    Near Albany, NY
    Posts
    56
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    No, I haven't tried that yet. It was all I could do today to open my cPanel and then open PHPMyAdmin, and then do some fiddling with the database -- really, all these kinds of things make me break out into a light sweat from anxiety.

    Now I have to use ftp again for the first time in more than a year. More sweating! ;-)

    As long as I'm going to try that, wherever 'mysql' appears, should I change that to 'mysqli' ??

  7. #15
    Join Date
    Jul 2010
    Location
    Near Albany, NY
    Posts
    56
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    James,

    I've made the change you suggested in the query, and it seems to have done the trick. (I didn't change anything else because I was concerned about 'unintended consequences.')

    While making this change, I learned something else that should be a big help in the future -- it is possible to edit code while in cPanel. That will certainly be far more convenient in future than ftp'ing every little change.

    This was great, James. Thank you for your patience and all your help. I'm truly grateful for both. :-)

  8. #16
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,723
    Thanks
    82
    Thanked 90 Times in 88 Posts

    Default

    No problem. Happy to help

    As for changing mysql to mysqli I only just found out about it a little over a year ago.

    change
    Code:
    $result = mysql_query($query) or die(mysql_error());
    to
    Code:
    $result = mysqli_query($conn,$query) or die(mysql_error());
    For more info I recommend looking at this thread. It should give you a short and sweet discussion about it.
    To choose the lesser of two evils is still to choose evil. My personal site

  9. The Following User Says Thank You to james438 For This Useful Post:

    Anne Arbor (01-23-2014)

Similar Threads

  1. xml/rss entries are too long???
    By cocidom in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 03-22-2010, 10:30 AM
  2. Replies: 1
    Last Post: 09-12-2007, 06:29 AM
  3. how to edit timestamp entries
    By blwow in forum PHP
    Replies: 5
    Last Post: 05-06-2007, 08:30 AM
  4. Code in one order, appearance in other order
    By motormichael12 in forum PHP
    Replies: 1
    Last Post: 11-13-2006, 05:44 PM
  5. text rollovers stopped working after adding DD slide show script
    By john5 in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 09-24-2004, 07:45 PM

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
  •