Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INSERT INTO with HTTP_POST_VARS problem

Status
Not open for further replies.

0200050

Programmer
Jun 3, 2003
58
FI
Hi everybody, I am very proudly presenting this error of mine. You bet.

I have a this kinda code, which does the job on my other machine(PHP 5.0.2 and Apache 1.3.33 and MySQL 3.2.53) but it doesn't work at all with this other machine of mine, that has PHP 5.0.3, Apache 1.3.33 and MySQL 3.2.53 also. Weird? Yeah. (At this new machine I turned register globals on in php.ini)

This only should add the info stored in those variables to database, but it gives me only an error.

So the code:

$query = "INSERT INTO ".$HTTP_POST_VARS["Forum"]." (Subject,PostedBy,Date,Message,ReplyID,EmailReply,LastAccessed)
VALUES('".strip_tags($HTTP_POST_VARS["Subject"])."','".$HTTP_POST_VARS["UserName"]."','".Date("m/d/Y")."','".$msg."',
'0','".$HTTP_POST_VARS["EmailReply"]."','".Date("m/d/Y").":".Date("g:iA")."')";

It says like this in browser, when using that insert code:

You have an error in your SQL syntax near '(Subject,PostedBy,Date,Message,ReplyID,EmailReply,LastAccessed) VALUES('','','' at line 1

I'm creating here a little bulletin board, and only this thing is slowing me, but badly, down.

Do you have any suggestions, what should here be done otherwise?

Any help will be highly appreciated.

Best greetings,
-0200050- Finland
 
It looks like $HTTP_POST_VARS is not being instantiated on the new server. With PHP 5, the "long" array names ($HTTP_POST_VARS, $HTTP_GET_VARS, etc.), by default, are turned off because the "long" arrays are deprecated in favor of the "short" superglobal arrays ($_POST, $_GET, etc.).

This behavior can be changed by the php.ini setting register_long_arrays, but I strongly recommend instead that you use the "short" superglobal arrays instead.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Thank you very much sleipnir,
that was the trick to make the thing run.

Yeah, I prefer the shorter too, but this time my curiosity took over and made me ask you guys.

Best greetings,
-0200050- Finland
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top