HI,
I have been working on this site for a while and this page USED to work. Now all of a sudden it is acting up.
All I am trying to do is query a MySQL table and print the contents on a page.
Here is my only code dealing with the table:
PHP Code:
<?php
$db = mysql_connect("localhost", "username", "password");
mysql_select_db("wordpress",$db);
$result = mysql_query("SELECT user_name, user_prefix FROM wp_prefix ORDER BY user_name");
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
$name = $row[0];
$prefix = $row[1];
$table = $prefix . 'posts';
$result2 = mysql_query("SELECT * FROM $table ORDER BY post_date desc");
$myrow = mysql_fetch_array($result2);
$id = $myrow["ID"];
$date = $myrow["post_date"];
$title = $myrow["post_title"];
printf("<li><ul>
<a href=\"wordpress1/index.php\"><b>$name</b></a><br />
<small><b>Last Post:</b><br />$date<br /><b>Title:</b><br />
<a href=\"wordpress1/index.php?p=$id\">$title</a></small><br />
</ul></li>");
}
mysql_free_result($result);
?>
The problem is, every time I refresh this page, it inserts a record into my table. So weird. I even deleted the table completely, rebuilt the table, left it blank and ran this page and sure enough it added a case to the table.
Any ideas?