paulman888888 Posted May 29, 2008 Share Posted May 29, 2008 Am not good with MySQL. How do i get $_GET[name] $_GET[score] and the date saved in MySQL. When i try makeing the table in PHPmyAdmin theres loads of options for row types. Which ones do i need for what? Thankyou for the help PAul Quote Link to comment Share on other sites More sharing options...
trq Posted May 29, 2008 Share Posted May 29, 2008 Assuming that $_GET['name'] contains a short string and $_GET['score'] a number. You would probably wont VARCHAR(80) and INT respectively. Then, you code might look something like... <?php if (isset($_GET['name']) && isset($_GET['score'])) { // here you will need to connect to the database. $name = $_GET['name']; $score = $_GET['score']; $sql = "INSERT INTO tbl (name,score) VALUES ('$name','$score');"; if (mysql_query($sql) && mysql_affected_rows()) { echo "Record added"; } else { echo "There was a problkem adding your score"; // do some additional debugging. } } ?> If this makes no snese to you Id suggest you start reading that php book in my signiture. Quote Link to comment Share on other sites More sharing options...
johnake Posted May 29, 2008 Share Posted May 29, 2008 As an addition to what thorpe said you could use some security to prevent injection: $name = $_GET['name']; should be $name=mysql_real_escape_string($_GET['name']); and so on. If you have a form that accept input you should use htmlspecialchars in order to prevent XSS. Good luck. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.