Kan ikke indsætte i min DB via pear
jeg kan af en eller anden grund ikke få mit script til at virke (indsætte data) og tænkte at nogen herinde måske kunne se fejlen.DBCLASS.PHP
class connect{
public $dbo;
public function connect()
{
include("DB.php");
//database forbindelsen
//Her opretter vi forbindelsen, og laver en fejl tjek
$dsn = "mssql://bil:bilbil@localhost/biludlejning";
$this->dbo = DB::connect($dsn);
if(DB::isError($dbo))
print($dbo->getMessage());
}
public function indsaet($q)//denne funktion bruges til at køre insæt sætninger
//print("asdasda");
{
if(!$result = $this->dbo->query($q))
print("kunne ikke kører query");
}
min indsæt side.
<?
include("../dbclass.php");
$dataob = new connect;
if($_POST["submit"] == 1){
$row = $dataob->hentEn("select * from model where model_maerke ='".$_POST["maerke"]."' AND model_model ='".$_POST["model"]."'");
if($_POST["maerke"] == $row[1] ||$_POST["model"] == $row[2] )
{
header("location:ny_brand.php?er=1");
}
else
{
$dataob->indsaet("insert into Model (model_maerke, model_model, model_udstyr, model_pris, model_passagere) values
('".$_POST["maerke"]."','".$_POST["model"]."', '".$_POST["udstyr"]."','".$_POST["pris"]."','".$_POST["pas"]."')");
}
//unset($_POST["Nyfrugt"]);
$_POST["submit"] = 0;
}
header("location:ny_brand.php?er=2");
?>
