Christian Kruse: INSERT - Befehl mit PHP klappt nicht...

Beitrag lesen

Hoi,

<?php
$username="xxxx";
$password="xxxxx";
$host="xxxx";
$database="baseball_cheerleading_de";

mysql_connect($host, $username, $password);

$id = mysql_connect($host,$username,$password) or die(mysql_error());

mysql_select_db($database);

mysql_select_db($database) or die(mysql_error());

$query="INSERT INTO baseball_cheerleading_de.User(Login, UserID) VALUES('xxx','xxx')";

Besser:

$query = 'INSERT INTO User (Login,UserID) VALUES ("xxxx","xxxx")';

mysql_db_query($database,$query);

mysql_db_query ist deprecated. Besser:

$result = mysql_query($query,$id) or die(mysql_error());

Gruesse,
 CK