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(); } Link to comment https://forums.phpfreaks.com/topic/286897-php-sql-mysql-not-storing-data/ Share on other sites More sharing options...
Augury Posted March 12, 2014 Share Posted March 12, 2014 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. Link to comment https://forums.phpfreaks.com/topic/286897-php-sql-mysql-not-storing-data/#findComment-1472252 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.. Link to comment https://forums.phpfreaks.com/topic/286897-php-sql-mysql-not-storing-data/#findComment-1472274 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? Link to comment https://forums.phpfreaks.com/topic/286897-php-sql-mysql-not-storing-data/#findComment-1472291 Share on other sites More sharing options...
Yohanne Posted March 12, 2014 Share Posted March 12, 2014 Hi, did you try to remove single quote from field name.? Link to comment https://forums.phpfreaks.com/topic/286897-php-sql-mysql-not-storing-data/#findComment-1472292 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. Link to comment https://forums.phpfreaks.com/topic/286897-php-sql-mysql-not-storing-data/#findComment-1472293 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!!! Link to comment https://forums.phpfreaks.com/topic/286897-php-sql-mysql-not-storing-data/#findComment-1472294 Share on other sites More sharing options...
Ansego Posted March 12, 2014 Author Share Posted March 12, 2014 MOD PLEASE REMOVE THIS POST!!! Link to comment https://forums.phpfreaks.com/topic/286897-php-sql-mysql-not-storing-data/#findComment-1472296 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.