hackerman Posted March 4, 2007 Report Share Posted March 4, 2007 Skripts nav saistīts ar reģistrēšanos. Tabula: id, ip, website. vajadzētu kautko ~ tādu fails.php $ip = nezinu ka pierkasta; $website = nezinu ka pierkasta; $info[] = array("ip" => $ip, "website" => $website); Un caur pārlūku varētu redzēt IP un websaitu :) Tikai vajag, lai katra lietotāja infa parādās... Nevis tikai no id=1, bet no visiem pārējiem arī :) Un beigās vajadzētu sanākt tādam kā sarakstam ar ip un websaitēm :) Link to comment Share on other sites More sharing options...
andrisp Posted March 4, 2007 Report Share Posted March 4, 2007 $ip = '1.1.1.1'; $website = 'bla.bla.lv'; ? Link to comment Share on other sites More sharing options...
Val Posted March 4, 2007 Report Share Posted March 4, 2007 http://lv2.php.net/reserved.variables ? andrisp variants arī labs. Link to comment Share on other sites More sharing options...
hackerman Posted March 4, 2007 Author Report Share Posted March 4, 2007 Nē :D Es gribu, lai to infu izņem no mysql :) Link to comment Share on other sites More sharing options...
andrisp Posted March 4, 2007 Report Share Posted March 4, 2007 1) php.net/mysql_query 2) google:mysql select Esi konkrētāks savus aprakstos. Btw, $info[] = array("ip" => $ip, "website" => $website); ? Kam tev [] ? Link to comment Share on other sites More sharing options...
hackerman Posted March 4, 2007 Author Report Share Posted March 4, 2007 [] vajag, jo tā bija pamatskriptā :) Par to select, es papētīju mazliet php.net piemērus. Tur pārsvarā bjia jāraksta "where id = 1" vai kautkas tamlīdzīgs. Man vnk vajag visus ierakstus, neskatoties uz id :) Link to comment Share on other sites More sharing options...
andrisp Posted March 4, 2007 Report Share Posted March 4, 2007 Nu tad neliec klāt where. SELECT * FROM `tabula` Link to comment Share on other sites More sharing options...
hackerman Posted March 4, 2007 Author Report Share Posted March 4, 2007 <? include('connect.php'); $ip = "SELECT `ip` FROM `servers`"; echo $sql; ?> Man tāds neiet... wtf? connect.php ir 100% pareiza info, jo viss ierakstījās datubāzē, bet nevaru dabūt ārā =/ Mysql serveris arī iet.. Link to comment Share on other sites More sharing options...
john.brown Posted March 4, 2007 Report Share Posted March 4, 2007 Varbūt papriekš šito pamatīgi izstudē: http://www.php.net/manual/en/ref.mysql.php Link to comment Share on other sites More sharing options...
hackerman Posted March 4, 2007 Author Report Share Posted March 4, 2007 OK, bet ir problēma: http://paste.php.lv/5257 Es izvadu no tabulas sadaļu "ip" un man parādās piem. 5 ip adreses. Bet iekš array viņš paņem tikai pirmo... Kā to apiet? Link to comment Share on other sites More sharing options...
john.brown Posted March 4, 2007 Report Share Posted March 4, 2007 Tu vari pastāstīt vienkāršiem vārdiem, ko tev dara šitas koda gabaliņš: $ip = $query; $info[] = array("ip" =>"$ip", "website" => $website ); Link to comment Share on other sites More sharing options...
bubu Posted March 4, 2007 Report Share Posted March 4, 2007 Uzmini nu, kas glabājas $query mainīgajā. Link to comment Share on other sites More sharing options...
hackerman Posted March 4, 2007 Author Report Share Posted March 4, 2007 $query mainīgajā glabājas ip adreses. tad sanāk, ka array`ā būtu pieņemsim, ka ir tādas ip: 111 222 333 $info[] = array("ip" =>"111", "222", "333", "website" => $website ); Bet kā jau secināju, tā nevar, tapēc prasu kā to apiet :) Link to comment Share on other sites More sharing options...
john.brown Posted March 4, 2007 Report Share Posted March 4, 2007 (edited) Un ko tev izvada var_dump($query)? Un kas ir domāts ar šito: "ip" =>"111", "222", "333"? Edited March 4, 2007 by john.brown Link to comment Share on other sites More sharing options...
hackerman Posted March 4, 2007 Author Report Share Posted March 4, 2007 Tas, ka, ja zem mainīgā $query ir vairākas ir, tad iekš array tas izskatītos apmēram tā. Nu vnk, lai aiziet, ka tā nevar :) Link to comment Share on other sites More sharing options...
Recommended Posts