Folgendes Script soll Daten in eine DB eintragen:
<?
include("config.php");
$conn = mysql_connect($dbserver,$dbuser,$dbpass);
mysql_select_db($dbname,$conn);
$query = "INSERT INTO `database` (id,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao ,ap,aq,ar,as,at,au,av,aw,ax,ay,az,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm,bn,bo,bp,bq,br,bs,bt,bu,bv, bw,bx,by,bz,ca,cb,cc,cd,ce,cf,cg,ch) ";
$query .= "VALUES ('','$a','$b','$c','$d','$e','$f','$g','$h','$i','$j','$k','$l','$m','$n','$o','$p','$q','$r','$s',' $t','$u','$v','$w','$x','$y','$z','$aa','$ab','$ac','$ad','$ae','$af','$ag','$ah','$ai','$aj','$ak', '$al','$am','$an','$ao','$ap','$aq','$ar','$as','$at','$au','$av','$aw','$ax','$ay','$az','$ba','$bb ','$bc','$bd','$be','$bf','$bg','$bh','$bi','$bj','$bk','$bl','$bm','$bn','$bo','$bp','$bq','$br','$ bs','$bt','$bu','$bv','$bw','$bx','$by','$bz','$ca','$cb','$cc','$cd','$ce','$cf','$cg','$ch')";
$result = mysql_query($query,$conn);
print $query;
if(!$result)
{
echo "<p>Error >>> ".mysql_error($conn).".</p>";
}
else
{
echo "<p>Daten erfolgreich eingetragen.</p>";
}
?>
Doch es kommt immer folgender Fehler:
Error >>> You have an error in your SQL syntax near 'as,at,au,av,aw,ax,ay,az,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm,bn,bo,bp,bq,br,bs' at line 1.
Was ist da falsch?
<?
include("config.php");
$conn = mysql_connect($dbserver,$dbuser,$dbpass);
mysql_select_db($dbname,$conn);
$query = "INSERT INTO `database` (id,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao ,ap,aq,ar,as,at,au,av,aw,ax,ay,az,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm,bn,bo,bp,bq,br,bs,bt,bu,bv, bw,bx,by,bz,ca,cb,cc,cd,ce,cf,cg,ch) ";
$query .= "VALUES ('','$a','$b','$c','$d','$e','$f','$g','$h','$i','$j','$k','$l','$m','$n','$o','$p','$q','$r','$s',' $t','$u','$v','$w','$x','$y','$z','$aa','$ab','$ac','$ad','$ae','$af','$ag','$ah','$ai','$aj','$ak', '$al','$am','$an','$ao','$ap','$aq','$ar','$as','$at','$au','$av','$aw','$ax','$ay','$az','$ba','$bb ','$bc','$bd','$be','$bf','$bg','$bh','$bi','$bj','$bk','$bl','$bm','$bn','$bo','$bp','$bq','$br','$ bs','$bt','$bu','$bv','$bw','$bx','$by','$bz','$ca','$cb','$cc','$cd','$ce','$cf','$cg','$ch')";
$result = mysql_query($query,$conn);
print $query;
if(!$result)
{
echo "<p>Error >>> ".mysql_error($conn).".</p>";
}
else
{
echo "<p>Daten erfolgreich eingetragen.</p>";
}
?>
Doch es kommt immer folgender Fehler:
Error >>> You have an error in your SQL syntax near 'as,at,au,av,aw,ax,ay,az,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm,bn,bo,bp,bq,br,bs' at line 1.
Was ist da falsch?
Kommentar