Re: [PHP-DB] PHP Objects and SQL Results

2010-02-13 Thread Richard Quadling
On 12 February 2010 23:46, Paul Hollingworth wrote: > Thanks for the code Eric, it seems to loosely provide the functionality that > I'm after. > > Just out of interest though, is there no other way to find the next result > row in an object apart from dumping it into an array? > > Thanks, > Paul

Re: [PHP-DB] PHP Objects and SQL Results

2010-02-13 Thread Moritz Fuchs
Hi, Why don't you just try the following: $query = "SELECT * FROM foo WHERE UserID = " .$uID . " ORDER BY bar"; $result = mysql_query($query); //get the first row $row = mysql_fetch_object($result); //get the next row while ($next = mysql_fetch_object($result)) { //do something with row/next

Re: [PHP-DB] PHP Objects and SQL Results

2010-02-12 Thread Eric Lee
On Sat, Feb 13, 2010 at 7:46 AM, Paul Hollingworth wrote: > Thanks for the code Eric, it seems to loosely provide the functionality > that I'm after. > > Just out of interest though, is there no other way to find the next result > row in an object apart from dumping it into an array? > > Paul Apo

Re: [PHP-DB] PHP Objects and SQL Results

2010-02-12 Thread Karl DeSaulniers
Hi Paul, Can't you just? $query = "SELECT DISTINCT bar FROM foo WHERE UserID = " .$uID; $result = mysql_query($query); while($obj = mysql_fetch_assoc($result) { $bar = $obj['bar']; if ($bar == "something") { //do this } } I'm some what a beginner, so sorry if t

Re: [PHP-DB] PHP Objects and SQL Results

2010-02-12 Thread Paul Hollingworth
Thanks for the code Eric, it seems to loosely provide the functionality that I'm after. Just out of interest though, is there no other way to find the next result row in an object apart from dumping it into an array? Thanks, Paul Eric Lee wrote: On Sat, Feb 13, 2010 at 3:26 AM, Paul wrote:

Re: [PHP-DB] PHP Objects and SQL Results

2010-02-12 Thread Eric Lee
On Sat, Feb 13, 2010 at 3:26 AM, Paul wrote: > Hi all, > > I'm currently having a problem correctly formatting a table within a while > loop. I'm using an object to store the results of a query, and using the > while to iterate through it each row to produce the output: > > $query = "SELECT * FR

[PHP-DB] PHP Objects and SQL Results

2010-02-12 Thread Paul
Hi all, I'm currently having a problem correctly formatting a table within a while loop. I'm using an object to store the results of a query, and using the while to iterate through it each row to produce the output: $query = "SELECT * FROM foo WHERE UserID = " .$uID . " ORDER BY bar"; $resul