Jump to content

[SOLVED] What's Wrong with this code?


Comptons_Eazy_E

Recommended Posts

You're also not using the correct syntax for updating (I edited my last post already).

 

Thanks again, i inserted it and it looked like this:

$sql = "UPDATE players SET Linked='1' WHERE Name='PN'";
VALUES
('$_POST[fname]')";
mysql_query($sql);

 

I received a error:

Parse error: syntax error, unexpected '"' in /www/110mb.com/s/o/u/t/h/w/e/s/southwestrp/htdocs/link.php on line 31

 

Doing a quick study i commented the two lines that look like this:

	VALUES
('$_POST[fname]')";

Then it worked, but the row still didn't change, Any idea why?

Link to comment
Share on other sites

Based on that screenshot it doesn't look like you have a record with the Name 'PN', so of course no records will be updated.

 

oh, I was a bit confused then, also this is what it looks like now:

$sql = "UPDATE players SET Linked='1' WHERE Name='Linked'";
//VALUES
//('$_POST[fname]')";
mysql_query($sql) or trigger_error(mysql_error() . 'on line: ' . __LINE__, 

E_USER_ERROR);

 

Those are commented because everytime i uncomment it i get errors  :shrug:

Link to comment
Share on other sites

Yea, those two lines aren't supposed to be there. When I posted the query before that's all that was supposed to be in it, you can completely remove those lines.

 

(Again) Based on that screenshot all I see is 1 record with the Name 'Eric_Wright', and do you even have a column named 'Linked'? I can't tell from the screenshot.

Link to comment
Share on other sites

   $sql = "UPDATE players SET Linked='1' WHERE Name='Linked'";
   mysql_query($sql) or trigger_error(mysql_error() . 'on line: ' . __LINE__, E_USER_ERROR);

 

You only have one record in the table and the "Name" filed does not contain the string "Linked" it contains the string "Eric_Wright".

 

   $sql = "UPDATE players SET Linked='1' WHERE Name='Linked'";
   mysql_query($sql) or trigger_error(mysql_error() . 'on line: ' . __LINE__, E_USER_ERROR);

printf("Query 1: Records updated: %d  ", mysql_affected_rows());

   $sql = "UPDATE players SET Linked='1' WHERE Name='Eric_wright'";
   mysql_query($sql) or trigger_error(mysql_error() . 'on line: ' . __LINE__, E_USER_ERROR);

printf("Query 2: Records updated: %d  ", mysql_affected_rows());

Link to comment
Share on other sites

What akon song are u reading?

 

I wanna love you =)

 

   $sql = "UPDATE players SET Linked='1' WHERE Name='Linked'";
   mysql_query($sql) or trigger_error(mysql_error() . 'on line: ' . __LINE__, E_USER_ERROR);

 

You only have one record in the table and the "Name" filed does not contain the string "Linked" it contains the string "Eric_Wright".

 

   $sql = "UPDATE players SET Linked='1' WHERE Name='Linked'";
   mysql_query($sql) or trigger_error(mysql_error() . 'on line: ' . __LINE__, E_USER_ERROR);

printf("Query 1: Records updated: %d  ", mysql_affected_rows());

   $sql = "UPDATE players SET Linked='1' WHERE Name='Eric_wright'";
   mysql_query($sql) or trigger_error(mysql_error() . 'on line: ' . __LINE__, E_USER_ERROR);

printf("Query 2: Records updated: %d  ", mysql_affected_rows());

 

Sorry for the late reply i was busy, anyway Its hard to explain but everybody has there own account, I was testing the database to see if i can the Linked from 0 to 1. People register there account ingame ( SA-MP is the game http://www.sa-mp.com ) And So I want them to link there account online using my website for my game server. So I just don't want it for my name, for the other people too understand? So when you wrote:

WHERE Name='Eric_wright'

I didnt just want it for me only thats why i put %_post from the input box text!

 

edit:

Yes i do have one coll-um  named "Linked"

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.