Hi brothers I am new here need help with the php programing using sql basically I am given a task to create a php code that is able to query the database on some free hosting web which I alreadx have the database done right now I am trying to query the database and I have no idea how to do it I wanted to find the value between the Latitude top, latitude bottom and longtitude top and longtitude bottom if it is between it will return the districtname I alreadx have the table done except the coding this is what I currently have:
[code=php]<?php
//connect to my database
$sqlconnect=mys ql_connect("loc alhost","__mung ed__","__munged __");
if(!$sqlconnect )
die(mysql_error ());
mysql_select_db ("hyperian_trac k", $sqlconnect);
$fetched=mysql_ query("SELECT districtname FROM location,distri ct
WHERE location.lat < district.startl at AND location.lat > district.endlat AND location.lng < district.startl ng AND location.lng > district.endlng ");
while($row = mysql_fetch_arr ay($fetched))
{
$result=$row[$districtname];
return $result;
}[/code]
[Please use CODE tags when posting source code. Thanks! --pbmods]
Is my code correct? I first time using php so is unsure please guide me thx alot brothers!!
[code=php]<?php
//connect to my database
$sqlconnect=mys ql_connect("loc alhost","__mung ed__","__munged __");
if(!$sqlconnect )
die(mysql_error ());
mysql_select_db ("hyperian_trac k", $sqlconnect);
$fetched=mysql_ query("SELECT districtname FROM location,distri ct
WHERE location.lat < district.startl at AND location.lat > district.endlat AND location.lng < district.startl ng AND location.lng > district.endlng ");
while($row = mysql_fetch_arr ay($fetched))
{
$result=$row[$districtname];
return $result;
}[/code]
[Please use CODE tags when posting source code. Thanks! --pbmods]
Is my code correct? I first time using php so is unsure please guide me thx alot brothers!!
Comment