Jump to content

afaaro

Members
  • Posts

    74
  • Joined

  • Last visited

Everything posted by afaaro

  1. Woooow Thats amazing Psycho Thank you so much
  2. I have got this one but it's only working with small letters and numbers, how can i make both lower case and upper case and numbers as well. this is the query am using right now dbquery("UPDATE ".CATEGORY." SET category_url=CONCAT(LOWER(SUBSTRING((CONV(SUBSTRING(RAND(), 3), 10, 36)), 1, ))");
  3. function parse_youtube_url($url,$return='embed',$width='',$height='',$rel=0){ $urls = parse_url($url); //url is http://youtu.be/xxxx if($urls['host'] == 'youtu.be'){ $id = ltrim($urls['path'],'/'); } //url is http://www.youtube.com/embed/xxxx else if(strpos($urls['path'],'embed') == 1){ $id = end(explode('/',$urls['path'])); } //url is xxxx only else if(strpos($url,'/')===false){ $id = $url; } //http://www.youtube.com/watch?feature=player_embedded&v=m-t4pcO99gI //url is http://www.youtube.com/watch?v=xxxx else{ parse_str($urls['query']); $id = $v; if(!empty($feature)){ $id = end(explode('v=',$urls['query'])); } } //return embed iframe if($return == 'embed'){ return '</pre> <iframe src="http://www.youtube.com/embed/'.$id.'?rel='.$rel.'" frameborder="0" width="'.($width?$width:560).'" height="'.($height?$height:349).'"></iframe> <pre>'; } //return normal thumb else if($return == 'thumb'){ return 'http://i1.ytimg.com/vi/'.$id.'/default.jpg'; } //return hqthumb else if($return == 'hqthumb'){ return 'http://i1.ytimg.com/vi/'.$id.'/hqdefault.jpg'; } // else return id else{ return $id; } } Image: echo "<img src='".parse_youtube_url($row['link'],'thumb')."' />"; Embed: echo parse_youtube_url($dbrow['link'],'embed');
  4. $result = dbquery("SELECT o.name name, o.image image, o.type type, o.link link, o.id id, o.date, o.category, c.id catid, c.name catname FROM ".NODE." o LEFT JOIN ".ARGUMENT." c ON c.id=o.category WHERE type='video' AND category IN(39,40,41,42,43,44,45,46,47,48,49,50,62,63,64,65,66,67,68,69,70,71,72,73,74,75) ORDER BY date DESC LIMIT 40"); $rows = dbcount("(id)", "".NODE.""); if ($rows != 0) { echo "<div class='video'>"; while ($data = dbarray($result)) { echo "<div class='grid'>"; if ($data['image']) { $image = "<a href='node.php?cat_id=".$data['catid']."&id=".$data['id']."'><img src='".INFUSIONS."node/uploads/".$data['image']."'></a>"; }elseif ($data['link']) { $image = "<a href='node.php?cat_id=".$data['catid']."&id=".$data['id']."'><img src='".parse_youtube_url($data['link'],'thumb')."' /></a>"; } else { $image = "<a href='node.php?cat_id=".$data['catid']."&id=".$data['id']."'><img src='".INFUSIONS."node/images/nophoto.jpg' /></a>"; } echo $image; echo "<a class='gridtitle' href='node.php?cat_id=".$data['catid']."&id=".$data['id']."'>".trimlink($data['name'],30)."</a>"; echo "</div>"; } echo "</div>"; } is there any better than this category IN(39,40,41,42,43,44,45,46,47,48,49,50,62,63,64,65,66,67,68,69,70,71,72,73,74,75)
  5. I have 3 main categories and each category has unlimited parent category 1. category 1 has 4 child which this one category IN (57,58,59, 60) 2. category 2 has 20 child categories, i dont know wether to use like this category IN (1,,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) 3. category 3 has 20 child categories and child again so how can i do it
  6. Example i have this category: main category1: 57 child: 58 child 59 child 60 main category1: 39 child so on there another category has 50 child category
  7. is it like this $result = dbquery("SELECT o.*, c.id catid, c.name catname FROM ".NODE." o LEFT JOIN ".ARGUMENT." c ON c.id=o.category WHERE category='57,58,59,60' ORDER BY o.date DESC"); echo "<table class='tbl-border' width='100%'>"; echo "<tr><td class='tbl2'>Title</td><td class='tbl2'>Category</td></tr>"; $cat = null; # no category processed yet while ($row = dbarray($result)) { if($cat===null || $cat <> $row['catname']){ // first category, or the category has changed echo "<tr><th>{$row['catname']}</th></tr>"; # print category name $cat = $row['catname']; # set $cat to the new category } echo "<tr><td class='tbl'>".$row['name']."</td></tr>"; # print the item $i++; }
  8. one more question if i want to display parent category and it's child and child contents is it possible in that way instead of listing category ids0
  9. Awsome, Thank you so much Josh. I was really searching for this about 3days. again thank you
  10. I want to get posts table from 3 different category like the one i put WHERE category='57,58,59,60' ORDER BY o.date DESC
  11. dbquery stands mysql_query, dbarray stands mysql_fetch_assoc ".NODE." is the post table ".ARGUMENT." is the category table $inf_newtable[1] = "".$db_prefix."nodeCategory ( `id` int(11) unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', `parent` int(11) NOT NULL default '0', `body` text NOT NULL, `image` varchar(255) NOT NULL default '', `count` int(11) NOT NULL, `locked` int(11) NOT NULL default '0', `access` int(1) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM;"; $inf_newtable[2] = "".$db_prefix."nodeObject ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', `category` int(10) NOT NULL default '0', `type` enum('news','video','audio') NOT NULL default 'news', `link` varchar(255) NOT NULL default '', `body` text NOT NULL, `image` varchar(255) NOT NULL default '', `date` int(10) UNSIGNED NOT NULL DEFAULT '0', `author` int(10) UNSIGNED NOT NULL DEFAULT '1', `count` int(10) NOT NULL, `locked` int(10) NOT NULL default '0', `access` int(1) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM;";
  12. I have tried this but no luck $result = dbquery("SELECT o.*, c.id catid, c.name catname FROM ".NODE." o LEFT JOIN ".ARGUMENT." c ON c.id=o.category WHERE category='57,58,59,60' ORDER BY o.date DESC"); echo "<table class='tbl-border' width='100%'>"; echo "<tr><td class='tbl2'>Title</td><td class='tbl2'>Category</td></tr>"; while ($row = dbarray($result)) { echo "<tr><td class='tbl'>".$row['name']."</td><td>".$row['catname']."</td></tr>"; $i++; } echo "</table>";
  13. Thank you so much Musiko your code worked if (!isset($_POST['catname'])) { $result = $db->query("SELECT * FROM category WHERE cid='$cid'"); $row = $result->fetch_array(); $acid = $row['cid']; $catname = $row['catname']; $catdesc = $row['catdesc']; } and with this if($save){ $stmt = $db->stmt_init(); $stmt = $db->prepare("UPDATE category SET catname=?,catdesc=? WHERE cid=?"); #$db->query("UPDATE category SET catname=$catname,catdesc=$catdesc WHERE cid=$cid"); $stmt->bind_param('ssi',$catname,$catdesc,$cid); $stmt->execute(); echo "<meta http-equiv='refresh' content='0;URL=index.php?page=articles'>"; }else{ #echo "Prepare Error : ' . $db->error . ' Num Error : . $db->errno"; echo "<div align='center' id='errorText'><b>$msg</b></div>"; } And thanks to blacknight as well;
  14. I am using index.php in my root index.php?page=articles
  15. I have put error_reporting(E_ALL); ini_set("display_errors", 1); but still nothing is coming up
  16. still i don't understand why is happining without update
  17. This is the code am using in the page <?php /** * @author Afaaro * @copyright 2012 * @type articles */ if (!defined("_LOAD")) { die("<table style='padding: 2px; border: 1px solid #999; background-color: #EEE; font-family: Verdana; font-size: 10px;' align='center'><tr><td><b>Error:</b> This file cannot be actened directly!</td></tr></table>"); } if (isset($_GET['op'])) { $op = $_GET['op']; } else { $op = ""; } if (isset($_GET['ok'])) { $ok = $_GET['ok']; } else { $ok = false; } if (isset($_GET['cid'])) { $cid = $_GET['cid']; } else { $cid = ""; } if (isset($_POST['catname'])) { $catname = $_POST['catname']; } else { $catname = ""; } if (isset($_POST['catdesc'])) { $catdesc = $_POST['catdesc']; } else { $catdesc = ""; } function catList(){ global $db; $n = 0; echo "<table width='100%' align='center' cellspacing='1' cellpadding='0' class='std_nicetable'>"; echo "<thead>\n"; echo "<a href='index.php?page=articles&op=addCategory'>Add category </a>"; echo "<tr><td>Title<td>catdesc</td><td width='1%'> </td></tr>\n"; echo "</thead>\n"; echo "<tbody>\n"; if ($result = $db->query("SELECT * FROM category ORDER BY catname")) { while($row = $result->fetch_assoc()){ $cid = intval($row['cid']); $name = $row['catname']; $catdesc = $row['catdesc']; $class = (($n++%2)!=0) ? "hlight" : "clean" ; echo "<tr><td class='$class'><b>$name</b><td>$catdesc</td><td class='$class' nowrap><div align='right'><a href='index.php?page=articles&op=editCategory&cid=$cid' title='Modify'><img src='images/edit.gif' alt='Edit' border='0'></a> <a href='index.php?page=articles&op=delCategory&cid=$cid' title='Delete'><img src='images/delete.gif' alt='Delete' border='0'></a></div></td></tr>\n"; } } else { echo "<tr><td align='center' id='errorText' class='clean'><b>No Category defined</b></td></tr>"; } echo "</tbody>\n"; echo "</table>"; } function addcat($catname,$catdesc,$ok=false){ global $db; if (!$ok) { echo "<table width='100%' align='center' cellspacing='0' cellpadding='1'>\n"; echo "<form name='form_arg' method='post' action='index.php?page=articles&op=addCategory&ok=true'>"; echo "<tr><td width='25%'><b>Title</b><td><input type='text' name='catname' size='40' maxlength='255'>\n"; echo "<tr><td><b>catdescription</b><td><input type='text' name='catdesc' size='40' maxlength='255'>\n"; echo "<tr><td colspan='2'><input type='submit' name='Submit' value='Add'>\n"; echo "</form>\n"; echo "</table>\n"; } else { $save = true; if ($catname=="") { $save = false; $msg = "Name field is empty!";} if ($catdesc=="") { $save = false; $msg = "catdescription field is empty!";} if($save){ $stmt = $db->prepare("INSERT INTO category VALUES (?, ?, ?)"); $stmt->bind_param('iss', $cid, $catname, $catdesc); $stmt->execute(); echo "<meta http-equiv='refresh' content='0;URL=index.php?page=articles'>"; }else{ echo "<div align='center' id='errorText'><b>$msg</b></div>"; } } } function editcat($cid,$catname,$catdesc,$ok=false) { global $db; $cid = intval($cid); $result = $db->query("SELECT * FROM category WHERE cid='$cid'"); $row = $result->fetch_array(); $acid = $row['cid']; $catname = $row['catname']; $catdesc = $row['catdesc']; if (!$ok) { echo "<table width='100%' align='center' cellspacing='0' cellpadding='1'>\n"; echo "<form name='form_arg' method='post' action='index.php?page=articles&op=editCategory&cid=$acid&ok=true'>"; echo "<tr><td width='25%'><b>Name</b><td><input type='text' name='catname' size='40' maxlength='255' value=\"$catname\">\n"; echo "<tr><td><b>catdescription</b><td><input type='text' name='catdesc' size='40' maxlength='255' value=\"$catdesc\">\n"; echo "<tr><td colspan='2'><input type='submit' name='Submit' value='Modify'>\n"; echo "</form>\n"; echo "</table>\n"; } else { $save = true; if ($catname=="") { $save = false; $msg = "Name field is empty!";} if ($catdesc=="") { $save = false; $msg = "catdescription field is empty!";} if($save){ if ($stmt = $db->prepare("UPDATE category SET catname=?,catdesc=? WHERE cid=?")) { // Use same IF previous example to control the prepare $stmt->bind_param('ssi',$catname,$catdesc,$cid); // Use same IF previous example to control the execute $stmt->execute(); $stmt->close(); // you can drop this line to... close() occur automatic when the script end. } else { echo "Prepare Error : ' . $stmt->error . ' Num Error : . $stmt->errno"; // here decide what to do next } }else{ echo "<div align='center' id='errorText'><b>$msg</b></div>"; } } } function delcat($cid,$ok=false){ global $db; if ($ok) { $db->query("DELETE FROM category WHERE cid='$cid'"); echo "<meta http-equiv='refresh' content='0;URL=index.php?page=articles'>"; } else { echo "<div align='center'><b>Are you sure you want to delete?</b><br><a href='index.php?page=articles&op=delCategory&cid=$cid&ok=true' title='Yes'>Yes</a> - <a href='admin.php?page=arguments' title='No'>No</a></div>"; } } openTable(); switch($op) { case "addCategory": addcat($catname,$catdesc,$ok); break; case "editCategory": editcat($cid,$catname,$catdesc,$ok); break; case "delCategory": delcat($cid,$ok); break; case "showCategories": default: catList(); break; } closeTable(); ?>
  18. i know but it's not updating at all
  19. When i edit it shows the same value nothing else 1 - Demo1 - demo1 - 1
  20. I have tried this one but it is not working at all
  21. Hello everyone about 7 days am experiencing this problem if you can help me out this is the code; it's not updating at all it's just redirecting me to the page $db = new mysqli($dbHost, $dbUser, $dbPass, $dbName) or die (mysql_error()); function editcat($cid,$catname,$catdesc,$ok=false) { global $db; $id = intval($cid); $result = $db->query("SELECT * FROM category WHERE cid='$cid'"); $row = $result->fetch_array(); $cid = $row['cid']; $catname = $row['catname']; $catdesc = $row['catdesc']; if (!$ok) { echo "<table width='100%' align='center' cellspacing='0' cellpadding='1'>\n"; echo "<form name='form_arg' method='post' action='index.php?page=articles&op=editCategory&cid=$id&ok=true'>"; echo "<tr><td width='25%'><b>Name</b><td><input type='text' name='catname' size='40' maxlength='255' value=\"$catname\">\n"; echo "<tr><td><b>catdescription</b><td><input type='text' name='catdesc' size='40' maxlength='255' value=\"$catdesc\">\n"; echo "<tr><td colspan='2'><input type='submit' name='Submit' value='Modify'>\n"; echo "</form>\n"; echo "</table>\n"; } else { $save = true; if ($catname=="") { $save = false; $msg = "Name field is empty!";} if ($catdesc=="") { $save = false; $msg = "catdescription field is empty!";} if($save){ $stmt = $db->stmt_init(); $stmt = $db->prepare("UPDATE category SET catname=?,catdesc=? WHERE cid=?"); $stmt->bind_param('ssi',$catname,$catdesc,$cid); $stmt->execute(); $stmt->close(); echo "<meta http-equiv='refresh' content='0;URL=index.php?page=articles'>"; }else{ echo "<div align='center' id='errorText'><b>$msg</b></div>"; } } } switch($op) { case "addCategory": addcat($catname,$catdesc,$ok); break; case "editCategory": editcat($cid,$catname,$catdesc,$ok); break; case "delCategory": delcat($cid,$ok); break; case "showCategories": default: catList(); break; }
  22. Is there anyone can help me with the above code?
  23. Hi everyone, this is my first topic I really need help if someone can give me a solution. In my database; am using 2 provider which is Youtube and Blip Example I want to make if the file is youtube it should play youtube and when is blip it should play blip. How can i do it. These are the database and code ".$db_prefix."video_config ( `key` varchar(255) collate latin1_general_ci NOT NULL, `value` text collate latin1_general_ci NOT NULL, UNIQUE KEY `key` (`key`) ) TYPE=MyISAM;"; "".$db_prefix."video_config (`key`, `value`) VALUES ('thumbnail', 'http://i.ytimg.com/vi/{{VIDEOID}}/default.jpg'), ('width', '425'), ('height', '355'), ('code', '<object width=\"{{W}}\" height=\"{{H}}\"><param name=\"movie\" value=\"http://www.youtube.com/v/{{VIDEOID}}\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/v/{{VIDEOID}}\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"{{W}}\" height=\"{{H}}\"></embed></object>'), ('blipv', '<embed src=\"http://a.blip.tv/scripts/flash/showplayer.swf?file=http://blip.tv/rss/flash/{{VIDEOID}}\" type=\"application/x-shockwave-flash\" width=\"{{W}}\" height=\"{{H}}\" allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed>')"; $patterns = array('{{W}}','{{H}}','{{VIDEOID}}'); $replaces = array($width,$height,$videoid); $player = str_replace($patterns,$replaces,outCode($config['code'])); $thumbnail = str_replace("{{VIDEOID}}",$videoid,outCode($config['thumbnail'])); $thumbnail = "<img src='$thumbnail' border='0' width='41' height='34' alt='' align='left' class='box' style='margin:3px 6px 0 2px;' />"; This one [ outCode($config['code']) ] is just youutbe and I need to use this one as well [outCode($config['blipv']) ]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.