Mysql
 sql >> Database >  >> RDS >> Mysql

Utilizzo di JQuery per inserire valori in MySQL

Ecco come dovrebbe essere fatto con PDO

$dbh = new PDO('mysql:dbname=cs301;host=localhost', $username, $password);

$stmt = $dbh->prepare('INSERT INTO `galleryscores` (`player_name`, `player_score`) VALUES (:player_name, :player_score)');

$stmt->execute( array('player_name' => $_POST['name'], 'player_score' => $_POST['score']) );