if($region==region){

$result = mysql_query("SELECT * FROM places");
$row = mysql_fetch_assoc($result);
 
echo "zone: ".$row['zone'].";
}

Recommended Answers

All 5 Replies

What are you trying to do?

if($region==region){

should probably be

if($region=="region"){

or

if($region==$region){

who knows..

i mean to say that there's a selection box which have region values. so, whenever the region value is selected, the zone selection values from that region value has to come in the zone selection from the database. i tried that code and it didn't select from the database. i was writing that if the region is selected it must retrive its zone values of the database. this is what i mean...

post require code...

So you want the query to run if a selection is made?

if(isset($region)){
$result = mysql_query("SELECT * FROM places");
$row = mysql_fetch_assoc($result);
 
echo "zone: ".$row['zone']."";
}

If I understand you right.

You want to show the zone from a certain region.

$query = "Select * from places where region = '$region' LIMIT 1";
$result = mysql_query($query);
$row = $mysql_fetch_row($result);

echo $row;

should work. No if.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.