database - mySql error connecting DB -


When I'm trying to put in the database, I keep getting this error. "Mysqli_select_db () expects that 2 parameters, 1"

  $ host = "localhost"; // hostname $ username = "root"; // MySQL username $ password = ""; // MySQL password $ db_name = "# test"; // Database Name $ tbl_name = "Deploy"; // Connect the name of the table to the // server and select the database. $ Con = mysqli_connect ("$ host", "$ username", "$ password") or die ("can not connect"); If (! $ Con) {dead ('Could not connect:' Mysql_error ()); } $ Customer = $ _ POST ['name']; $ Help = $ _ post ['assisstant']; $ Service = $ _ post ['service']; $ Date = $ _ post ['date']; $ Time = $ _ post ['time']; Include $ Sql ​​= "$ tbl_name (cus_name, emp_name, date, time, service) values ​​('$ customer', '$ help', '$ date', '$ time', '$ service'); "; Mysqli_select_db ("$ db_name") or die ("can not choose DB"); $ Retal = mysql_query ($ sql, $ conn); If (! $ Retval) {dead ('data could not be entered:'. Mysql_error ()); } Echo "Successfully recorded data \ n"; Mysql_close ($ thief);    

You are using it in a procedurally manner. From

;

  bool mysqli_select_db (mysqli $ link, string $ dbname)   

like this;

  mysqli_select_db ($ con, $ db_name) or die ("can not choose db");    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -