BrentMichie Posted October 5, 2018 Share Posted October 5, 2018 I have a program which is attempting to valid a username and password. Basic login, signup stuff. I have two working php files which query a database. The first one queries database A to check if an email exists. The second one queries database B to check if the password entered for a given email address is the same as user provided one. Both of these work. I am trying to make a 3rd php file which adds a value to the database. I am trying very simply to add an email address to database A. The code executes fine up until the Insert line. I am reasonably certain that the database is connecting because if I replace the Insert line with a similar SELECT line it can locate the email in the database just fine. I have checked and re-check my $sql = " "; statement many different websites proclaim that to be the correct syntax. I know that the code inside the sql statement is working because when I go on the web server and input the code inside the sql quotations it adds a datapoint to the table. Can somebody please take a look at my syntax and see if there is something I have missed? My webhosting is through godaddy.com and the user that I have connecting to this database has full permissions granted through their hosting management. I'm using phpMyAdmin to view the database tables and to manually insert new values for the tables. All php files are stored on my web server in the public_html folder and I execute them by using myurl.com/player_signup.php etc (as I said earlier, this works for 2/3 so I don't think there is issues with where I have placed the files). When I execute the code below the echo returns Error: INSERT INTO rdfz VALUES('fasfasfasddf') I've been staring at this problem all day. If someone could give me any direction that could help I would appreciate it very much. Quote Link to comment Share on other sites More sharing options...
benanamen Posted October 5, 2018 Share Posted October 5, 2018 (edited) Your real problem is that you are using dangerous obsolete code that has been completely removed from PHP. You need to use PDO with Prepared Statements. There is no "fixing" this code. This tutorial will get you going. https://phpdelusions.net/pdo You are also mixing mysql with mysqli. Whatever "tutorial" you are following, toss it. And next time post the actual code using the code tags. Pictures are for hanging on the wall. Edited October 5, 2018 by benanamen 1 Quote Link to comment Share on other sites More sharing options...
BrentMichie Posted October 6, 2018 Author Share Posted October 6, 2018 Thank you for the tutorial link. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.