0
を働いていない私はテーブルが作成、変更されている単純なコードを持っていますが、テーブルはで始めるために作成されていない、と次のエラーが表示されている:PHP&SQL:テーブルを挿入および更新する機能が
を未定義の変数:ライン上の価格28
未定義の変数:newbrandライン上の28
未定義の変数:行にnewprice 28
ライン28:
$conexion-> modify("Mitsubishi",40000000,$price,$newbrand,$newprice);
完全なコード:
<?php
class MyDataBase{
private $link;
public function __construct($server,$user,$password,$base){
//Conectar
$this->link = mysql_connect($server,$user,$password);
mysql_select_db($base,$this->link);
}
public function insert($model,$brand,$price){
mysql_query("INSERT INTO autos (model, brand, price) VALUES ($model,'$brand', $price)",$this->link);}
public function modify($model,$brand,$price,$newbrand,$newprice){
mysql_query("UPDATE 'crautos'.'autos' SET 'brand' = '$newbrand',
'price' = '$newprice' WHERE 'autos'.'model' =5 AND 'autos'.'brand' = '$brand' AND 'autos'.'price' ='$price' LIMIT 1" ,$this->link);}
public function __destruct(){
//desconectar
}
}
$conexion = new MyDataBase ('localhost', 'root', '','crcars');
$conexion-> insert(05,"Ford",50000000);
$conexion-> modify("Mitsubishi",40000000,$price,$newbrand,$newprice);
?>