Jump to content

IF EXISTS - error


Canman2005

Recommended Posts

<?php

$sql = mysql_query("SELECT * FROM `md` WHERE `rn` = 'DD'");
$count = mysql_num_rows($sql);

if ($count > 0){ //record exists
   mysql_query("UPDATE `md` SET `rn`='CC'");

} else { //record doesn't exist
  //INSERT QUERY HERE

}

?>

 

Your INSERT query doesn't make any sense...so you might want to do a google on that.

Link to comment
https://forums.phpfreaks.com/topic/52115-if-exists-error/#findComment-257047
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.