Jump to content

Query Not Working


Mystixs

Recommended Posts

Here is my code

						mysql_query("INSERT INTO members (`username`, `password`, `paypalemail`, `ip`, `joined`, `money`) VALUES ('$username', '$password_md5', '$paypalemail', '$ip', date('m-d-y'), '0')");
						$affected_rows = mysql_affected_rows();
						if($affected_rows == "1")
						{
							header('Location: index.php');
						}
						else
						{
							echo "Registration has encountered an Error...<br />";
						}

Well, everything is defined correctly, but I always get "Registration has encountered an error.... I have narrowed it down to the query or the mysql_affected_rows() as being the source of the problem.

 

Any  help will be greatly appreciated.

Link to comment
Share on other sites

Well, your query would generate an error. The call to date() would not be parsed, so your query would litterally be trying to place the text date('m-d-y') in your database. Also, you should always add an or die statement to your queries if you suspect a problem. Try:

 

<?php
mysql_query("INSERT INTO members (`username`, `password`, `paypalemail`, `ip`, `joined`, `money`) VALUES ('$usename', '$password_md5', '$paypalemail', '$ip', '".date('m-d-y')."', '0')") or die(mysql_error());
?>

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.