php - Check mysqli Insert Query excuted ok and display message and send email -


i creating registration form project, nothing secure or advanced, still new php etc.

i insert data needed login table , customer tbl, data inserts fine. cant code check worked , fire off email , display message user.

i have tried using value retrieved database there user registered successfuly.

if($userid != null)             {                 $msg1 = "thank you! registered, please check email verification link verify new account! ";                 $col1 = "green";                 //require_once "mail.php";                 require_once "inc/email.php";              } 

i have tried

if($query)             {                 $msg1 = "thank you! registered, please check email verification link verify new account! ";                 $col1 = "green";                 //require_once "mail.php";                 require_once "inc/email.php";          } 

thanks,

edit - here code,

    <?php      include ("inc/mysql.php");       error_reporting(0);     $msg = "";     $col = 'green';      function test_input($data){             $data = trim($data);             $data = stripslashes($data);             $data = htmlspecialchars($data);         return $data;     }      // define variables , set empty values     $name = $email = $chkemail = $password = $chkpassword =$address = $towncity = $postcode = "";  //required field validation  if ($_server["request_method"] == "post") {            if (empty($_post["name"])) {                 $msg = "name required";                 $col = 'red';           } else {                 $name = test_input($_post["name"]);           }            if (empty($_post["email"])) {                 $msg = "email required";                 $col = 'red';           } else {                 $email = test_input($_post["email"]);           }            if (empty($_post["chkemail"])) {                 $msg = "please confirm email address";                 $col = 'red';           } else {                 $chkemail = test_input($_post["chkemail"]);           }            if (empty($_post["password"])){                 $msg = "please enter password";                 $col = 'red';           }             if (empty($_post["chkpassword"])){                 $msg = "please confirm password ";                 $col = 'red';           } else{                 $chkpassword = test_input($_post["chkpassword"]);                 if(($_post["password"]) != $chkpassword) {                     $msg = "please check password correct";                     $col = 'red';                 } else{                     $password = test_input($_post["password"]);                 }           }            if (empty($_post["address"])) {                 $msg = "please enter first line of address";                 $col = 'red';           } else {             $address = test_input($_post["address"]);           }            if (empty($_post["towncity"])) {                 $msg = "please enter first line of town or city";                 $col = 'red';           } else {             $towncity= test_input($_post["towncity"]);           }            if (empty($_post["postcode"])) {                 $msg = "please enter postcode";                 $col = 'red';           } else {             $postcode = test_input($_post["postcode"]);             $customerveri = "n";              if($customerveri == "n"){             $name = mysqli_real_escape_string($db, $name);             $email = mysqli_real_escape_string($db, $email);             $password = mysqli_real_escape_string($db, $password);             $password = md5($password.substr($email,0,3));             $chkpassword = md5($password.substr($email,0,3));             $verifylink = md5(substr($name,0,3).substr($email,0,3));                $sql="select customeremail customer_tbl customeremail='$email'";             $result=mysqli_query($db,$sql);             $row=mysqli_fetch_array($result,mysqli_assoc);             if(mysqli_num_rows($result) == 1)             {                    $msg1 = "sorry...this email exists, please enter or login...";                 $col1 = "red";             }             else             {             $query = mysqli_query($db, "insert login_tbl (customeremail, customerpassword)values ('$email', '$password')");              $sql="select userid login_tbl customeremail='$email'";             $result=mysqli_query($db,$sql);             $row=mysqli_fetch_array($result,mysqli_assoc);             $userid = $row['userid'];              $query2 = mysqli_query($db, "insert customer_tbl (customername, userid, customeremail, customerpassword, customeraddress, customertowncity, customerpostcode, customerverified, customerverifiedlink)values ('$name', '$userid', '$email', '$password','$address','$towncity','$postcode','$customerveri','$verifylink')");             echo("error description: " . mysqli_error($db));         }            }           } }      if($userid != null)             {                 $msg1 = "thank you! registered, please check email verification link verify new account! ";                 $col1 = "green";                 //require_once "mail.php";                 require_once "inc/email.php";              }  echo '<div style="color:'.$col.'">'; echo $msg; echo '</div>';  echo '<div style="color:'.$col1.'">'; echo $msg1; echo '</div>';  ?> 

seems there no issue, instead issue email.php stopped rest of statement being executed. pick bits. few hours away screen needs!

thanks answered..


Comments

Popular posts from this blog

many to many - Django Rest Framework ManyToMany filter multiple values -

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

Java Entity Manager - JSON reader was expecting a value but found 'db' -