Jump to content

PHP -> SQL -> MYSQL : NOT storing data?


Ansego

Recommended Posts

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

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.

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?

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.