Remember to do your homework.
<?php header ("content-type:text/html; Charset=utf-8 "); $con = mysql_connect ("* * *", "* * *", "* * *"), if (! $con) {die (' Could not connect: '. Mysql_error ()); }//connect table mysql_query ("SET NAMES UTF8"); mysql_select_db ("message", $con); $sql = "CREATE TABLE message (id int not NULL auto_increment, PRIMARY KEY (ID), name varchar (e), email varchar (page), Content varchar () ";//mysql_query ($sql, $con); $name = $_post[' name ']; $email = $_post[' Email ']; $content = $_post[' content '; $sql 1 = "INSERT into message (name,email,content) VALUES (' $name ', ' $email ', ' $ Content ') "; mysql_query ($sql 1, $con); echo" <table border= ' 1 ' ><tr><th>id</th><th>name </th><th>email</th><th>content</th></tr> "; $result = mysql_query (" SELECT * FROM Message "), while ($row = Mysql_fetch_array ($result)) {echo" <tr> "; echo "<td>". $row [' id ']. "</td>"; echo "<td>". $row [' name ']. "</td>"; echo "<td>". $row [' email ']. "</TD> "; echo "<td>". $row [' content ']. "</td>"; echo "</tr>"; }echo "</table>"; mysql_close ($con);? >
Encounter a bug in the middleMysql_fetch_array (): supplied argument is not a valid MySQL result resource
When you navigate to the function, the value $result is not valid.
Suspect that the database is not connected successfully.
Judge $result, output mysql_error ();
The discovery is that there is no database selection.
Originally put on the local can be executed, originally placed on the site database name written form name.
Stupid cry. = =!!!
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Php+mysql The simplest message board