Wednesday, 15 July 2015

php - Insert record if the id is not present in db -


I want to ask about putting a record in db as if we were id In url throught $ Getn , check whether the data for id n is present in the table, should update it and put data in it?

How can you do this in PHP plz

You can do something like

  & lt ;? Php $ n = $ _GET ["n"]; $ Query = "Select number (*) as WHERE id = '$ n' from the list of numbers in the table; Mysql_query ($ query); If ($ numberOfRecords == 0) mysql_query ("INSERT [...]"); Else mysql_query ("Update [...]");  

No comments:

Post a Comment