on 4/12/01 9:53 AM, Mike Baerwolf ([EMAIL PROTECTED]) wrote:
> $result = mysql_query("SELECT substring_index(body, \".\" ,2) FROM
> news",$db) or die ("Invalid Query");
> if ($myrow = mysql_fetch_array($result)) {
>
> do {
>
> printf("%s\n<br>", $myrow["headline"]);
> printf("%s\n", $myrow["body"]);
>
>
> } while ($myrow = mysql_fetch_array($result));
Maybe it's because the if statement doesn't have an ending }. Of course, it
could have been snipped for brevity. I assume that somewhere in the code
you have the connection made and the database selected.
Can you try this?
<?php
if (mysql_num_rows($result) > 0) {
while ($myrow = mysql_fetch_array($result))
printf("%s\n<br>", $myrow['headline']);
printf("%s\n", $myrow['body']);
}
} else {
echo 'No results found!';
}
?>
The above is untested but I think it will work. :)
Hope that helps,
Paul Burney
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Paul Burney
Webmaster and Open Source Developer
Educational Technology Unit
Graduate School of Education and Information Studies
University of California, Los Angeles
(310) 825-8365
<[EMAIL PROTECTED]>
<http://www.gseis.ucla.edu/>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]