> I have a book- MySQL/PHP Database Applications by Greenspan & Bulger -
I think I've seen that book before :-)
> (some lines will undoubtedly wrap and make it all look real ugly)
We're used to that :-)
> function authenticate ($realm="Secure Area",$errmsg="Please enter a
usename and password")
> {
> header("WWW-Authenticate: Basic realm=\"$realm\"");
> header("HTTP/1.0 401 Unauthorized");
> die($errmsg);
> }
Indent between { and } or you'll go crazy.
> $query = "select name from users where password = ('$PHP_AUTH_PW') and
name =
> ('$PHP_AUTH_USER')";
No parens are needed here. Not sure SQL will care much, but they look a bit
silly...
> <table summary="" border="0" cellpadding="5" align="center"
width="90%">
> <?
> $db = mysql_connect("localhost", "root");
> mysql_select_db("bulletins", $db);
>
> if ($orderby == 'date'):
You probably should use { and } exclusively instead of ":" here, since
that's what you used above... Mostly for consistency sake, but most new
code is being written with { and } style syntax.
> $sql = "select * from dbulletins order by 'bulletin_date'";
> elseif ($orderby == 'date2'):
> $sql = "select * from dbulletins order by 'bulletin_date' desc";
> elseif ($orderby == 'vlad'):
> $sql = "select * from dbulletins where bulletin_from1 like '%Vlad%'
order by 'bulletin_number' desc";
> elseif ($orderby == 'burke'):
> $sql = "select * from dbulletins where bulletin_from1 like '%Burke%'
order by 'bulletin_number' desc";
> elseif ($orderby == 'hillers'):
> $sql = "select * from dbulletins where bulletin_from1 like
'%Hillers%' order by 'bulletin_number' desc";
> elseif (isset($submit)):
> $sql = "select * from dbulletins where match (body) against
('%$search%')";
Probably don't need parens, but I've never seen MATCH sql...
> else:
> $sql = "select * from dbulletins order by 'bulletin_date' desc";
> endif;
>
What happened to the LIMIT clause in your SQL?
The paging stuff works by using "LIMIT $offset, 5" to tell MySQL to only
give you records 1 through 5, or 6 through 10, or...
As you click on the link, a different $offset is passed in to your PHP
script -- You need to use that $offset in your SQL to get the right records.
> $result2 = mysql_query($sql);
>
> while ( $row = mysql_fetch_array($result2))
> {
> if ($orderby == 'vlad' || $orderby == 'burke' || $orderby
== 'hillers' || $orderby =='date' || $orderby == 'date2' || $search
> == 'orderby'):
> {
> print("<tr>\n<td colspan=\"2\">\n<img src=\"1pixb5e4f9.gif\"
alt=\"\" height=\"20\" width=\"1\">\n</td>\n</tr>");
Use ?> to switch out of PHP mode and just type this as HTML. The hair you
save, may be your own. :-)
> print("<tr>\n<td bgcolor=\"white\"
colspan=\"2\">\n<strong>\n");
> printf("<font
color=\"blue\">%s</font>\n</strong>\n</td>\n</tr>\n",
$row["bulletin_number"]);
> print("<tr>\n<td valign=\"top\">\n<h2 class=\"c1\">\n<br
/>Dealer Bulletin</h2>");
> printf("<strong>Date:</strong> %s\n", $row["bulletin_date"]);
> printf("<br />\n<strong>Number:</strong> %s\n",
$row["bulletin_number"]);
> printf("<br />\n<strong>Subject:</strong> %s\n",
$row["bulletin_subject"]);
> printf("<br />\n<strong>From:</strong> %s<br />%s\n",
$row["bulletin_from1"], $row["bulletin_from2"]);
> print("</td>\n<td valign=\"top\" align=\"left\">\n");
> print("<font face=\"Arial Black\"
size=\"+6\">SIMRAD</font>\n");
> print("<br />\n<font size=\"3\"> A
<strong>KONGSBERG</strong> Company</font>\n</center>\n");
> print("<br />Simrad Inc.\n");
> print("<br />19210-33<sup>rd</sup> Avenue West, Suite A\n");
> print("<br />Lynnwood, WA 98036\n");
> print("<br />U.S.A.\n");
> print("<br />Telephone: 1-425-778-8821\n");
> print("<br />Telefax: 1-425-771-7211\n");
> print("<br />\n<br />\n</td>\n</tr>");
> printf("<tr>\n<td colspan=2>%s\n", $row["body"]);
> print("<br />\n<hr width=\"75%\" />\n");
> }
> else:
> printf("<tr><td>* <a
href='bulletin_out.php?news_id=$row[news_id]'>%s</a> %s<br
/> %s</td></tr>", $row
> ["bulletin_subject"], $row["bulletin_date"], $row["bulletin_from1"]);
> endif;
> }
> function nav($offset=0,$this_script="bulletin_sorter.php")
> {
> global $php_self;
> $page_limit = 5;
> if (empty($this_script)) { $this_script = $php_self; }
That should be $PHP_SELF
> if (empty($offset)) { $offset = 0; }
> $result3 = mysql_query("select count(*) from dbulletins");
> list($total_rows) = mysql_fetch_array($result3);
> print "<p>\n";
> if ($offset > 0 )
> {
> print "<a
href=\"$this_script?offset=".($offset-page_limit)."\"><<Previous</a>
";
> }
> if ($offset+page_limit < $total_rows)
> {
> print "<a
href=\"$this_script?offset=".($offset+page_limit)."\">Next>></a>
";
> }
> print "</p>\n";
> }
>
> ?>
> </table>
> <?
> nav();
> ?>
> </body>
> </html>
> ----------------------------------------------------------------------
> Thanks for any help you all can provide,
>
> Chip Wiegand
> Computer Services
> www.simradusa.com
> [EMAIL PROTECTED]
> Simrad, Inc
> Lynnwood, WA
> 425-712-1138
>
> "There is no reason anyone would want a computer in their home."
> --Ken Olson, president, chairman and founder of Digital Equipment Corp.,
> 1977
> (-- Then why do I have nine? Somebody help me!)
>
--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
--
PHP General 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]