0

hi,
i don't know if it's the right place, but -
i've been trying to install a cms on my server, but i get this message -

warning: mysql_num_rows(): supplied arguments not valid mysql result resource in .../install.php

i've looked into the code but haven't seen anything wrong with it. can i get your help?

<?php
include("config.php");

$info_query = mysql_query("SELECT * FROM ".$prefix."ProFolio_info ORDER BY id DESC LIMIT 0,1");

if(mysql_num_rows($info_query) > 0){
	$red = "location: index.php";
	header($red);
	die("Redirecting to ProFolio Index Page...");
}

$reply = '';

if(isset($_POST['submit'])){
	$username = trim(strtolower($_POST['username']));
	$password = trim(strtolower($_POST['password']));
	$confirm = trim(strtolower($_POST['confirm']));
	if($username != '' && $password != '' && $confirm != ''){
		if($password == $confirm){
			//Create Files
			if(!file_exists('Files')){
				mkdir('Files', 0777);
			}
			if(!file_exists('Files_Icons')){
				mkdir('Files_Icons', 0777);
			}
			if(!file_exists('Files_Previews')){
				mkdir('Files_Previews', 0777);
			}
			chmod("Files", 0777);
			chmod("Files_Icons", 0777);
			chmod("Files_Previews", 0777);
			
			//Create Tables
			mysql_query("CREATE TABLE `".$prefix."ProFolio_work` (
						  `id` int(8) NOT NULL auto_increment,
						  `date` varchar(14) NOT NULL default '',
						  `title` varchar(255) NOT NULL default '',
						  `type` varchar(100) NOT NULL default '',
						  `file` varchar(255) NOT NULL default '',
						  `preview` varchar(255) NOT NULL default '',
						  `icon` varchar(255) NOT NULL default '',
						  PRIMARY KEY  (`id`),
						  FULLTEXT KEY `title` (`title`,`type`)
						) TYPE=MyISAM AUTO_INCREMENT=1 ") or die(mysql_error());
			
			mysql_query("CREATE TABLE `".$prefix."ProFolio_info` (
						  `id` int(5) NOT NULL auto_increment,
						  `username` varchar(30) NOT NULL default '',
						  `password` varchar(30) NOT NULL default '',
						  `page_about` blob NOT NULL,
						  `page_contact` blob NOT NULL,
						  `firstname` varchar(50) NOT NULL default '',
						  `lastname` varchar(50) NOT NULL default '',
						  `email` varchar(255) NOT NULL default '',
						  `phone` varchar(50) NOT NULL default '',
						  PRIMARY KEY  (`id`)
						) TYPE=MyISAM AUTO_INCREMENT=1") or die(mysql_error());
						
			mysql_query("CREATE TABLE `".$prefix."ProFolio_customize` (
						  `id` mediumint(4) NOT NULL auto_increment,
						  `categories` text NOT NULL,
						  `color_firstname` varchar(7) NOT NULL,
						  `color_lastname` varchar(7) NOT NULL,
						  `color_links` varchar(7) NOT NULL,
						  `color_text` varchar(7) NOT NULL,
						  `color_lightbox` varchar(7) NOT NULL,
						  `color_background` varchar(7) NOT NULL,
						  `opt_backgroundimg` varchar(255) NOT NULL default '',
						  `opt_backgroundpos` varchar(50) NOT NULL default '',
						  `opt_backgroundrep` varchar(20) NOT NULL default '',
						  PRIMARY KEY  (`id`)
						) ENGINE=MyISAM AUTO_INCREMENT=1 ;") or die(mysql_error());
			
			//Insert Data in DBs
			mysql_query("INSERT INTO ".$prefix."ProFolio_info (username, password, firstname, lastname) VALUES ('$username', '$password', 'First', 'Lastname')") or die(mysql_error());
			mysql_query("INSERT INTO ".$prefix."ProFolio_customize (categories, color_firstname, color_lastname, color_links, color_text, color_lightbox, color_background, opt_backgroundimg, opt_backgroundpos, opt_backgroundrep) VALUES('Artwork, Identity, Illustration, Photography, Web Designs', '#555', '#fff', '#e1e1e1', '#ebebeb', '#000', '#000', 'Backgrounds/clouds.png', 'bottom right', 'no-repeat')") or die(mysql_error());
			
			if(file_exists('upgrade.php')){
				unlink('upgrade.php');
			}
			
			//Finish and Redirect
			$red = "Location: index.php";
			header($red);
			die("Redirecting to ProFolio Index Page...");
		} else {
			$reply = "Your password and password confirmation did not match.";
		}
	} else {
		$reply = "Please fill out a username, password and password confirmation.";
	}
}
?>
2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by yonile
0

It seems that all your configurations did not get set as desired in the config.php and your "$prefix" variable is not set, which leads to failing your query at line4. Which creates this error at mysql_num_rows()

0

It seems that all your configurations did not get set as desired in the config.php and your "$prefix" variable is not set, which leads to failing your query at line4. Which creates this error at mysql_num_rows()

oh.
so let me get it right - the problem is actually in the config.php file?
i've looked in it's code and haven't seen anything problematic:

<?
ob_start("gzip_handler");
ob_start();

//Change the following four items to their appropriate values (Your MySQL host, Your database username, Your database password, Database Name)
$host = "***";
$db_username = "****";
$db_password = "****";
$database = "****";

//Optional Table Prefix (Leave blank for default)
$prefix = '';

//MySQL - Do not touch.
mysql_connect($host, $db_username, $db_password) or die(mysql_error());
mysql_select_db($database) or die(mysql_error());
?>

do you have any suggestions?
thanks!-

Edited by yonile: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.