I want to write a script
if database no this record. It will insert
If database have tis reord. It will update
for ($a=0; $a<count($arr_event_id); $a++)
{
$query1 = "SELECT evnt_id FROM sales_roadshow WHERE evnt_id = '".$arr_event_id[$a]."' ";
$result1 = mysql_query($query1) or die(mysql_error());
$row_s1 = mysql_fetch_row($result1);
$P_numrows1 = mysql_num_rows($result1);
if ($P_numrows1 == 0)
{
$res=mysql_query("insert into sales_roadshow1
(evnt_id , evnt_start , evnt_end , evnt_status , evnt_type , evnt_title)
values (\"$arr_event_id[$a]\",\"$arr_start_date[$a]\",\"$arr_end_date[$a]\",\"$arr_status[$a]\",\"$arr_event_kind[$a]\",\"$arr_event_title_chi[$a]\")") or die(mysql_error());
}
else
{
mysql_query("UPDATE `sales_roadshow1` SET `evnt_title` = '".$this_event_title."' WHERE `evnt_id` = '".$this_event_id."'");
}
} // for
But I don't know why have a problem
Object of class __PHP_Incomplete_Class could not be converted to string
The problem is
mysql_query("UPDATE `sales_roadshow1` SET `evnt_title` = '".$this_event_title."' WHERE `evnt_id` = '".$this_event_id."'");
How can I fix it?