Re: Query Results Question - Solved

From: Date: Wed, 04 Aug 2004 02:32:22 +0000
Subject: Re: Query Results Question - Solved
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-192657@lists.php.net to get a copy of this message
Many thanks Richard. I have the table presenting neatly now, thanks for all your help with this one...! -- ----------------------------- Michael Mason Arras People www.arraspeople.co.uk ----------------------------- "Richard Bewley" <rbewley@eq-sys.com> wrote in message news:php.general-192652@news.php.net... > > I'm only selecting a few fields Richard as I want to try and drop them > into > an array and display in a table. > > > I know I'm probably going the long way around doing this but I need to > learn > from scratch exactly how to do it. > > > I appreciate your help and patience very much. > > > I've managed to get the query returning some results now. An array. I'm > going to have to spend a little, well actually quite a bit, of time now > working out how to present these in a table. > > > I assume a for statement will get me pointing in the right direction...? > > You are correct that the mysql_fetch_array will return an array which you > can format into a table. You can use a while loop if you would like, which > is probably the simplest. > > <?<php > $query = mysql_query("SELECT > ID,Vacancy_Role,Vacancy_Salary,Vacancy_Location,Vacancy_Type FROM > vacancy_details WHERE Publish='Yes'"); > > echo "<table cellspacing=\"4\" cellpadding=\"4\" width=\"50%\">\n"; > echo "<tr><td><b>ID:</b></td><td><b>Vacancy Role:</b></td><td><b>Vacancy > Salary</b></td><td><b>Vacancy Location</b></td><td>Vacancy > Type</b></td></tr>\n"; > > while($result = mysql_fetch_array($query)) { > echo > "<tr><td>$result[id]</td><td>$result[Vacancy_Role]</td><td>$result[Vacancy_S > alary]</td><td>$result[Vacancy_Location]</td><td>$result[Vacancy_Type]</td>< > /tr>\n"; > } > > echo "</table>"; > ?> > > ----------------------------------------------------------------- > Thank you, > Richard Bewley > rbewley@eq-sys.com > > Equinox Systems and Development > Website: http://www.eq-dev.com/ > > Also, please look at our webhosting services, specializing in business web > hosting starting from $15 per month!

« previous php.general (#192657) next »