Ansego Posted March 12, 2014 Share Posted March 12, 2014 Hi all, having some trouble working out whats going wrong here, don't get no errors to work from so I am stuck! Why is this NOT storing in the table? I have other code using the execution function and working, but this is failing but no errors. Please help! SQL Passing SQLExecute(" INSERT INTO `dbleads`.`offer` (`Username`, `Password`, `PWSalt`, `FullName`, `Email`, `Phone`, `Mobile`, `CompanyName`, `CompanyABN`, `Street`, `Suburb`, `State`, `Postcode`, `BStreet`, `BSuburb`, `BState`, `BPostcode`, `Comment`, `AgreeTC`, `TimeStamp`) VALUES (`$unop`, `$pwop`, `$salted`, `$fnop`, `$emailop`, `$phoneop`, `$mbop`, `$cnameop`, `$cabnop`, `$streetop`, `$suburbop`, `$stateop`, `$postcodeop`, `$Bstreetop`, `$Bsuburbop`, `$Bstateop`, `$Bpostcodeop`, `$commentop`, `$AgreeTC`, `$Timestamp`); "); Connection: function SQLExecute($sqlstring){ // CONNECTION $mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $mysqli->query($sqlstring); /* close connection */ $mysqli->close(); } Quote Link to comment Share on other sites More sharing options...
Augury Posted March 12, 2014 Share Posted March 12, 2014 (edited) I don't think the `dbleads`. if your specifying the database to mysqli. if "$mysqli = new mysqli(HOST, USER, PASSWORD, DATABASE);" is not at altered string on your part then that syntax won't connect you to the DB. If any of those fields are not set in php the data will not be inserted into the database. echo the $sqlstring before the queery. Then log in to mysql and try running the queery manually. Then post the error you get. Edited March 12, 2014 by Augury Quote Link to comment Share on other sites More sharing options...
subhomoy Posted March 12, 2014 Share Posted March 12, 2014 Please check whether you have used proper database connection settings... ANd also check whether "dbleads" is available or not.. Quote Link to comment Share on other sites More sharing options...
Ansego Posted March 12, 2014 Author Share Posted March 12, 2014 Hi guys, Database connection is active SQLExecute($sqlstring) Is also been used from another form and works All fields are set OTHER then ID has been removed due to auto increment No Errors occurring Added $mysqli->select_db("dbleads"); still no change tested with other functional form and works All variables are set Don't know what else to do? Quote Link to comment Share on other sites More sharing options...
Solution Yohanne Posted March 12, 2014 Solution Share Posted March 12, 2014 Hi, did you try to remove single quote from field name.? Quote Link to comment Share on other sites More sharing options...
Ansego Posted March 12, 2014 Author Share Posted March 12, 2014 @Augury Spot on mate, error with the SQL when I ran it in WorkBench. Still working out why but I have a smile even for an ERROR! lol. I'll get back to you. Quote Link to comment Share on other sites More sharing options...
Ansego Posted March 12, 2014 Author Share Posted March 12, 2014 Hehe @ JaysonDotPH The Back-tick ( ` ) was failing it!!! Quote Link to comment Share on other sites More sharing options...
Ansego Posted March 12, 2014 Author Share Posted March 12, 2014 (edited) MOD PLEASE REMOVE THIS POST!!! Edited March 12, 2014 by Ansego 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.