Re: simple page not found 404 script - PHP
| From: | Davi | Date: | Fri, 30 Mar 2007 18:55:43 +0000 |
| Subject: | Re: simple page not found 404 script - PHP | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-251785@lists.php.net to get a copy of this message | ||
Em Sexta 30 Março 2007 14:35, Dwayne Heronimo escreveu:
> I have included some code but have to do it a little different because if
> the query construct. but this shows only the 404. is this correct?
>
> <?php
> if (!function_exists("GetSQLValueString")) {
> function GetSQLValueString($theValue, $theType, $theDefinedValue = "",
> $theNotDefinedValue = "")
> {
> $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
>
> $theValue = function_exists("mysql_real_escape_string") ?
> mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
>
> switch ($theType) {
> case "text":
> $theValue = ($theValue != "") ? "'" . $theValue .
> "'" : "NULL";
> break;
> case "long":
> case "int":
> $theValue = ($theValue != "") ? intval($theValue) : "NULL";
> break;
> case "double":
> $theValue = ($theValue != "") ? "'" . doubleval($theValue) .
> "'" :
> "NULL";
> break;
> case "date":
> $theValue = ($theValue != "") ? "'" . $theValue .
> "'" : "NULL";
> break;
> case "defined":
> $theValue = ($theValue != "") ? $theDefinedValue :
> $theNotDefinedValue;
> break;
> }
> return $theValue;
> }
> }
>
> $colname_show_cat = "-1";
> if (isset($_GET['catcode'])) {
> $colname_show_cat = (get_magic_quotes_gpc()) ? $_GET['catcode'] :
> addslashes($_GET['catcode']);
> }
> mysql_select_db($database_arubaguide, $arubaguide);
> $query_show_cat = sprintf("SELECT id, catcode, category_name, name, text,
> slogan, main_img FROM items WHERE catcode = %s ORDER BY name ASC",
> GetSQLValueString($colname_show_cat, "text"));
> $show_cat = mysql_query($query_show_cat, $arubaguide) or
> die(mysql_error()); $row_show_cat = mysql_fetch_assoc($show_cat);
> $totalRows_show_cat = mysql_num_rows($show_cat);
>
> $found_catcode = $show_cat['catcode'];
>
> if(!$found_catcode) {
> include('404.php');
> exit;
> }
>
> ?>
>
>
Try
$found_catcode=$row_show_cat['catdode'];
instead
$found_catcode = $show_cat['catcode'];
--
Davi Vidal
davividal@siscompar.com.br
davividal@gmail.com
--
Agora com fortune:
"
Marge: You will not be getting a tattoo for Christmas.
Homer: Yeah. If you want one, you'll have to pay for it out of your
own allowance.
Simpsons Roasting on an Open Fire"