I want to be able to take data out of the database I have, and display it, into multiple columns, alphabetically.
I can only figure out how to this myself by exporting ID's 1-10, then 11-20, 21-30 etc and placing each id as an SQL query and echoing it into the page. This does not help me and seems very time consuming.
Does anyone know how I could query so I could have letters A-G in column 1, H-N in column 2, O-U in column 3, V-Z in column 4, and all numerics in column 5, where the letter or numeric is only based on the first character of the word/business.
Any help would be great. I'll show you what my SQL looks like at the moment.Code:<?php include('conn_mysql.inc'); // create database connection $conn = dbConnect('query'); $sql = 'SELECT * FROM hosts WHERE HostID>=1 AND HostID<=4 ORDER BY HostName ASC '; $result = mysql_query($sql) or die(mysql_error()); $sql2 = 'SELECT * FROM hosts WHERE HostID>=5 AND HostID<=8 ORDER BY HostName ASC '; $result2 = mysql_query($sql2) or die(mysql_error()); $sql3 = 'SELECT * FROM hosts WHERE HostID>=9 AND HostID<=12 ORDER BY HostName ASC '; $result3 = mysql_query($sql3) or die(mysql_error()); ?>