STEP 1:old way of coding that gives Deprecated Errors:
if(isset($_POST['add_brand'])){
$new_brand = $_POST['new_brand'];
$insert_brand = "insert into brands (brand_title) values ('$new_brand')";
$run_brand = mysql_query($insert_brand);
if($run_brand){
echo "<script>alert('New Brand has been inserted!')</script>";
echo "<script>window.open('index.php?view_brands','_self')</script>";
}
}
STEP 2: New way of coding and resolving any Deprecated or Missing parameters in codes.
if(isset($_POST['add_brand'])){
$new_brand = $_POST['new_brand'];
$insert_brand = "insert into brands (brand_title) values ('$new_brand')";
$run_brand = mysqli_query($con, $insert_brand);
if($run_brand){
echo "<script>alert('New Brand has been inserted!')</script>";
echo "<script>window.open('index.php?view_brands','_self')</script>";
}
}
NOTE: $con should be your DB connection variables. $con. in connect.php
No comments:
Post a Comment