Jump to content

bishwadeep

Member
  • Posts

    27
  • Joined

  • Last visited

Everything posted by bishwadeep

  1. Hi mccorvic, Since you have not post your code, i am gussing that the error is related to escape string. you can just access the value like: $textareaValue=mysql_escape_string($_POST['textarea name']);
  2. Hi InsiteFX Here is what you nee. Please reply me if you do not understand the process. <?php /* database script CREATE TABLE `menu` ( `id` int(11) NOT NULL auto_increment, `title` varchar(100) collate latin1_general_ci default NULL, `url` text collate latin1_general_ci, `parent` int(11) default NULL, `menuorder` int(11) default NULL, PRIMARY KEY (`id`) ) insert into `menu`(`id`,`title`,`url`,`parent`,`menuorder`) values (1,'Item1','Item1.php',0,1),(2,'Item2','Item2.php',0,2),(3,'Item3','Item3.php',1,3),(4,'Item4','Item4.php',2,4),(5,'Item5','Item5.php',0,5),(6,'Item6','Item6.php',2,6),(7,'Item7','Item7.php',6,7),(8,'Item8','Item8.php',7,8),(9,'Item9','Item9.php',5,9); */ if(mysql_connect("localhost","root","")) mysql_select_db("test") or die("could not select database"); else echo "could not connect"; function getChild($id=0) { static $cates = array(); static $times = 0; $times++; $result = mysql_query("SELECT * FROM menu WHERE parent=$id ORDER BY menuorder"); while($row = mysql_fetch_assoc($result)) { $cates['title'][] = str_repeat("_ ",$times-1).$row['title']; $cates['url'][]=$row['url']; getChild($row['id']); } $times--; return $cates; } echo ""; print_r(getChild(0)); echo ""; ?>
×
×
  • Create New...