PHP Tips
###1:
This week I will show you how to generate dynamic <li> under <ul> contains country and when the < li> will selected a dynamic class generate:
ini_set(‘display_errors’,1);
$con = mysql_connect(“192.168.1.100″,”codez”,”codez123″);
$database = mysql_select_db(“dealer_db”,$con);
$dirStateInput = $_GET['msg'];
$query = “SELECT * FROM dealerdetails WHERE state LIKE ‘”.$dirStateInput.”‘”;
$result = mysql_query($query,$con);
$num = mysql_num_rows($result);
$x = 1;
$output=”";
?>
<ul >
<?php
ini_set(‘display_errors’,1);
$con = mysql_connect(“192.168.1.100″,”codez”,”codez123″);
$database = mysql_select_db(“dealer_db”,$con);
$query =”SELECT DISTINCT(State) FROM dealerdetails”;
$result = mysql_query($query,$con);
while($State = mysql_fetch_array($result))
{
?>
<li ><a href=”dealers.php?msg=<?php echo $State['State']; ?>” class=”<?php if($dirStateInput==$State['State']){ echo “aboutnavactive”;}?>”><?php echo $State['State']; ?></a></li>
<?php }?>
</ul >
###2:
In php maker if you want to display some selected field on the page which displays the field then you have to delete extra field and corresponding value field also. If you want to change some text in php maker files then there is a very quick process. You have to search the value of those field by field id in English.xml in lang folder. You not have to generate again and again php files by php maker. Try this it is very quick process.
Latest posts by Sahel Aktar
- SQL Query Optimization - September 21st, 2011
- How to create Google Charts - August 17th, 2011
- How to work with ckfinder and ckeditor incase of image upload - July 11th, 2011
- PHP Thumbnail Generator - June 15th, 2011
- SQL Training - April 25th, 2011
