Jump to content
php.lv forumi

kļūda skriptā


torrentz

Recommended Posts

Neatradu kļūdu, bet katrā ziņā šo

 

$reg = mysql_query("SELECT * FROM `os_stats` WHERE `id`='" . $did . "';);

$rozs = mysql_fetch_assoc($reg);

$sytem = $rozs[$os];

$sytem++;

@mysql_query("UPDATE `os_stats` SET `".$os."`= '".$sytem."' WHERE `id`='" . $did . "';");

 

Var aizvietot ar vienu kveriju:

 

mysql_query("UPDATE `os_stats` SET `".$os."`= `".$os."` + 1 WHERE `id`='" . $did . "'");

Link to comment
Share on other sites

I taada lieta, ka man visi user agenti sanaak kaa "Other", lai gan vismaz 40% user agentu vajadzeetu buut ar kaadu noshiim OS. Doma ir taada ka pilnajaa user agentaa, piemeeram: Nokia6680/1.0 (4.04.07) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1, Mozilla/4.0 (compatible; MSIE 6.0; Windows 95; PalmSource; Blazer 3.0) 16;160x160 ir jaatrod kaada no shiim opereetaajsisteemaam..

Edited by torrentz
Link to comment
Share on other sites

salidzini sho rindu izmantojot, preg_match f-ju.

Link to comment
Share on other sites

$string = $_SERVER['USER_AGENT'];

 

if (preg_match('@SymbianOS/9.1@', $string)) { $os = "SymbianOS/9.1";}

else if { (preg_match('@SymbianOS/9.2@', $string)){$os = "SymbianOS/9.2";}

else if { (preg_match('@Series80@', $string)){$os = "Series80";}

utt....

else {$os = "Other";}

Vai tā ir pareizi? Es īsti nezinu kādus simbolus jāizmanto @ vietā :) Vai kāds nevarētu pateikt priekšā?

Edited by torrentz
Link to comment
Share on other sites

Pēdējā laikā preg_match ir populārs, tipa var izdarīt visu ;)) Kārtējā vieta, kur viņš nav vajadzīgs...

 

$string = $_SERVER['USER_AGENT'];

 

if(strpos(strtolower($str),strtolower("SymbianOS/9.2"))){

$os = "SymbianOS/9.2";

}

elseif(strpos(strtolower($str),strtolower("Series80"))){

$os = "Series80";

}

else{

$os = "Other";

}

Link to comment
Share on other sites

bet probleema ir taa ka jebkuraa gadiijumaa vienmeer sanaak user agent ir "Other". Li gan mans user agnet ir Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6, un shajaa user agentaa ir Windows NT 5, tomeer skripts pievieno datubaazee +1 vieniibu pie other..

Link to comment
Share on other sites

×
×
  • Create New...