vendredi 25 octobre 2019

database insertion that works but the if else statement is in wrong order

this works to put the data collected in previous form, the data is inserted into the database but i am pretty sure that the if else statement is in the wrong order.

<?php
include('profile.php');
if(!isset($_SESSION['login_user'])){
header("location: index.php"); // Redirecting To Home Page
}
    $name = $_POST["name"];
    $style = $_POST["style"];
    $bag = $_POST["bag"];
    $heart = $_POST["heart"];
    $tush = $_POST["tush"];
    $tag_comments = $_POST["tag_comments"];
        $sqltag = "INSERT INTO tags (name, style, bag, heart, tush, tag_comments)
        VALUES ('$name', '$style', '$bag', '$heart', '$tush', '$tag_comments')";
        $query = mysqli_query($conn, $sqltag);
        if ($conn->query($sqltheme) == TRUE)        
        {
            print("<h2>Could not add Ty Baby</h2><hr align='center' width='800'/>
            <p>You could not add <em>".$name."</em> to the database.</p><p><a href='profile.php'>Try Again</a></p>");
        }
        else
        {
            print("<h2>New Ty Baby added</h2><hr align='center' width='800'/>
            <p>You succesfully added <em>".$name."</em>s theme information to the database.</p>");
        }
?>

Aucun commentaire:

Enregistrer un commentaire