Jump to content

query syntax


EchoFool

Recommended Posts

I have a query which doesn't like my curly brackets.... but i don't know how to put it in correctly:

 

$LOG = mysql_query("INSERT INTO stafflog ('UserID','TimeEvent','Log')
	VALUES ('{$_SESSION['Current_User']}','Date','$Me[{$_SESSION['Current_User']}] has viewed
		$Choice logs for $Username[$UserID]')")
			Or die(mysql_error());

 

where it says:

$Me[{$_SESSION['Current_User']}]

 

In the database it would look like Username[234]

 

But i get this error:

Parse error: syntax error, unexpected T_CURLY_OPEN, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\xampp\htdocs\logpanel.php on line 121

 

Link to comment
https://forums.phpfreaks.com/topic/95247-query-syntax/
Share on other sites

Do youself a favour and store the query in a var, this makes it easier to debug.

 

<?php

$sql = "
INSERT INTO stafflog (
  'UserID','TimeEvent','Log'
) VALUES (
  '{$_SESSION['Current_User']}','Date','$Me[{$_SESSION['Current_User']}] has viewed $Choice logs for $Username[$UserID]')";

$LOG = mysql_query($sql) or die($sql . "<br />" . mysql_error());

?>

 

What does this produce?

Link to comment
https://forums.phpfreaks.com/topic/95247-query-syntax/#findComment-487875
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.