Bladephp: Now with 7+ codeigniter, php, and laravel project 7+ php project From $18/Year From Rs. 1000/Year

Mysql UPDATE Statement using Join Statement

by
Category:mysql
php mysql
Mysql UPDATE Statement using Join Statement

We often use join clauses to query rows in a table that have (in the case of INNER JOIN) or may not have (in the case of LEFT JOIN) corresponding rows in another table. In MySQL, we can use the JOIN clauses in the UPDATE statement to perform the cross-table update.

First you can need database connection in php

Code

$querydelte = mysqli_query($con,"UPDATE `iosr_car_series` AS `cs` INNER JOIN `iosr_car_master` AS `cm` ON `cs`.`car_id` = `cm`.`car_id` INNER JOIN `iosr_car_model` AS `cmm` ON `cmm`.`model_id` = `cs`.`model_id` SET cm.status =1,cmm.status=1,cs.status = 1 where cs.series_id = '".$_GET['approve']."' "); 
if($querydelte)
{
    $message = 'Car Model Approved Successfully!!';
}
else
{
    $message = 'Due to some Error Please try again!!';
}

0 Comments


Html code work in comment box


Related Post