Jump to content

How can I update MySQL this way?


greenwayz

Recommended Posts

Hi, 

I have been working with MySQL for some time only to require info and make new data. 
But I'm stuck when it comes to update the database. 

Here is the php coding I use to send data to MySQL : 

if(isset($_GET['name']) && isset($_GET['score'])){

$name = strip_tags(mysql_real_escape_string($_GET['name']));
$score = strip_tags(mysql_real_escape_string($_GET['score']));
$sql = mysql_query("INSERT INTO `$db`.`scores` (`id`,`name`,`score`) VALUES ('','$name','$score');");

With the Ajax, we can call an URL like "....?name=NAME_HERE&score=1337" and then make a new line in the Database. This would result into matching a score to a name. 

My question is, how to edit/update a particular item. For example if I use this method to make a profile and the player wants to change a line of it... 

The index of my database is "id" which is auto_increment. I'm not sure if it helps or not.

I have been watching dozens of tutorials but nothing is working for me. If you have any idea how this would be working I thank you in advance.

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.