Re: [PHP-DB] supernoob strikes again
I thought "4" didn't equal "456456456%20%20OR%201<>2" - Original Message - From: "Uzi Klein" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, May 09, 2004 8:04 AM Subject: Re: [PHP-DB] supernoob strikes again > some input verification is recommended : > http://www.dibcomputers.com/new-dibcomputers/index.php?id=456456456%20%20OR%201<>2 > > > > > "Dan Bowkley" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > got it...rather than return false, mysql_result throws an error if the query > > returns nothing. What a pain. > > > > Finished product at > > http://www.dibcomputers.com/new-dibcomputers/index.php.txt if anyone wants > > to steal it... > > > > D > > - Original Message - > > From: "Dan Bowkley" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Saturday, May 08, 2004 11:21 PM > > Subject: Re: [PHP-DB] supernoob strikes again > > > > > > > The 404 page is also inserted into the template, or at least that's the > > > idea...index.html?id=404 is the error page. ?id=1 is the main page, other > > > pages are numbered accordingly. > > > > > > > > > - Original Message - > > > From: "Justin Gruenberg" <[EMAIL PROTECTED]> > > > To: "Dan Bowkley" <[EMAIL PROTECTED]> > > > Cc: <[EMAIL PROTECTED]> > > > Sent: Saturday, May 08, 2004 11:05 PM > > > Subject: Re: [PHP-DB] supernoob strikes again > > > > > > > > > > Dan Bowkley wrote: > > > > > > > > >Yeah, I'm back... > > > > > > > > > >I'm revamping my own site, finally...going for the same sort of dynamic > > > system I was using for my last creation. Currently, I have index.php > > > returning lots of different pages from a mysql database; what I'd like to > > do > > > is have a somewhat more elegant solution for spitting back a 404 page. > > > > > > > > > > > > > > > > > > I'm not entirely sure if I understand your problem, but I can try. It's > > > > a bit late. > > > > > > > > What you need is to test to see if 0 rows are returned. Do this before > > > > any HTML is outputted. You can use header("HTTP/1.0 404 Not Found") to > > > > tell the browser that the page wasn't found. You want to stop any > > > > output after that, too. If you use Apache, you can use a custom error > > > > document to give a pretty error page. > > > > > > > > See > > > > http://us4.php.net/manual/en/function.header.php > > > > http://httpd.apache.org/docs/mod/core.html#errordocument > > > > > > > > > > > > > > > > > > > > > > -- > > > PHP Database Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] supernoob strikes again
Dan Bowkley wrote: got it...rather than return false, mysql_result throws an error if the query returns nothing. What a pain. NOT True. If the query is syntactically valid and nothing matches, mysql returns zero rows which is not an error, at least on the part of the dbms. Use mysql_num_rows() to test for this condition. Doug Finished product at http://www.dibcomputers.com/new-dibcomputers/index.php.txt if anyone wants to steal it... D -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] supernoob strikes again
some input verification is recommended : http://www.dibcomputers.com/new-dibcomputers/index.php?id=456456456%20%20OR%201<>2 "Dan Bowkley" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > got it...rather than return false, mysql_result throws an error if the query > returns nothing. What a pain. > > Finished product at > http://www.dibcomputers.com/new-dibcomputers/index.php.txt if anyone wants > to steal it... > > D > - Original Message - > From: "Dan Bowkley" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Saturday, May 08, 2004 11:21 PM > Subject: Re: [PHP-DB] supernoob strikes again > > > > The 404 page is also inserted into the template, or at least that's the > > idea...index.html?id=404 is the error page. ?id=1 is the main page, other > > pages are numbered accordingly. > > > > > > - Original Message - > > From: "Justin Gruenberg" <[EMAIL PROTECTED]> > > To: "Dan Bowkley" <[EMAIL PROTECTED]> > > Cc: <[EMAIL PROTECTED]> > > Sent: Saturday, May 08, 2004 11:05 PM > > Subject: Re: [PHP-DB] supernoob strikes again > > > > > > > Dan Bowkley wrote: > > > > > > >Yeah, I'm back... > > > > > > > >I'm revamping my own site, finally...going for the same sort of dynamic > > system I was using for my last creation. Currently, I have index.php > > returning lots of different pages from a mysql database; what I'd like to > do > > is have a somewhat more elegant solution for spitting back a 404 page. > > > > > > > > > > > > > > I'm not entirely sure if I understand your problem, but I can try. It's > > > a bit late. > > > > > > What you need is to test to see if 0 rows are returned. Do this before > > > any HTML is outputted. You can use header("HTTP/1.0 404 Not Found") to > > > tell the browser that the page wasn't found. You want to stop any > > > output after that, too. If you use Apache, you can use a custom error > > > document to give a pretty error page. > > > > > > See > > > http://us4.php.net/manual/en/function.header.php > > > http://httpd.apache.org/docs/mod/core.html#errordocument > > > > > > > > > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] supernoob strikes again
got it...rather than return false, mysql_result throws an error if the query returns nothing. What a pain. Finished product at http://www.dibcomputers.com/new-dibcomputers/index.php.txt if anyone wants to steal it... D - Original Message - From: "Dan Bowkley" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, May 08, 2004 11:21 PM Subject: Re: [PHP-DB] supernoob strikes again > The 404 page is also inserted into the template, or at least that's the > idea...index.html?id=404 is the error page. ?id=1 is the main page, other > pages are numbered accordingly. > > > - Original Message - > From: "Justin Gruenberg" <[EMAIL PROTECTED]> > To: "Dan Bowkley" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Saturday, May 08, 2004 11:05 PM > Subject: Re: [PHP-DB] supernoob strikes again > > > > Dan Bowkley wrote: > > > > >Yeah, I'm back... > > > > > >I'm revamping my own site, finally...going for the same sort of dynamic > system I was using for my last creation. Currently, I have index.php > returning lots of different pages from a mysql database; what I'd like to do > is have a somewhat more elegant solution for spitting back a 404 page. > > > > > > > > > > I'm not entirely sure if I understand your problem, but I can try. It's > > a bit late. > > > > What you need is to test to see if 0 rows are returned. Do this before > > any HTML is outputted. You can use header("HTTP/1.0 404 Not Found") to > > tell the browser that the page wasn't found. You want to stop any > > output after that, too. If you use Apache, you can use a custom error > > document to give a pretty error page. > > > > See > > http://us4.php.net/manual/en/function.header.php > > http://httpd.apache.org/docs/mod/core.html#errordocument > > > > > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] supernoob strikes again
The 404 page is also inserted into the template, or at least that's the idea...index.html?id=404 is the error page. ?id=1 is the main page, other pages are numbered accordingly. - Original Message - From: "Justin Gruenberg" <[EMAIL PROTECTED]> To: "Dan Bowkley" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Saturday, May 08, 2004 11:05 PM Subject: Re: [PHP-DB] supernoob strikes again > Dan Bowkley wrote: > > >Yeah, I'm back... > > > >I'm revamping my own site, finally...going for the same sort of dynamic system I was using for my last creation. Currently, I have index.php returning lots of different pages from a mysql database; what I'd like to do is have a somewhat more elegant solution for spitting back a 404 page. > > > > > > I'm not entirely sure if I understand your problem, but I can try. It's > a bit late. > > What you need is to test to see if 0 rows are returned. Do this before > any HTML is outputted. You can use header("HTTP/1.0 404 Not Found") to > tell the browser that the page wasn't found. You want to stop any > output after that, too. If you use Apache, you can use a custom error > document to give a pretty error page. > > See > http://us4.php.net/manual/en/function.header.php > http://httpd.apache.org/docs/mod/core.html#errordocument > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] supernoob strikes again
Dan Bowkley wrote: Yeah, I'm back... I'm revamping my own site, finally...going for the same sort of dynamic system I was using for my last creation. Currently, I have index.php returning lots of different pages from a mysql database; what I'd like to do is have a somewhat more elegant solution for spitting back a 404 page. I'm not entirely sure if I understand your problem, but I can try. It's a bit late. What you need is to test to see if 0 rows are returned. Do this before any HTML is outputted. You can use header("HTTP/1.0 404 Not Found") to tell the browser that the page wasn't found. You want to stop any output after that, too. If you use Apache, you can use a custom error document to give a pretty error page. See http://us4.php.net/manual/en/function.header.php http://httpd.apache.org/docs/mod/core.html#errordocument -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php