Re_Boot Posted January 4, 2008 Report Posted January 4, 2008 Taa, kads ludzu vareetu man shaja foruma izskaidrot, kaa darbojas taa lieta ar piemeram: "http://blablabla.lv/ierocis?=11". Nu man vajag lai viena mana PHP, vinjs nolasa to ID no datubazes, piemeram, man vajag lai vinjs nolasa ieroci id_ierocis - pienjemsim 11, un paraada to ko vinjam vajag raadit.. Karoche sakiet ja kautko nesaprataat, megjinashu paskaidrot siikak.. :D
Re_Boot Posted January 4, 2008 Author Report Posted January 4, 2008 Tiesham neviens nevar paliidzet!? :(
martins256 Posted January 4, 2008 Report Posted January 4, 2008 nu visi mainīgie linkā tiek salikti iekš $_GET[] http://blablabla.lv/?ierocis=11 // skaties uz ? piem $_GET['ierocis'] būs 11 un tad jau jāslēdzās klāt datubāzei un jāvelk ārā...
Re_Boot Posted January 4, 2008 Author Report Posted January 4, 2008 Vari ludzu ko vairak paskaidrot? :(
andrisp Posted January 4, 2008 Report Posted January 4, 2008 (edited) if (isset($_GET['ieroci']) && is_numeric($_GET['ierocis'])) { $ierocis = intval($_GET['ierocis']); $sql = "SELECT * FROM ierochi WHERE id = ".$ierocis; // tālāk skaties php.net/mysql } Edited January 4, 2008 by andrisp
eregi Posted January 4, 2008 Report Posted January 4, 2008 (edited) andrisp, kam izmanto intval? (: saprat. php.net/intval tik nezin, cik tas ir vajadzīgs. Edited January 4, 2008 by eregi
Kristabs Posted January 4, 2008 Report Posted January 4, 2008 Tik grūti attaisīt manuāli?? http://lv.php.net/intval
Re_Boot Posted January 4, 2008 Author Report Posted January 4, 2008 (edited) Es tur nevaru atrast... Sorry par stulbumu... andrisp Man sii lieta patiesham ir vajadziga! Ludzu iedodiet kadu guide :(.. Velams ar precizu linku! Edited January 4, 2008 by Re_Boot
andrisp Posted January 4, 2008 Report Posted January 4, 2008 (edited) eregi, jo is_numeric laizh cauri arii hexadecimaalus, floatiigus un visaadus citaadus skaitlju formaatus. Edited January 4, 2008 by andrisp
eregi Posted January 4, 2008 Report Posted January 4, 2008 Re_Boot - nū, andrisp Tev visu pareiz parādija - if(isset($_GET['ierocis']) && is_numeric($_GET['ierocis'])) { $ierocis=intval($_GET['ierocis']; $SQL=mysql_query("SELECT * FROM db.tabula WHERE Ierocis=".$ierocis.""); $row = mysql_fetch_assoc($SQL); echo $row['Ierocis']; } else { echo 'nav numeraals'; } andrisp - būs laikam jāpārlabo pāris rindiņas man pāris projektos tātad (:
Re_Boot Posted January 5, 2008 Author Report Posted January 5, 2008 (edited) Un tad karo4 man jaraksta http://manswebs.lv/ieroci.php?ierocis=1 ? Kad ielieku to skriptu? Edited January 5, 2008 by Re_Boot
Aleksejs Posted January 5, 2008 Report Posted January 5, 2008 Izlasi šo: http://php.lv/f/index.php?showtopic=8749 un tad mēģini atbildēt uz saviem jautājumiem. Par rezultātiem ziņo.
Re_Boot Posted January 5, 2008 Author Report Posted January 5, 2008 Hmm.. Es parskatiju .doc failu, un to ko rakstija mikijs, bet neatradu to ko man isti vajadzeja! :(
Aleksejs Posted January 5, 2008 Report Posted January 5, 2008 Aizdomīgi ātri apskatīji... Tas, ko Tev vajag - ir sapratne par programmēšanu kā tādu un valodā PHP pieejamajiem līdzekļiem. Tu šobrīd demonstrē to, ka tev šīs sapratnes nav - vēl sliktāk: Tu demonstrē, ka nevari normāli noformulēt problēmu. Tad, kad Tev lūdz noformulēt jautājumu konkrētāk, Tu to nedari.
Re_Boot Posted January 5, 2008 Author Report Posted January 5, 2008 (edited) Man vajag nu pienjemsim, takaa sheit http://php.lv/f/index.php?showtopic=8762 lai vinjs no manas datubazes, nolasa un paraada visu ko vajag, piemeram ?ipashums=1 <-- tas laikam ir ROW, isti nezinu... Edited January 5, 2008 by Re_Boot
Recommended Posts