aba
-
Posts
9 -
Joined
-
Last visited
Posts posted by aba
-
-
-
-
-
Please Antonio send me ur email address so that I send the picture of the error for you to look at - I have tried sending it here but I can't upload pictures here... Thank you!
-
- sorry I don't seem to understand what u were taking about...
-
I'm new to Programing and it very frustrating each time I run the Chapter 15 Script - I keep getting these errors:
1. Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\phpmyql3_scripts\ch15\html\includes\header.html on line 37
2. Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\phpmyql3_scripts\ch15\html\includes\header.html on line 47
3. Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\phpmyql3_scripts\ch15\html\includes\header.html on line 50
Below is the script for the hearder.html file. I'd be very grateful if some1 would help me solve this problem - it's a pain on the neck
<?php # Script 15.1 - header.html
/* This script...
* - starts the HTML template.
* - indicates the encoding using header().
* - starts the session.
* - gets the language-specific words from the database.
* - lists the available languages.
*/// Indicate the encoding:
header ('Content-Type: text/html; charset=UTF-8');// Start the session:
session_start();// For testing purposes:
$_SESSION['user_id'] = 1;
$_SESSION['user_tz'] = 'America/New_York';
//$_SESSION = array();// Need the database connection:
require_once('../mysqli_connect.php');// The language ID is stored in the session.
// Check for a new language ID...
if (isset($_GET['lid']) && is_numeric($_GET['lid'])) {
$_SESSION['lid'] = (int) $_GET['lid'];
} elseif (!isset($_SESSION['lid'])) {
$_SESSION['lid'] = 1; // Default.
}// Get the words for this language.
$words = FALSE; // Flag variable.
if ($_SESSION['lid'] > 0) {
$q = "SELECT * FROM words WHERE lang_id = {$_SESSION['lid']}";
$r = mysqli_query($dbc, $q);
if (mysqli_num_rows($r) == 1) {
$words = mysqli_result_array($r, MYSQLI_ASSOC);
}
}// If we still don't have the words, get the default language:
if (!$words) {
$_SESSION['lid'] = 1; // Default.
$q = "SELECT * FROM words WHERE lang_id = {$_SESSION['lid']}";
$r = mysqli_query($dbc, $q);
$words = mysqli_fetch_array($r, MYSQLI_ASSOC);
}mysqli_free_result($r);
?>
<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php echo $words['title']; ?></title>
<style type="text/css" media="screen">
body { background-color: #ffffff; }
.content {
background-color: #f5f5f5;
padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px;
margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px;
}
a.navlink:link { color: #003366; text-decoration: none; }
a.navlink:visited { color: #003366; text-decoration: none; }
a.navlink:hover { color: #cccccc; text-decoration: none; }
.title {
font-size: 24px; font-weight: normal; color: #ffffff;
margin-top: 5px; margin-bottom: 5px; margin-left: 20px;
padding-top: 5px; padding-bottom: 5px; padding-left: 20px;
}
</style>
</head>
<body><table width="90%" border="0" cellspacing="10" cellpadding="0" align="center">
<tr>
<td colspan="2" bgcolor="#003366" align="center"><p class="title"><?php echo $words['title']; ?></p></td>
</tr>
<tr>
<td valign="top" nowrap="nowrap" width="10%">
<b>
<?php // Display links:// Default links:
echo '<a href="index.php" class="navlink">' . $words['home'] . '</a><br />
<a href="forum.php" class="navlink">' . $words['forum_home'] . '</a><br />';// Display links based upon login status:
if (isset($_SESSION['user_id'])) {// If this is the forum page, add a link for posting new threads:
if (stripos($_SERVER['PHP_SELF'], 'forum.php')) {
echo '<a href="post.php" class="navlink">' . $words['new_thread'] . '</a><br />';
}
// Add the logout link:
echo '<a href="logout.php" class="navlink">' . $words['logout'] . '</a><br />';
} else {// Register and login links:
echo '<a href="register.php" class="navlink">' . $words['register'] . '</a><br />
<a href="login.php" class="navlink">' . $words['login'] . '</a><br />';
}// For choosing a forum/language:
echo '</b><p><form action="forum.php" method="get">
<select name="lid">
<option value="0">' . $words['language'] . '</option>
';// Retrieve all the languages...
$q = "SELECT lang_id, lang FROM languages ORDER BY lang_eng ASC";
$r = mysqli_query($dbc, $q);
if (mysqli_num_rows($r) > 0) {
while ($menu_row = mysqli_fetch_array($r, MYSQLI_NUM)) {
echo "<option value=\"$menu_row[0]\">$menu_row[1]</option>\n";
}
}
mysqli_free_result($r);
unset($menu_row);echo '</select><br />
<input name="submit" type="submit" value="' . $words['submit'] . '" />
</form></p>
</td>
<td valign="top" class="content">';
?> -
so how can I resolve it? pls help!
-
Please can some1 help me solve these errors:
1. Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\phpmyql3_scripts\ch15\html\includes\header.html on line 47
2. Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\phpmyql3_scripts\ch15\html\includes\header.html on line 50
3. Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\phpmyql3_scripts\ch15\html\includes\header.html on line 123
Urgent Help - Please Help If U Can!
in PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
Posted
thank u Antonio, I've uploaded the image to www.bildr.no - the name of the image is php_erro...