Kristian_C Posted January 1, 2007 Share Posted January 1, 2007 Hey Happy newyr people Another year with errors and late nights Heres the problem. The function is ment to insert cars into a "Garage". But i have an array problem that i cant figure out myself.The array works fine actually, it goes perfect into the echo and i get random every time. But it just wont insert the right "biler" into mysql.If someone can help me here it whould be great. }else{$få=rand(0,6);if ($biler[$få] == "Volvo 240"){ $bilde= "bilder/biler/volvo.jpg"; }elseif ($biler[$få] == "Subaru Impresa"){ $bilde= "bilder/biler/sub.jpg"; }elseif ($biler[$få] == "Skyline"){ $bilde= "bilder/biler/sky.jpg"; }elseif ($biler[$få] == "Farrari"){ $bilde= "bilder/biler/far.jpg"; }elseif ($biler[$få] == "Hummer H1"){ $bilde= "bilder/biler/hum.jpg"; }elseif ($biler[$få] == "TransAm"){ $bilde= "bilder/biler/tra.jpg"; }elseif ($biler[$få] == "Mini Cooper"){ $bilde= "bilder/biler/min.jpg"; }echo "<table width='65%' align='center' border='1' bordercolor='#000000' cellspacing='0'> <tr> <th background='grad.jpg' scope='col'>Crime Success</th> </tr> <tr> <td background='link.jpg'>You got away with a $biler[$få]!!</td> </tr></table>";$time= time() + 4;if($biler[$få]=="Volvo 240"){$pris=rand(7000,12000);$skade=rand(13,23);}if($biler[$få]="Subaru Impresa"){$pris=rand(7000,15000);$skade=rand(13,32);}if($biler[$få]=="Skyline"){$pris=rand(7000,19000);$skade=rand(13,55);}if($biler[$få]="Farrari"){$pris=rand(7000,22000);$skade=rand(15,55);}if($biler[$få]="Hummer H1"){$pris=rand(7000,26000);$skade=rand(12,59);}if($biler[$få]="TransAm"){$pris=rand(8000,30000);$skade=rand(19,44);}if($biler[$få]="Mini Cooper"){$pris=rand(13000,60000);$skade=rand(10,23);}mysql_query("INSERT INTO `biler`(`id`,`bil`,`skade`,`pris`,`sted`,`eier`,`status`,`flyttetid`)VALUES('','$biler[$få]','$skade','$pris','$info->land','$brukernavn','0','')");mysql_query("UPDATE brukere SET antallgta=antallgta+1 WHERE brukernavn='$brukernavn'");} ->Kristian_C Link to comment Share on other sites More sharing options...
justsomeguy Posted January 3, 2007 Share Posted January 3, 2007 Either enclose the variable in brackets:...VALUES('','{$biler[$få]}','...Or it might be because of the unicode character in the variable name. I'm not sure if that's allowed or not. Link to comment Share on other sites More sharing options...
Kristian_C Posted January 3, 2007 Author Share Posted January 3, 2007 Either enclose the variable in brackets:...VALUES('','{$biler[$få]}','...Or it might be because of the unicode character in the variable name. I'm not sure if that's allowed or not.Thanks mate, ill test it ..-> Kristian_C.Thanks mate, ill test it ..-> Kristian_C. it was the unicode character thing hehe... Thanks ->Kristian_C Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now