php - Code working on Local but not working on Server -


I am trying to get data from a form and sending it to my database which is phpmyadmin. The code is working properly on local but is not working on uploading to the server. I used the local host as my hostname on the server to connect to my database, because I used to (Linux) I am doing

The code is as follows:

  & lt; Php if (isset ($ _ POST ['name'])) {$ senior star = mysql_connect ("localhost", "username", "password"); If (! $ Senior star) {dead ("Can not connect:". Mysql_error ()); } $ Name = $ _ POST ['name']; $ Testimony = $ _ post ['testimony']; Mysql_select_db ("seniorstarsdb", $ seniorstar); $ Sql ​​= "Include Testimonials (name, testimony) values ​​('$ name', '$ testimony')"; $ Result = mysql_query ($ sql, $ seniorstar); Mysql_close ($ seniorstar); Header ('location: thank you-you.html'); }? & Gt;  

The data is being received from the form but not being inserted into the database. Please help with new for php. Data is not being entered when it is completed to the thank-you page. Try changing the <<> mysql_connect ("localhost", "username", "password");); / P>

with mysql_connect ("127.0.0.1", "username", "password");

You can find some details.


Comments

Popular posts from this blog

mysql - How to enter php data into a html multiple select box -

java - Can't add JTree to JPanel of a JInternalFrame -

c++ - Cassandra datastax cpp driver - avoiding unnecessary copies -