[wdvltalk] Re: MySQL / PHP SELECT problems [was: Hello Again!]

2003-07-14 Thread Bj
- Original Message - 
From: "Gerenday, Perry (P.)" <[EMAIL PROTECTED]>
> Why can't I print (to screen) what I think is in my MySQL
> database using PHP. Here is what I've got.
> 

> $ShowMeAll = mysql_query("SELECT * FROM blogTable")
> or die("Bad SELECT query." . mysql_error());
> print "Here it is: $ShowMeAll"; 

Try: 

$result = mysql_query("SELECT etc");
// $result now contains a pointer to the result of
// the SQL query - not the data from the database.
// You now have to fetch that data, row by row,
// using $result as the pointer for where to find it:
if (mysql_num_rows($result) == 0)
print "No matching rows found";
else {
while ($row = mysql_fetch_array($result)) {
print "Found a row of data";
print "First 2 cols: " . $row[0] . ", " . $row[1] . "";
}
}


 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] 
   Send Your Posts To: [EMAIL PROTECTED]
To change subscription settings to the wdvltalk digest version:
http://wdvl.internet.com/WDVL/Forum/#sub

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]


[wdvltalk] Re: MySQL / PHP SELECT problems [was: Hello Again!]

2003-07-14 Thread Matthew Macdonald-Wallace
On Mon, 2003-07-14 at 20:17, Gerenday, Perry (P.) wrote:
> Matthew Macdonald-Wallace on
> Monday, July 14, 2003 8:01 AM, said:
> 
> > Hope this list is still the hive of activity it used to be, look
> > forward to helping and being helped once again.
> 
> Alrighty then Matt. Let's get you started.
> 

OK, I set myself up for that one didn't I? ;)

> Why can't I print (to screen) what I think is in my MySQL database using
> PHP. Here is what I've got.


> Any suggestions?

Not right now, I've just come in off the night shift at the hospital
(I'm an Auxillary nurse now, but still programming away!).

BJ's Solution looked quite good, but I'm knackered! :P

I'll take a proper look later on. (unless anyone else has solved it by
then!)

Cheers,

Matt

--
+-+
|Matthew Macdonald-Wallace|
|The Truth Will Set you Free  |
|http://www.truthisfreedom.org.uk/|
+-+
If you can count your money, you don't have a billion dollars. -- J.
Paul Getty


signature.asc
Description: This is a digitally signed message part
 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] 
   Send Your Posts To: [EMAIL PROTECTED]
To change subscription settings to the wdvltalk digest version:
http://wdvl.internet.com/WDVL/Forum/#sub

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]


[wdvltalk] Re: MySQL / PHP SELECT problems [was: Hello Again! ]

2003-07-17 Thread Gerenday, Perry (P.)
John Nichel wrote:


> Here's where you would use mysql_fetch_row() (allthough I prefer 
> mysql_fetch_array())
>
> while ( $datareturned = mysql_fetch_row ( $ShowMeAll ) ) {
>   echo "Here it is: " . $datareturned . "\n";
> }


Thanks John. I found this myself, just yesterday, 
and have started using the mysql_fetch_array($Result, MYSQL_ASSOC)) method.

Perry Gerenday
http://www.webinitiative.net

 • The WDVL Discussion List from WDVL.COM • 
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] 
   Send Your Posts To: [EMAIL PROTECTED]
To change subscription settings to the wdvltalk digest version:
http://wdvl.internet.com/WDVL/Forum/#sub

  http://www.wdvl.com  ___

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]