IBEX Posted October 19, 2008 Report Share Posted October 19, 2008 isset + get no db Kāds varētu pastāstīt par šo lietu? Esmu izveidojis, tadu lietu, ka man aiznes pieream uz lapu video, tur paradas kategorijas kadas ir iespejamas un man ir nepiecieshams lai uzpiezhot uz kategorijas (piem. muzika) aizved ari uz to muzikas sadalu, kur ir tie muzikas klipi un talak uzpiezhot uz ta klipa uz pashu klipu.. cik noprotu ar isset un get tas butu iespejams? kads nevaretu paradit kā?.. pavisam simple tikai :) Link to comment Share on other sites More sharing options...
bubu Posted October 19, 2008 Report Share Posted October 19, 2008 Ja godīgi - nekā nesapratu kāds kaut kādam isset un "get no db" (wtf?) ir sakars ar tavu bezsakarīgi garo teikumu.. Kur tieši ir problēma? Link to comment Share on other sites More sharing options...
anonīms Posted October 19, 2008 Report Share Posted October 19, 2008 <?php if($_GET['sadala'] == 'video') { include "lapas/video.php"; } elseif($_GET['sadala'] == 'galerija') { include "lapas/galerija"; } else { include "lapas/sakums.php"; } ?> Tad video.php failā $visi_video = mysql_query("SELECT * FROM video"); while($video = mysql_fetch_array($visi_video)) { echo "<a href="?sadala=video&id=".$video['0'].">Video bilde</a>"; } un kad aizet uz katru noteikto video tad $video = mysql_query("SELECT * FROM video where id = {$_GET['id']}"); $video = mysql_fetch_array($video); un viss pārējais.. Laikam par to domāji. Link to comment Share on other sites More sharing options...
IBEX Posted October 19, 2008 Author Report Share Posted October 19, 2008 nu tie ir tie hiperlinki, jāā, tas jeu man bija, bet man vajag, kipa kad uzpiezh uz to ?sadala=video&id=7 tad ari kkas paradaas nevis balta lapa :) cik noprotu tas ar if (!isset($_GET['cat_id']) || !isnum($_GET['cat_id'])) { kko tadu ir dabunams gatavs, bet kaaa?.. :/ Link to comment Share on other sites More sharing options...
KarlisBa Posted October 19, 2008 Report Share Posted October 19, 2008 (edited) Tev tak tikko to iepriekšējā postā parādīja... Ja url'ī ir http://kautkas.com/index.php?sadala=video Tad to arī attiecīgi nolasa: if (isset($_GET['sadala']) AND $_GET['sadala'] == "kas") { echo "attiecīgā sadaļa - video"; } Edited October 19, 2008 by KarlisBa Link to comment Share on other sites More sharing options...
IBEX Posted October 19, 2008 Author Report Share Posted October 19, 2008 (edited) <?php $result = mysql_query("select * from category ORDER BY id"); while($r=mysql_fetch_array($result)) { $id=$r["id"]; $name=$r["name"]; if (isset($_GET['id']) AND $_GET['id'] == "video") { echo "<a href='?id=video?cat=$id'>$name</a> | "; } } ?> Kods tas.. nu sanak, ka paradas man tas kategorijas, bet uzpiezhot uz linka aiziet uz baltu lapu.. Ka man shaja lapa kko ieksha dabut? :) plz :))) Edited October 19, 2008 by IBEX Link to comment Share on other sites More sharing options...
anonīms Posted October 23, 2008 Report Share Posted October 23, 2008 <?php if($_GET['id'] == 'video' AND $_GET['cat']) { $rez = mysql_query("SELECT * FROM video WHERE cat = {$_GET['cat']}"); while($rr = mysql_fetch_array($rez)) { echo '<a href="?id=video&cat='.$_GET['cat'].'&video_id='.$rr['id'].'">'.$rr['video_nosaukums'].'</a>'; } } else { $result = mysql_query("select * from category ORDER BY id"); while($r=mysql_fetch_array($result)) { $id=$r["id"]; $name=$r["name"]; echo "<a href='?id=video&cat=$id'>$name</a><br />"; } } } ?> un vispaŗ tev tur sanāca tas links www.tavalapa.lv/?id=video?cat=1, bet vajadzēja www.tavalapa.lv/?id=video&cat=1 Link to comment Share on other sites More sharing options...
IBEX Posted October 27, 2008 Author Report Share Posted October 27, 2008 ahaa.. sk.. un tālāk, man sanāk.. <?php if($_GET['id'] == 'video' AND $_GET['cat'] te vel likt to video_id un get to id ne? ) { $rez = mysql_query("SELECT * FROM video WHERE cat = {$_GET['cat']}"); while($rr = mysql_fetch_array($rez)) { echo 'te naks info par video'; } } else { if($_GET['id'] == 'video' AND $_GET['cat']) { $rez = mysql_query("SELECT * FROM video WHERE cat = {$_GET['cat']}"); while($rr = mysql_fetch_array($rez)) { echo '<a href="?id=video&cat='.$_GET['cat'].'&video_id='.$rr['id'].'">'.$rr['video_nosaukums'].'</a>'; } } else { $result = mysql_query("select * from category ORDER BY id"); while($r=mysql_fetch_array($result)) { $id=$r["id"]; $name=$r["name"]; echo "<a href='?id=video&cat=$id'>$name</a><br />"; } } } ?> Link to comment Share on other sites More sharing options...
anonīms Posted October 28, 2008 Report Share Posted October 28, 2008 <?php if($_GET['id'] == 'video' AND $_GET['cat'] AND $_GET['video_id'] { $vidd = mysql_query("SELECT * FROM video WHERE id = {$_GET['video_id']}"); $vidd = mysql_fetch_arraY($vidd); } else { if($_GET['id'] == 'video' AND $_GET['cat']) { $rez = mysql_query("SELECT * FROM video WHERE cat = {$_GET['cat']}"); while($rr = mysql_fetch_array($rez)) { echo '<a href="?id=video&cat='.$_GET['cat'].'&video_id='.$rr['id'].'">'.$rr['video_nosaukums'].'</a>'; } } else { $result = mysql_query("select * from category ORDER BY id"); while($r=mysql_fetch_array($result)) { $id=$r["id"]; $name=$r["name"]; echo "<a href='?id=video&cat=$id'>$name</a><br />"; } } } ?> Link to comment Share on other sites More sharing options...
IBEX Posted October 29, 2008 Author Report Share Posted October 29, 2008 (edited) mjā, tā jeu domāju, ok, liels paldies, tas tākā būtu, bet viņam kkas nepatīk.. Undefined index: cat in C:\Program Files\EasyPHP 2.0b1\www\own\switch\video.php on line 2 cik sapratu, ka nau linkā tie parametri kas ir if norādīti, tāpēc viņš bļauj.. kā tikt no tā vaļā?.. :/ if($_GET['id'] == 'video' AND $_GET['cat'] AND $_GET['video_id']) <--- otra linija.. Edited October 29, 2008 by IBEX Link to comment Share on other sites More sharing options...
Val Posted October 29, 2008 Report Share Posted October 29, 2008 skat. postu #5 Link to comment Share on other sites More sharing options...
IBEX Posted October 29, 2008 Author Report Share Posted October 29, 2008 ERROR REPORTING palidzeja :) Tnx :) Link to comment Share on other sites More sharing options...
Val Posted October 29, 2008 Report Share Posted October 29, 2008 vispār jau problēma palika; tu viņu tikai "paslēpi". Link to comment Share on other sites More sharing options...
IBEX Posted October 29, 2008 Author Report Share Posted October 29, 2008 nuuu, jā, bet ka savādāk.. nesaprotu.. :/ <?php if($_GET['id'] == 'video' AND $_GET['cat'] AND $_GET['video_id']) { $vidd = mysql_query("SELECT * FROM video WHERE video_id = {$_GET['video_id']}"); $vidd = mysql_fetch_arraY($vidd); { echo ' <center>' . $vidd['name'] . '</center> <BR> <center>' . $vidd['url'] . '</center> <BR> <center>' . $vidd['description'] . '</center> '; } } else { if($_GET['id'] == 'video' AND $_GET['cat']) { $rez = mysql_query("SELECT * FROM video WHERE cat = {$_GET['cat']}"); while($rr = mysql_fetch_array($rez)) { echo ' <a href="?id=video&cat='.$_GET['cat'].'&video_id='.$rr['video_id'].'">'.$rr['name'].'</a> | '; } } else { $result = mysql_query("select * from video_category ORDER BY id"); while($r=mysql_fetch_array($result)) { $id=$r["id"]; $name=$r["name"]; $pic=$r["pic"]; echo " <a href='?id=video&cat=$id'>$name</a> | <img src='$pic' alt='$name'>"; } } } ?> Nez, ja vēlies būt tik laipns :) Link to comment Share on other sites More sharing options...
anonīms Posted October 29, 2008 Report Share Posted October 29, 2008 ar isset Link to comment Share on other sites More sharing options...
Recommended Posts