PDA

View Full Version : My functions won't activate, stays black, using Cs4


kanstnara
09-14-2012, 10:36 PM
Hello, I'm taking up coding again after many years and are following a tut, so I'm learning it all again...

Trying to do a html5 index (not sure that I've done that succefully thought as Dw Cs4 didn't offer that option when starting the site, so tried to change the DTD to match), and are having problems with some of the functions. In the tutorial the function, ex. $pg, or $dbc, turn turcouse while mine stay black, as if their not active or accepted. Why is that and what changes can I make?


1028

1029

edbr
09-15-2012, 02:41 AM
please just post code using CODE tags, not many will download files from a first time poster

kanstnara
09-15-2012, 08:35 AM
this is the index.php, and when I upload on local server, running xampp, I get this in return within the content div:

Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in C:\xampp\htdocs\sites\tdcd\index.php on line 55

Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, null given in C:\xampp\htdocs\sites\tdcd\index.php on line 57


When I post the code here, the variables ($pg, $q, $r, $page[title] etc.) turn up blue, but for me, on my Dw Cs4 the remain black.

What to do?


<?php error_reporting (E_ALL ^ E_NOTICE); ?>

<?php
// Setup document:
include('config/setup.php');

if ($_GET['page'] == '') {

$pg = 'home';

} else {

$pg = $_GET['page'];

}
?>


<!--
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
-->

<!DOCTYPE HTML>
<head>
<meta charset="utf-8" />
<html lang="en">
<title>The Digital Craft Dynamic</title>


<link rel="stylesheet" href="css/styles.css" />


</head>

<body>


<div class="header temp_block">
<?php include('template/header.php'); ?>

</div>

<div class="main_nav temp_block">
<?php include('template/main_nav.php'); ?>
</div>

<div class="temp_block content">
<?php //include('content/'.$pg.'.php');

// the database connection, our query;

$q = "SELECT * FROM pages WHERE name = '$pg' AND status = 1 LIMIT 1";
$r = mysqli_query(@mysqli_connect('localhost', 'dev_maah', 'tdcd_dbase'), $q);

$page = mysqli_fetch_assoc($r);
echo '<h1>'.$page[title].'</h1>';
echo '<div class=content_body>'.$page['body'].'</div>';


?>

</div>

<div class="footer temp_block">
<?php include('template/footer.php'); ?>
</div>


</body>
</html>

edbr
09-17-2012, 01:44 AM
t is this line
Warning
: mysqli_query() expects parameter 1 to be mysqli, boolean given in
C:\xampp\htdocs\sites\tdcd\index.php
on line
55