Re: simple page not found 404 script - PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
}

?>


"Davi" <davividal@xxxxxxxxxxxxxxxx> wrote in message 
news:200703301408.09709.davividal@xxxxxxxxxxxxxxxxxxx
Em Sexta 30 Março 2007 14:01, Dwayne Heronimo escreveu:
> wierd.. your code is behaving exactly the same as mine did.
> it will display the error and the page.. but both at the same time :S
>
> it is working but somehow it continues to execute.
>
> http://arubaguide.org/arubaguide/categories.php?catcode=art
>
> http://arubaguide.org/arubaguide/categories.php?catcode=blabla
>

Well... Check some typing issue... =P
This code is working for me... =]

http://www.turbineseusite.com.br/index.php?cat=contate-nos
http://www.turbineseusite.com.br/index.php?cat=blablabla

[]s


-- 
Davi Vidal
davividal@xxxxxxxxxxxxxxxx
davividal@xxxxxxxxx
--

Agora com fortune:
""It's not just a computer -- it's your ass."
-- Cal Keegan" 

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux