Post your trick

Retriving multiple values from a single field of your database

if your having a field in your table which holds multiple values and you want to display the same.then use “spliti”
example:
company_dept is the field name.
$sql=”SELECT *from table_name”;
$ex=mysql_query($sql)
$result=mysql_fetch_array($ex);
$cmp_dept=$result['company_dept'];//when you echo this will display all the values
suppose you want single value then
$dept=spliti(”,”, $cmp_dept, 5);//this will split a string into array
$cnt=count($dept);//this will count the number of elements [...]


Leave a Reply

     

     

     

Post A Trick !

How does "Kodetricks" work?

We at kodeplay like to share knowledge. With Kodetricks, even you can join us. All you need to do is post a programming related trick if you have one or rate a trick if you like someone else's.



Find us on

Technology

Contact Us