php - I try upload the user comment into my db. After I click submit, everything looks fine but I look in my db, there are no record. -


I tried a tutorial from some websites.

I try to upload a user comment in my DB. After submitting, everything looks fine but I see in my DB, there is no record

This php code is

  $ dbhost = 'localhost: 8090'; $ Dbuser = 'root'; $ Dbpass = 'Password'; $ Conn = mysql_connect ($ dbhost, $ dbuser, $ dbpass); If ($ _POST) {$ con = mysql_connect ("localhost", "root", "password"); } If (! $ Conn) {dead ('could not get DB');} mysql_select_db ("doctor", $ conn.); $ Ticket_user_fname = $ _POST ['fname']; $ Ticket_user_lname = $ _POST ['lname']; $ Ticket_email = $ _ POST ['email']; $ Ticket_hp = $ _ POST ['contact_number']; $ Ticket_content = $ _POST ['Content']; $ Ticket_category = $ _POST ['category']; Include VALUES ('ticket_id', 'ticket_time', '' 'ticket_id', 'ticket_id', ' Ticket_user_fname ',' ticket_email ',' ticket_content ',' tickets', 'ticket_hp', 'ticket_linnam') "; Mysql_query ($ query); Echo "& lt; h3 & gt; We will abandon you as soon as possible. Thanks. & Lt; / h3 & gt;"; Mysql_close ($ thief); ? & Gt;  

I am new to php You forgot to do $ before the variable

P>

  $ query =" ticketing "(` ticket_ID`, `fname`,` email`, `content`,` range` , `Contact number_`, 'lname`) value (' $ Ticket_id ',' $ ticket_time ',' $ ticket_user_fname ',' $ ticket_email ',' $ ticket_content ',' $ ticket_category ',' $ ticket_hp ',' $ ticket_user_lname ') ";  

Make sure that you have defined $ ticket_id and $ ticket_time before using them and if ticket_id < If / /> is the primary key of the table, then it will automatically increase for specificity and you do not need to include it separately.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -