I'm rather new to PHP, so this should be fairly easy to answer. I checked
the manual and FAQ already.

I'm using the following code, and I get the following message if $id has
nothing in the var (i have it set to a default of  type int, not null in
mysql). Is there a way around this or something I'm missing?

Thanks :)

-- code---

if ($id) {

   $result = mysql_query("SELECT * FROM entries WHERE id=$id",$db);

   $myrow = mysql_fetch_array($result);

   printf("<table border=1><tr>\n");
   printf("<tr><td>%s</td></tr>", $myrow["title"]);
   printf("<tr><td>%s | ", $myrow["id"]);
   printf("%s</td></tr>", $myrow["posted"]);
   printf("<tr><td>%s\n</td></tr>", $myrow["post"]);

   printf("<a href=\"$PHP_SELF\">all</a>");

   } else {

    do {

    printf("%s <a href=\"%s?id=%s\">%s</a><br>\n", $myrow["id"], $PHP_SELF,
$myrow["id"], $myrow["title"], $myrow["post"]);

      } while ($myrow = mysql_fetch_array($result));

    } else {

      // no records to display

      echo "Sorry, no records were found!";


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to