Witam, i od razu podaję kod:
<?php
session_start();
/* Created by Jacek Bulowski */
require_once "scripts/connect_to_mysql.php";
// Determine which page ID to use in our query below ---------------------------------------------------------------------------------------
if (!$_GET['pid']) {
$pageid = '3';
} else {
$pageid = ereg_replace("[^0-9]", "", $_GET['pid']); // filter everything but numbers for security
}
// Query the body section for the proper page
$sqlCommand = "SELECT pagebody FROM pages WHERE id='$pageid' LIMIT 1";
$query = mysqli_query($myConnection, $sqlCommand) or die (mysqli_error());
while ($row = mysqli_fetch_array($query)) {
$body = $row["pagebody"];
}
mysqli_free_result($query);
//---------------------------------------------------------------------------------------------------------------------------------------------------------------
// Query the module data for display ---------------------------------------------------------------------------------------------------------------
$sqlCommand = "SELECT modulebody FROM modules WHERE showing='1' AND name='footer' LIMIT 1";
$query = mysqli_query($myConnection, $sqlCommand) or die (mysqli_error());
while ($row = mysqli_fetch_array($query)) {
$footer = $row["modulebody"];
}
mysqli_free_result($query);
//---------------------------------------------------------------------------------------------------------------------------------------------------------------
// Query the module data for display ---------------------------------------------------------------------------------------------------------------
$sqlCommand = "SELECT modulebody FROM modules WHERE showing='1' AND name='custom1' LIMIT 1";
$query = mysqli_query($myConnection, $sqlCommand) or die (mysqli_error());
while ($row = mysqli_fetch_array($query)) {
$custom1 = $row["modulebody"];
}
mysqli_free_result($query);
//---------------------------------------------------------------------------------------------------------------------------------------------------------------
// Build Main Navigation menu and gather page data here -----------------------------------------------------------------------------
$sqlCommand = "SELECT id, linklabel FROM pages WHERE showing='1' ORDER BY id ASC";
$query = mysqli_query($myConnection, $sqlCommand) or die (mysqli_error());
$menuDisplay = '';
while ($row = mysqli_fetch_array($query)) {
$pid = $row["id"];
$linklabel = $row["linklabel"];
$menuDisplay .= '' . $linklabel . '
';
}
mysqli_free_result($query);
//---------------------------------------------------------------------------------------------------------------------------------------------------------------
//mysqli_close($myConnection);
?>
[/code]
I zdjęcie:
Może mi ktoś powiedzieć, skąd te błędy jeżeli skopiowałem gotowy kod z pewnego kursu, tabele w bazie danych też ,skopiowane". Kod skopiowałem, bo pisząc sam to miałem jeszcze więcej błędów, ale dziwne, że i tak wyświetlało treść po przejściu do danej strony…
P.S Wkleiłem tylko kod php, bo HTML mam dobrze.
– Dodane 03.06.2013 (Pn) 21:49 –
*Możecie sobie odrzucić ten błąd z prawej strony, bo wyrzuciłem to z kodu, bo i tak mi nie potrzebne.