0
위해 PHP를 재 작성 URL에서 값을 얻을 내가 가지고 나타납니다 재 작성된 URL :는 MySQL의 쿼리
http://www.coverforce.com.au/insurance-news/news/start-your-own-business-insurance/800479715/
말의 숫자가 내 MySQL의 쿼리에서 사용할 필요가있는 URL 변수는 사용자가이 기사를 읽을 수 있도록하려면 - $ _GET을 사용하거나이 번호를 얻기 위해 폭발적으로 사용할 수있는 방법이있어서 mySQL 데이터베이스에 올바른 기사를 가져올 수 있습니다.
이 내가 시도했지만 그것이 작동하지 않는 것입니다 :
<?php require_once('../Connections/newsDBconnection.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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;
}
}
$totalRows_variablearticles = "-1";
if (isset($_GET['id'])) {
$totalRows_variablearticles = $_GET['id'];
}
mysql_select_db($database_newsDBconnection, $newsDBconnection);
$query_variablearticles = sprintf("SELECT * FROM NewsArticles, NewsArticleCategories, NewsArticlePhotos, NewsPhotos, NewsCategories WHERE NewsArticles.id = %s AND NewsArticles.id = NewsArticleCategories.newsArticleID AND NewsArticles.id = NewsArticlePhotos.newsArticleID AND NewsArticlePhotos.newsPhotoID = NewsPhotos.id AND NewsArticleCategories.newsCategoryID = NewsCategories.id", GetSQLValueString($totalRows_variablearticles, "int"));
$variablearticles = mysql_query($query_variablearticles, $newsDBconnection) or die(mysql_error());
$row_variablearticles = mysql_fetch_assoc($variablearticles);
$totalRows_variablearticles = mysql_num_rows($variablearticles);
?>
내 웹 사이트는 순간에 살고 있고 기사는 그래서 당신이 제공 할 수있는 도움은 정말 놀라운 것입니다 작동하지 않습니다!
htaccess/mod_rewrite를 사용하여 URL을 구문 분석하고 ID가 쿼리 문자열에 포함되도록 다시 작성하고 있습니까? –
예 mod rewrite를 사용하여 URL을 다시 쓰고 있는데, 내 htaccess 파일에 있습니다. Options + FollowSymlinks RewriteEngine On RewriteRule^/? test \ .html $ test.php [L] RewriteRule^/? index \ .html $ index.php [L] RewriteRule news /(.*)/(.*)/$ insurance-news/news.php? $ 1 = $ 2 rewritecond % {http_host}^coverforce.com.au [nc] rewriterule^(. *) $ coverforce.com.au/$1 [r = 301, nc] – nicemanda