Re: [PHP] simple page not found 404 script - PHP



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@xxxxxxxxxxxxxxxx
davividal@xxxxxxxxx
--

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"
.



Relevant Pages

  • Re: [PHP] de-bug no input file specified
    ... switch ($theType) { ... Is it a common error? ...
    (php.general)
  • Re: [PHP] de-bug no input file specified
    ... switch ($theType) { ... return $theValue; ... You can always try searching 'php ...
    (php.general)
  • RE: [PHP] Which PHP-Editor to use?
    ... [PHP] Which PHP-Editor to use? ... I have worked now for several years happily with homesite 4.5, ... it looks like I have to switch to another system as homesite will not ... to God, as people who have been raised from death to life. ...
    (php.general)
  • Re: DB classes in PHP 4: include file hell
    ... Upgrade your hosting. ... all the data access code for all the related tables. ... PHP 5 has class autoloading. ... The better solution is to switch to a decent host that gives you better ...
    (comp.lang.php)
  • Re: Switch isset and $_get
    ... several expressions here that could be true, ... that case is closed by 'break;', it will then terminate the switch, if the case is closed by 'continue;' it will continue to evaluate the other options too. ... I would have expected it to execute both in the order it came across them, but then again, thinking it over, the default in php by definition should be the last case, so it only executing the last one shouldn't surprise me. ...
    (comp.lang.php)