Witam wszystkich,
Jestem całkowitym nowicjuszem głównie podpierający się tutorialami. Po jednym z nich zabrnąłem do dynamicznych linków i klapa. Nie mam pojęcia dlaczego to nie działa. Może ktoś mnie naprowadzi. Z góry dzięki za pomoc.
--- plik główny ---
<a href="artykuly.php?news_id=<?php echo $row_rs1['news_id'];?>"><td width="100" align="right" valign="middle">Czytaj więcej</td></a>
(po najechaniu kursorem na link pojawia się ścieżka z numerem id newsa np .../artykuly.php?news_id=3 czyli wygląda że jest OK)
________________________________________________________________________________
___________________________________
--- plik docelowy (artykuly.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;
}
}
$id_rs1 = "0";
if (isset($_GET['news_id'])) {
$id_rs1 = $_GET['news_id'];
}
mysql_select_db($database_news, $news);
$query_rs1 = sprintf("SELECT * FROM table1 WHERE table1.news_id=%s", GetSQLValueString($id_rs1, "int"));
$rs1 = mysql_query($query_rs1, $news) or die(mysql_error());
$row_rs1 = mysql_fetch_assoc($rs1);
$totalRows_rs1 = mysql_num_rows($rs1);
?>
________________________________________________________________________________
_______________________
w praktyce po kliknięciu linku wyskakuje:
Unknown column 'table1.3' in 'where clause'