PHP100 video tutorial 11th correct code conn. php file & lt ;? Php $ conn = @ mysql_connect (& quot; localhost & quot;, & quot; root & quot;, & quot;) ordie (& quot; PHP 11th video tutorial correct code
Conn. php file
$ Conn = @ mysql_connect ("localhost", "root", "") or die ("database link error ");
Mysql_select_db ("newdb", $ conn );
Mysql_query ("set names 'gbk'"); // use GBK Chinese encoding;
?>
Add. php file
Include ("conn. php ");
If (isset ($ _ POST ['submit ']) & $ _ POST ['submit']) // if ($ _ post ['submit ']) replace and correct Notice: Undefined index: submit in error
{
$ SQL _add = "insert into message (id, user, title, content, lastdate) values ('', '$ _ POST [user]', '$ _ POST [title]', '$ _ POST [content]', now ())";
Mysql_query ($ SQL _add );
Echo "published successfully ";
}
?>
List. php file
Include ("conn. php ");
?>
$ SQL _list = "SELECT * FROM message order by id desc ";$ Query = mysql_query ($ SQL _list );While ($ row = mysql_fetch_array ($ query )){?>
// $ Row [] parameters are enclosed in single quotes
Title: User: |
Content: |
}?>
------ Solution --------------------
What's your problem... I don't understand what you asked.