php - Warning: mysqli_connect() expects parameter 5 to be long, string given in -


I know that is already asked but nothing is working for my problem. Need to get data and display it in HTML.

The code is as follows:

  & lt ;? Php $ host = "localhost"; // hostname $ username = "blue code_power"; // Mysql Username Password $ "bluecode123"; // MySQL password $ db_name = "bluecode_login"; // Database Name $ tbl_name = "news"; // table name $ myConnection = mysqli_connect ("$ host", "$ date", "$ user", "$ title", "$ text") or die ("can not connect"); Mysqli_select_db ("$ db_name") or die ("can not select database"); $ Query = "News from Select *"; // You do not need one; Like you do in SQL $ result = mysql_query ($ query); Echo "& lt; Table & gt;"; // When looping table tag in HTML ($ row = mysql_fetch_array ($ result)) {// loops loop through result "e & gt;  Tr & gt; & lt; td & gt; . $ Line ['date'] "& lt; / TD & gt; & Lt; TD & gt; ". $ Line ['news']" & lt; / TD & gt; & Lt; / TR & gt; "; // $ line ['index'] Here is the name of a field indexed" encoded "; // Close the table in HTML mysql_close (); ? & Gt;  

Thanks for any thoughts :)

Where are you Define the $ text variable? The value of $ text is a string, although mysqli_connect () has the fifth parameter port # and a long or an integer value is expected to pass.

$ myconnection = mysqli_connect ("$ host", "$ date", "$ user", "$ title", "$ text") or die ("can not connect") ;

should be:

$ myConnection = mysql_connect ($ host, $ username, $ password, $ db_name) or die ("Can not connect ");


Comments