Jump to content

My insert code stop working


Recommended Posts

I have created a simple mysql database with php code and I put it on server using on server phpmyadmin .
I added an insert button and everything was ok.But then the code stop working without no reason.
Here the URL of my database site: mathcalc.appleschat.com
Here the insertion code

<?php
 include "connectToDB.php";

 function mksafe($data){
     $data=trim($data);
     $data=strip_tags($data);
     $data=htmlspecialchars($data);
     $data=addslashes( $data);
     return $data

 }
   $value1 = mksafe($_POST['fname']);
   $value2 = mksafe($_POST['lname']);
   $value3 = mksafe($_POST['email']);
   $date = date('Y-m-d');
$sql = "INSERT INTO users (firstname, lastname, email,reg_date)
values( '$value1', '$value2', '$value3','$date')";

if ($conn->query($sql) === TRUE) {
    header("Refresh:0; url=index.php");
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>

Thanks in advance any help will be appreciated.

Link to post
Share on other sites

OP was already advised about his code on another forum and did not implement any of the advice whatsoever. His response was "Could you please write it to me".

OP, we are not a coding on demand service. You apparently didn't even attempt to copy and paste the complete working example from the tutorial you were referred to. If you just want someone to write it for you then post a job offer on any of the forums jobs section.

Edited by benanamen
Link to post
Share on other sites
This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.