I've got this weird problem. I'm connecting to MySQL via PHP,
querying a particular table, closing the connection then parsing and
displaying the results. I then modify the table but when I reload the
PHP page, the output does not reflect this change.
Viz:
----[SQL query]----
mysqlselect * from users;
+----------+
| username |
+----------+
| jayds |
+----------+
----[web page output]----
Array ( [username] =jayds )
----[SQL query]----
mysqlinsert into users values ("wes");
Query OK, 1 row affected (0.00 sec)
----[reloaded web page output]----
Array ( [username] =jayds )
....and a rechecking of the db reflects that "wes" IS, in fact, in the
table.
This is the code I'm using (minus the parts that parse and print the
resource):
----[%begin%]----
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error
connecting to mysql');
mysql_select_db('wes') or die('Could not select database');
$query = "SELECT * FROM users";
$resource = mysql_query($query) or die('Query failed: ' .
mysql_error());
mysql_close($conn);
----[%end%]----
Any ideas on why I'm seeing stale data?
Thanks much in advance!,
Jason