Sangsom Posted April 6, 2011 Report Share Posted April 6, 2011 (edited) Sveiki, atkal jau problemina apmeram saprotu ko ka vajag, bet tomer nekas nesanak.. Ceru uz kadiem derigiem ieteikumiem.. Tatad funkcija izskatas shadi: function showGrid($date) { global $title, $niceday, $start_time, $end_time, $venue, $city, $state, $cat, $color, $background, $ed, $usr, $o, $c, $m, $a, $y, $w, $lang, $ap, $status, $table_prefix, $user_id; if ($start_time[$date]) { ksort($start_time[$date]); echo "<ul>\n"; while (list($t) = each($start_time[$date])) { while (list($id,$value) = each($start_time[$date][$t])) { echo "<li>"; echo "<div class=\"item\""; if ($color[$id]) echo " style=\"color: ".$color[$id]."; background: ".$background[$id].";\""; echo ">"; echo "<div class=\"time\">".$value; if ($end_time[$date][$t][$id]) echo " - ".$end_time[$date][$t][$id]; echo "</div>\n"; // izmet usera vardu kas taisa eventu $result = mysql_query("SELECT MAX(users.reg_name) as reg_name ". "FROM events, users ". "WHERE events.user_id = users.user_id and events.event_id = " .$id ); $row = mysql_fetch_array($result); echo $row['reg_name'] ; echo "<div class=\"title\"><a href=\"show_event.php?id=".$id."&o=".$o."&c=".$c."&m=".$m."&a=".$a."&y=".$y."&w=".$w."\" onClick=\"openPic('show_event.php?id=".$id."&size=small','pop','600','400'); window.newWindow.focus(); return false\""; if ($color[$id]) echo " style=\"color: ".$color[$id]."; background: ".$background[$id].";\""; echo ">".$title[$id]."</a></div>\n"; if ($venue[$id]) { echo "<div class=\"venue\">".$venue[$id]."</div>\n"; if ($city[$id]) { echo "<div class=\"location\">".$city[$id]; if ($state[$id]) echo ", ".$state[$id]; echo "</div>\n"; } } echo "</div>"; if ($ed[$id]==true) { echo "<div class=\"edit\">"; if (($ap[$id]==true) && (($status[$id] == 2) || ($status[$id] == 3))) echo "[<a href=\"admin_actions.php?id=".$id."&o=".$o."&c=".$c."&m=".$m."&a=".$a."&y=".$y."&w=".$w."&mode=".approve."\">".$lang["approve"]."</a>] "; echo "[<a href=\"edit_event.php?id=".$id."&o=".$o."&c=".$c."&m=".$m."&a=".$a."&y=".$y."&w=".$w."\" onClick=\"openPic('edit_event.php?id=".$id."&size=small','pop','650','600'); window.newWindow.focus(); return false\">".$lang["edit"]."</a>] [<a href=\"delete_event.php?id=".$id."&o=".$o."&c=".$c."&m=".$m."&a=".$a."&y=".$y."&w=".$w."\">".$lang["delete"]."</a>]</div>\n"; } echo "</li>\n"; } } echo "</ul>\n"; } } Ar vinu viss ir kartiba, bet ir nepieciesams uzlabojums.. Datubaze tika pievienota jauna rindina "deleted", gadijuma kad tiek izdzests events tai rinda uzliekas cipars 1, bet pats events nekur nepazud.. Tatad shaja funkcija gribu pievienot kodu kurs pie dotajiem eventiem kuros ir attiecigi "deleted = 1" naktu klat uzraksts echo "DELETED".. Pec manam domam ir jabut if nosacijumam un query uz MySQL apmeram shadam $deleted = mysql_query("SELECT * FROM events WHERE deleted = 1"); Iespejams kludos, tiesham es vel loti maz ko saprotu no PHP un MySQL.. Butu loti pateicigs ja jus palidzetu sakombinet ar funkciju if nosacijumu .. Ceru ka saprotami uzrakstiju :) Edited April 6, 2011 by Sangsom 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.