Jump to content

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


Ansego
Go to solution Solved by Yohanne,

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

Edited by Augury
Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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