Jump to content

Frustrating = Sign Insert


justlukeyou

Recommended Posts

I believe I've told you many times how to fix this: Learn how to actually write PHP. You clearly do not know the basics even, neither are you paying attention to what you're doing.

To build upon Jessica's earlier comment: What you're doing is akin to trying to build a skyscraper, without knowing how to use a hammer even, while wearing a blind fold.

 

Since you refuse to listen to what we're saying, we cannot help you. The only option available for us, is to write the code for you. If you want someone to do that, you'll need to pay. Simple as that.

Link to comment
Share on other sites

I cannot be bothered to read the whole post. You pretty much ask us to fix it for you, that isn't our job. We guide you in the right direction on fixing things yourself. Based on the change of syntax highlighting I've seen on the forums, everything that's green should be a string. 'mysql_real_escape_string()' is a function, and there for should be black. Go figure.

 

Everything we've said (or almost) is there to help you. If you decide not to listen, then it isn't going to help you is it?

Edited by JLT
Link to comment
Share on other sites

Dont understand them.

 

With this code that works I have a comma at the end. When I try to add a comma to the end of the code I am trying to join together it creates an errror. I just dont get it!!!

 

 $query = 'INSERT INTO users SET email = "' . mysql_real_escape_string($registerEmail) . '",
		 password = MD5("' . mysql_real_escape_string($registerPassword) . '"),
		 date_registered = "' . date('Y-m-d H:i:s') . '"';



 

If its BASIC why not just point out what the error is. This is getting silly.

Edited by justlukeyou
Link to comment
Share on other sites

Right, after playing about with it for around 50 times I have got it so it is no longer generating an error. However whenever I try to insert it now creates the error

 

"There was a problem registering you. Please check your details and try again."

 

Like having a tooth extracted but getting there!

 

 if(!$errors){
 $query = mysql_query("INSERT INTO users SET email
 (firstname, surname) VALUES ('" . $firstname . "', '" . $surname . "')");


 "' . mysql_real_escape_string($registerEmail) . '";
	 'password = MD5("' . mysql_real_escape_string($registerPassword) . '")';
 'date_registered = "' . date('Y-m-d H:i:s') . '"';

 if(mysql_query($query)){
						 $success['register'] = 'Thank you for registering. You can now log in on the left.';
				 }else{
						 $errors['register'] = 'There was a problem registering you. Please check your details and try again.';

							 }
		 }

		 }

Edited by justlukeyou
Link to comment
Share on other sites

No idea, but I shall pull my hair out for the next 3 days trying to find out why.

According to the logic in your code, why do you think that error might be displayed?

 

Not another rhetorical question. Dont worry I shall spend another 3 days pulling my hair out trying to find out why. And please dont come back and say "well if thats your attitude I wont tell you. I was going to tell you." because that would mean you genuinely have something useful to say like answering your own question.

Edited by justlukeyou
Link to comment
Share on other sites

  • 3 weeks later...

The bug in reply #10 was a missing comma. I got too annoyed reading the thread to see if I'm the first person to spot it.

 

Edit: Holy crap turn on error_reporting. Reply #31 would throw at least 6 PHP errors.

Edited by ManiacDan
Link to comment
Share on other sites

Then stop helping him so he can go somewhere else. I don't understand the people who say:

I know we've had this before but I really cant see the point of a forum that tells you to go somewhere else.
while simultaneously ignoring everything we say.

 

This code is a random slapping together of disparate elements with no consistent style, random indentation, invalid SQL syntax, strings that exist for no reason as bare non-operations, poor concatenation, no security, and will never improve from us simply repeating good advice over and over.

 

Stop what you're doing. Start this section of code over. Turn on error reporting. Handle your SQL errors. In fact, do this:

 

$result = mysql_query( $sql );
if ( $result === false ) {
 die("Fatal SQL error for: {$sql}<P />MySQL Server returned: <br />" . mysql_error());
}

If you use mysql_query anywhere else but in that exact block we can't help you. Copy and paste that. Copy and paste this as well:

error_reporting(E_ALL);

Error_reporting should be the very first line in your script.

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.