Jump to content

Queueon

New Members
  • Posts

    3
  • Joined

  • Last visited

Queueon's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Alright I tested your code and it's working exactly how I need it. In the meanwhile, for me this is still a real brain breaker and luckily for now I don't need much more code for my application (Construct 2). I think I would have been trying for another few weeks by myself. In the other hand, it's definitely interesting to know more about MySQL. Do you have a book or site as a reference for me to start reading from the beginning and not dive straight into it like I'm doing now? Many thanks Ch0cu3r, Psycho and Mc_gyver for your help. I'd need pay you a beer someday.
  2. Thanks for the answers. As you might have noticed I'm a newbie and didn't realise that GET needs a connection. However, in my original code I'm having the same issue. The DB is updated with nothing or an empty string. At least it is connected. <?php $servername = "localhost"; $username = "username"; $password = "password"; $dbname = "dbname"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } //$id = strip_tags(mysql_real_escape_string($_GET['id'])); $score = strip_tags(mysql_real_escape_string($_GET['score'])); $sql = "UPDATE users SET score_03='$score' WHERE id=2"; if ($conn->query($sql) === TRUE) { echo "Record updated successfully"; } else { echo "Error updating record: " . $conn->error; } $conn->close(); ?> I will take your suggestions in consideration and step back to learn more about PDO or mysqli. Thanks a lot.
  3. Hi, I'm going crazy with the following issue. I kept it simple for you to understand it quickly. The URL: http://localhost/savescores.php?score=222 <?php $score = strip_tags(mysql_real_escape_string($_GET['score'])); ECHO "Test 1"; ECHO "<h1>Your score is " . $_GET["score"] . "</h1>"; //Working! ECHO "Test 2"; ECHO "<h1>Your score is $score</h1>"; //Not working! ?> So the first echo test is working but its gets the information in another way as you can see. I need the second test to work because then I will be able to write the variable back into a database using url vars on a later stage. When I change the var $score manually to e.g. $score = '222'. Then all is working fine. I need it to work with the use of the URL. Anyone who can help?
×
×
  • 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.