Increment counter with conditions
Hi,
I have this php code to insert values in a database :
Code:
$eid = $_GET['parameter1'];
$file= $_GET['parameter2'];
$db_conn = mysql_connect('xxxxxx', 'xxxxxx', 'xxxxxx') or die ("Database CONNECT Error (line 11)");
$insert_st = "INSERT INTO opened values ('".$id."','".$eid."', '".$file."', now())";
mysql_db_query('xxxxxx', $insert_st) or die ("Database failed to insert");
I would like to insert ( have to create it first ) a new row (named count) created or updated with this conditions :
Quote:
First case :
If $eid = X AND $file= A , and there is no record matching this criteria, table count begins at 1
Quote:
Second case :
If $eid = X AND $file= A ,and there is already a record matching this criteria, table count increment by 1
How can i do that :confused:
Any advice would be helpfull ;)
Regards