...

View Full Version : PHP Errors



seckelberry
02-22-2007, 01:58 AM
Thank you for taking the time to help me with my somewhat "newbie" problem.

I was recently given a content management system by one of my friends... I unzipped it, put it in the correct directory, etc. I set up the database, and did everything right... When I go to the pages, it says things like:

Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /public_html/cms/cms/news.php on line 25

AND

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /public_html/cms/cms/news.php on line 15

AND

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /public_html/cms/cms/showMenu.php on line 6



I asked my friend, and he said that this was due to an incorrect username and or password. I changed everything, went over it, triple checked it, and I get the same thing! I know that the Content Management System works, because it is on his site as well. Also, the username and passwords are drawn from one file:


<?php
//Database configuration
$db_server = "localhost"; //Usually localhost, ask your webhosting provider if localhost does not work
$db_user = "********_admin"; //Database username; consult web host for instructions on setting up a database user
$db_password = "************"; //Database password, consult web host for instructions on setting up a database user
$db_database = "********_******"; //You may create a new database or have cms share a database with something else

//Internal variable configuration
$settings['table_prefix'] = "ffc_"; //If cms is sharing a database with something else, you might want to have a prefix.
$settings['list_tags'] = "1"; //Set to 1 if you want to list a static page's tags in the body, 0 if you don't.
$settings['site_title'] = "interweb";
//Don't bother with anything below this line

$db_connection = mysql_connect("$db_server","$db_user","$db_password");
if (!$db_connection)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($db_database, $db_connection);
?>

Nightfire
02-22-2007, 02:05 AM
It should be mysql_num_rows, I'd change that if I was you.

If your username, password etc was wrong, then you'd get the error saying you couldn't connect. Now as you're connected and getting the errors, with mysql_num_rows not returning anything, I'd say it's due to either your database being empty, or a problem with your query. But as you're not showing the code for that page, I can't help you

seckelberry
02-22-2007, 02:10 AM
This is the code for the main, front page (the page that matters, with all the news and stuff I want inserted).


<?php require_once("common.php"); ?>
<html>
<head>
<title>test</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
function newHref($path) { //broken...
$self = $_SERVER['PHP_SELF'];
echo "$self" . "&" . "page=$path";
}
?>
<table width="100%">
<tr>
<td colspan="3" class="header">

<h1><?php echo $settings['site_title']; ?></h1>
<table class="toptable">
<tr>
<td>
<?php require_once("cms/showMarquee.php"); ?>
</td>
</tr>
<tr>
<td align="right">
<span class="links">
<? include("cms/showMenu.php"); ?>
</span>
</td>
</table>

</td>
</tr>
<tr>
<td width="180">
</td>
<td width="%" valign="top">
<?
if(isset($_GET['page'])) {
$page = $_GET['page'];
include($page);
}
else {
?>
<center>
<h2><?php
if(isset($_GET['pageTitle'])) {
echo $_GET['pageTitle'];
}
else {
echo "News";
}
?></h2>
</center>
<?
if(isset($_GET['content'])) {
require_once($_GET['content']);
}
else {
require_once("cms/news.php");
}
?>

<?
}
?>
</td>
<td width="280" valign="top" align="center">

<?php require_once("cms/latestPosts.php");
echo "<br><br>";
require_once("fgs.php"); //This is the random image generator
echo "<br /><br />";
?>

<br><br>><br>
<br>

</td>
</tr>
</table>

</body>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum