vitao.web Posted July 18, 2010 Report Share Posted July 18, 2010 Ir links uz adrese Read more. Tas aizsvies uz readmore.php lapinu. Itka visu izdaru manuprat pareizi, bet zinu neattelo? Kadel ta? KODS Quote Link to comment Share on other sites More sharing options...
briedis Posted July 18, 2010 Report Share Posted July 18, 2010 Loģiska izteiksme? if(!is_numeric($id) || !in_array($cat, $categories)){ "Ja nav skaitlis vai nav masīvā, tad atlasam datus" Un kur ir definēts mainīgais $categories ? Quote Link to comment Share on other sites More sharing options...
101111 Posted July 18, 2010 Report Share Posted July 18, 2010 Pieļauju domu, ka gribēji $id = $_GET['news']; nevis $id = $_GET['id']; Quote Link to comment Share on other sites More sharing options...
vitao.web Posted July 18, 2010 Author Report Share Posted July 18, 2010 (edited) Loģiska izteiksme? if(!is_numeric($id) || !in_array($cat, $categories)){ "Ja nav skaitlis vai nav masīvā, tad atlasam datus" Un kur ir definēts mainīgais $categories ? categories ir defineti ieks configuracijas faila... ka tad man vajadzetu rakstit if{} lai butu ja ir skaitlis/masiva tad atlasam datus? Pieļauju domu, ka gribēji $id = $_GET['news']; nevis $id = $_GET['id']; Ne man vajag tiesi ID, jo pec ta ari izvelos news ko paradit Edited July 18, 2010 by vitao.web Quote Link to comment Share on other sites More sharing options...
101111 Posted July 18, 2010 Report Share Posted July 18, 2010 jā, bet tad tev tas read more linkā jāiekļauj, ko pašlaik neredzu Quote Link to comment Share on other sites More sharing options...
vitao.web Posted July 18, 2010 Author Report Share Posted July 18, 2010 jā, bet tad tev tas read more linkā jāiekļauj, ko pašlaik neredzu <a class='nlink' title='".$rez['title']."' href=readmore.php?news=".$rez['id']."&cat=".$rez['cat']."> A kas tad ir šis? Ja es kaut ko esmu nepareizi sapratis palabojiet mani :) Quote Link to comment Share on other sites More sharing options...
101111 Posted July 18, 2010 Report Share Posted July 18, 2010 readmore.php skriptā šis parametrs būs pieejams kā $_GET['news'] Quote Link to comment Share on other sites More sharing options...
vitao.web Posted July 18, 2010 Author Report Share Posted July 18, 2010 readmore.php skriptā šis parametrs būs pieejams kā $_GET['news'] Ta pat nekas neradas :( Quote Link to comment Share on other sites More sharing options...
101111 Posted July 18, 2010 Report Share Posted July 18, 2010 1) Pārbaudi vai pirms tās pārbaudes mainīgie $id un $cat satur tādu pašu informāciju kā esi paredzējis 2) Pārbaudi vai tā loģiskā izteiksme ir pareiza. es to rakstītu if(is_numeric($id) && in_array($cat, $categories)){.. Quote Link to comment Share on other sites More sharing options...
briedis Posted July 18, 2010 Report Share Posted July 18, 2010 tak vienkārši pietiek skripta sākumā uzrakstīt echo "<pre>"; print_r($_POST); print_r($_GET); echo "</pre>"; un paskatīties, kādi dati tad ir atnākuši... Quote Link to comment Share on other sites More sharing options...
vitao.web Posted July 18, 2010 Author Report Share Posted July 18, 2010 ATRADU KAS PA PROBLEMU: 1) kļūda $id =$_GET['id']; <<< tev bija taisniba vajadzeja nomainit adresi readmore.php?id=21&cat=news 2) kļūda arī if'ā respektīvi '$id bija jāaizstāj ar 'id' if(!is_numeric('id') || !in_array($cat, $categories)){ Nu tagad man iet tā kā vajag :) Quote Link to comment Share on other sites More sharing options...
briedis Posted July 18, 2010 Report Share Posted July 18, 2010 Baa, nu bet protams, ka strings 'id' nekad nebūs skaitlis :D Ko nu tur esi samurgojis! Vispār zini, ko nozīmē tā izsaukuma zīme pirms apgalvojuma? tev tak vajag: ja($id mainīgais ir skaitlis UN $cat ir atrodams $categories masīvā) NEVIS ja($id nav skaitlis VAI $cat neatrodas $categories masīvā) Quote Link to comment Share on other sites More sharing options...
vitao.web Posted July 18, 2010 Author Report Share Posted July 18, 2010 Es jau sen ka esmu pusaizmidzis.. Tatad mans variants nav pareizs? briedi tu jau laikam nojaut ka esmu iesācējs :D Quote Link to comment Share on other sites More sharing options...
briedis Posted July 18, 2010 Report Share Posted July 18, 2010 Es tev nosacījumu uzrakstīju priekšā, vajag tik pārveidod PHP valodā :) Quote Link to comment Share on other sites More sharing options...
vitao.web Posted July 18, 2010 Author Report Share Posted July 18, 2010 vel problema ir ar validesanu ir adrese readmore.php?id=21&cat=news... respektivi taja lapa kur ir read more un ir noradita adrese ar & radas ka kluda un nav valids vairs :( kada alternativa? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.