my first php/mysql site

ok have moved on quite a bit since this.

Have now got allt he display functions working, have made it so I can add branches to the database, with a selectable region box. I have even done my first array and sorted the branch names out alphabetically \o/. ( I know that is prolly easy, but man it hurt my head).

The problem I have now is on my display page which shows the branch details, I would like them also sorting in to alphabetical order.

Any ideas how I would do this?

THis is the code I have for displaying the branch details:

Code:
			$i=0;
			while ($i < $num) {
				$bname=mysql_result($result,$i,"a_name");
				$baddress=mysql_result($result,$i,"address");
				$bpost_code=mysql_result($result,$i,"post_code");
				$bfront_line=mysql_result($result,$i,"front_line");
				$bback_line=mysql_result($result,$i,"back_line");
				$bmobile=mysql_result($result,$i,"mobile");
				$bfax=mysql_result($result,$i,"fax");
				$bsite_id=mysql_result($result,$i,"site_id");
				$bemail=mysql_result($result,$i,"email");
		
				echo "<b><a name='$bname'>Site: $bname </a></b><br>Address: $baddress , $bpost_code<br>Front Line: $bfront_line<br>Back Line: $bback_line<br>Mobile: $bmobile<br>Fax: $bfax<br>Email: $bemail<br>Site ID: $bsite_id<br><hr><br>";

				$i++;
			}

but that displays them in the order they were added in to the db which is no good.

How do I sort it into alphabetical order?
 
OMG!!!

YOu have no idea how long it just took me to write a sort array to do that same job lol!!!

Thanks BeanSprout
 
ok I dont have my books with me at home, but am quite addicted to learning this stuff so.....

I have this line:

Code:
echo "<b><a name='$bname'>Site: $bname </a></b><br>Address: $baddress , $bpost_code<br>Front Line: $bfront_line<br>Back Line: $bback_line<br>Mobile: $bmobile<br>Fax: $bfax<br>Email: <a href='mailto:$bemail'>$bemail</a><br>Site ID: $bsite_id<br><hr><br>";

Which basically I want the post code to be a link to the multimap site with the same post code.

Like LS42JE.

However no matter what I try it wont work

Anyone help?
 
Back
Top Bottom