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


i want ask inserting record db if give id in url throught $getn , check if data of id n present in table must update else must insert data ?

how can in php plz me

you like

<?php  $n = $_get["n"];  $query = "select count(*) numberofrecords table id = '$n'"; mysql_query($query);  if ($numberofrecords == 0)     mysql_query("insert [...]"); else     mysql_query("update [...]"); 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -