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
https://forums.phpfreaks.com/topic/79582-query-not-working/
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
https://forums.phpfreaks.com/topic/79582-query-not-working/#findComment-403065
Share on other sites

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.