Re: MySQL QUERY Results Not Appearing

From: Date: Fri, 02 Jul 2004 08:34:16 +0000
Subject: Re: MySQL QUERY Results Not Appearing
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-189515@lists.php.net to get a copy of this message
Craig. Thanks for the response and sorry I've been delayed in getting back to you. I put a new page together and dropped all the peripheral code and this is what I ended up with: <?php /* MySQL Connection Variables */ $host="localhost"; $user="arras_WebMaster"; $password="qwerty"; $dbase="arras_Members"; /* MySQL Connection String */ $Connection=mysql_connect ("$host", "$user", "$password") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("$dbase"); /* Display Current Members */ echo "\n\n\n\n\n"; echo "<h3>active members should appear here</h3>"; $query = mysql_query("SELECT * FROM RegisteredMembers") or die("could not execute query"); while($result = mysql_fetch_array($query)){ echo $result['UserID']; } ?> Still no joy though. Any ideas...? -- ----------------------------- Michael Mason Arras People www.arraspeople.co.uk ----------------------------- "Craig Donnelly" <craig@deconstructor.net> wrote in message news:20040630130116.76568.qmail@pb1.pair.com... > $result is an array that has to be fetched...try this > > echo "<h3>active members should appear here</h3>"; > > $query = mysql_query("SELECT * FROM RegisteredMembers") or die("could not > execute query"); > while($result = mysql_fetch_array($query)){ > echo $result['YOUR_DB_FIELDNAME']; > } > > change YOUR_DB_FIELDNAME' to whatever the fields are you are querying. > you could also: > > <pre> > <?php print_r($result); ?> > </pre> > > HTH > > Craig > > "Harlequin" <michael.mason@arraspeople.co.uk> wrote in message > news:20040630114124.8114.qmail@pb1.pair.com... > > Hi all... > > > > Despite being able to make a connection to the server and execute a query > I > > am unable to do this through PHP using the following commands: > > > > echo "<h3>active members should appear here</h3>"; > > $query = "SELECT * FROM RegisteredMembers"; > > $result = mysql_query($query) or die ("could not execute query"); > > echo "$result"; > > > > Any ideas...? > > > > -- > > ----------------------------- > > Michael Mason > > Arras People > > www.arraspeople.co.uk > > -----------------------------

« previous php.general (#189515) next »