Hi all,
Can anyone see why the following script is only inserting to the first query: ie;
$sql_query2 ="UPDATE company_categories SET category_id='$category_id2' WHERE comp_cat_id = '$comp_cat_id2'";
[/php
I want it to execute both queries.
[code=php]
<?
include("include/dbconnect_admin.php");
if($update_cat){
echo "$comp_cat_id1<br>";
echo "$category_id1<br>";
echo "$company_id1<br><br>";
echo "$comp_cat_id2<br>";
echo "$category_id2<br>";
echo "$company_id2";
if($comp_cat_id2){
$sql_query2 ="UPDATE company_categories SET category_id='$category_id2' WHERE comp_cat_id = '$comp_cat_id2'";
$result2 = mysql_query($sql_query2);
}
if($comp_cat_id1){
$sql_query1 ="UPDATE company_categories SET category_id='$category_id1' WHERE comp_cat_id = '$comp_cat_id1'";
$result1 = mysql_query($sql_query1);
}
if($result1 || $result2){
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> <div align="center"><br><br>
<?
echo "Your listing was successfully updated";
} else {
echo "Your listing was unable to be updated<br><br>";
echo "Please try again later";
}
?>
Any ideas?
Would there be a more efficent way of doing this?
Cheers,
micmac