-
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/
-
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>";
-
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";
-
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' ??
-
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. :-)
-
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.