Posts

Showing posts from November 18, 2009

how to use explode function in php

Here is the example to use explode function on an array fetched from database values separated by comma ( , ) and count duplicate values also. First create database " your database" and a table named "blog". Enter some data a:- For first row- insert following data---   Ankit, Om For second row- insert following data---   Ankit, Ajeet, Santosh. After that create a php page and paste following coding and change username, password and database name . <table cellpadding="0" cellspacing="0" class="backcolor" style="border: 1px solid rgb(204, 204, 204);"> <?php mysql_connect('localhost','Username','Password'); mysql_select_db('database_name'); $sql = "select tag from blog"; $result = mysql_query($sql)or die('Error in get blog detail'.mysql_error()); $toTagArray = array(); $i=0; while($tag = mysql_fetch_row($result)){ $TagArray = explode(",", $tag[0]); ...