Jump to content

Tunnleram

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Tunnleram's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. lol thx! Damn tutorials. I copy and pasted that hehe doh!
  2. I get this now: [code] Error 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 'priv) VALUES ('localhost', 'testuser', PASSWORD('password'), 'Y', 'Y', 'Y')' at line 1 with query INSERT INTO user (host, user, password, select_priv, insert_priv, update_ priv) VALUES ('localhost', 'testuser', PASSWORD('password'), 'Y', 'Y', 'Y') [/code]
  3. I'm going through a tutorial (this is after doing several things with php/mysql so I'm not a complete noob, just relearning sorta) and I'm having issues getting it to work locally. I have Xampp installed, php, apache and mysql are all working. I can insert from mysql without an issue, but whenever I try to insert any data using php it fails. When I run the page below I get 'Error, insert query failed', but everything looks right. Am I missing something? PHP Version 5.1.4 Mysql 5.0.21 Apache 2.2.2 [code]<html> <head> <title>Add New MySQL User</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php if(isset($_POST['add'])) { include 'config.php'; include 'opendb.php'; $username = $_POST['username']; $password = $_POST['password']; $query = "INSERT INTO user (host, user, password, select_priv, insert_priv, update_ priv) VALUES ('localhost', '$username', PASSWORD('$password'), 'Y', 'Y', 'Y')"; mysql_query($query) or die('Error, insert query failed'); $query = "FLUSH PRIVILEGES"; mysql_query($query) or die('Error, insert query failed'); include 'closedb.php'; echo "New MySQL user added"; } else { ?> <form method="post"> <table width="400" border="0" cellspacing="1" cellpadding="2"> <tr> <td width="100">Username</td> <td><input name="username" type="text" id="username"></td> </tr> <tr> <td width="100">Password</td> <td><input name="password" type="text" id="password"></td> </tr> <tr> <td width="100">&nbsp;</td> <td>&nbsp;</td> </tr> <tr> <td width="100">&nbsp;</td> <td><input name="add" type="submit" id="add" value="Add New User"></td> </tr> </table> </form> <?php } ?> </body> </html> [/code] Any help much appreciated.
×
×
  • 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.