Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

what is wrong witj this php code?

TheLoneWolf Arkin
Registered User
Join date: 26 Jan 2007
Posts: 29
12-16-2007 04:10
ok finaly getting somewhere :p lol but what is the error here? should work? guess not :(

(bare with me i'm nopt that good at PHP but i did everything according to a tutorial and my host has the latest soft installed)

it all goes well till i call the mysql_query :(

<?

$Action = $_POST['Action'];
$UserId = $_POST['UserID'];
$Payment = $_POST['Payment'];
$PaymentInfo = $_POST['PaymentInfo'];

$link = mysql_connect("localhost", "username", "secret";) or die("Failed to Connect: " . mysql_error());
mysql_select_db("databasename", $link) or die("Failed to select DataBase: " . mysql_error());


$query = "INSERT INTO `Users` ( `UserNumber` , `User_Id` , `Subscription` , `PaymentInfo` ) VALUES ( NULL, 'test', '100', 'NOK'))";
mysql_query($query) or die("Failed to add record: " . mysql_error());

mysql_close($link);

?>


keep getting this :(

---
Failed to add record: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
---

while the error only appears when i run the mysql_query so why does it say line 1? and what the error? the query is created with myphpadmin so i gues that cant be the error? right?

thanks.
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
12-16-2007 04:13
You have an extra closing bracket at the end of the query.
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!

http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal

http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
TheLoneWolf Arkin
Registered User
Join date: 26 Jan 2007
Posts: 29
12-16-2007 04:26
omg i feel so stupid now :p lol tnx after a night of coding i think its time to hit the sack :p LSL is finishd PHP for when i wake up :D

tnx
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
12-16-2007 06:53
If you want to check whether there are Parse-Errors in your PHP script, just call the script directly in your browser. The PHP-Parser will output any Syntax-Error that you made.
That's actually easier than calling the script from SL and then try to guess why it isn't working :)