Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = 'localhost';
- $user = 'root';
- $pass = '';
- try
- {
- $conn = mysqli_connect($host, $user, $pass, 'test');
- }
- catch (Exception $e)
- {
- echo $e->getMessage();
- }
- if($conn)
- {
- echo "Username: ";
- $get_user = fgets(STDIN);
- echo "Password: ";
- $get_pass = fgets(STDIN);
- echo "Email: ";
- $get_email = fgets(STDIN);
- $sql = "INSERT INTO users (`user_NAME`, `user_PASS`, `user_EMAIL`) VALUES ('{$get_user}', '{$get_pass}', '{$get_email}')";
- $sql = mysqli_query($conn, $sql) or die("Problem s bd: ".mysqli_errno($conn));
- if($sql) echo "Uspeshno dobavi nov potrebitel s ime: {$get_user}";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement