Jump to content

on login admin Error Database


augirl

Recommended Posts

Hi

 

Tried to fix this but no success.

mysql version is MySQL version 4.1.22-standard

php is PHP version 4.4.7

can some assist please Thank you

 

Error I get after login

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/aussieso/public_html/tips/siteadmin/login.php on line 26
here's where in code login php
$sql = "select count(*) from subscribers"; $result = mysql_query($sql ,$db); $row = mysql_fetch_row($result); $subscribers = $row[0];   

 

Database tables are

 # MySQL-Front Dump 2.1
#
# Host: localhost   Database: tips
#--------------------------------------------------------
# Server version 3.23.28-gamma
#
# Table structure for table 'ad_groups'
#
CREATE TABLE `ad_groups` (
 `groupid` int(10) unsigned NOT NULL default '0',
 `groupname` varchar(255) NOT NULL default '',
 PRIMARY KEY (`groupid`),
 UNIQUE KEY `groupid`(`groupid`),
 KEY `groupid_2`(`groupid`)
) TYPE=MyISAM COMMENT='';
#
# Dumping data for table 'ad_groups'
#
INSERT INTO `ad_groups` VALUES("2","Banner Ad (468x60)");
INSERT INTO `ad_groups` VALUES("3","Skyscrapper Ad (120x400)");
INSERT INTO `ad_groups` VALUES("4","Box Ad (120x70)");
#
# Table structure for table 'admin_control'
#
CREATE TABLE `admin_control` (
 `approve_content` char(1) default 'Y'
) TYPE=MyISAM COMMENT='';
#
# Dumping data for table 'admin_control'
#
INSERT INTO `admin_control` VALUES("Y");
#
# Table structure for table 'admin_login'
#
CREATE TABLE `admin_login` (
 `login` varchar(50) default NULL,
 `password` varchar(50) default NULL
) TYPE=MyISAM COMMENT='';
#
# Dumping data for table 'admin_login'
#
INSERT INTO `admin_login` VALUES("admin","m6t1w3u7c");
#
# Table structure for table 'ads'
#
CREATE TABLE `ads` (
 `adid` int(10) unsigned NOT NULL default '0',
 `image` varchar(50) default NULL,
 `url` varchar(255) default NULL,
 `code` text,
 `impressions` int(10) unsigned default '0',
 `clicks` int(11) default '0',
 `groupid` int(10) unsigned default NULL,
 `type` char(1) default NULL,
 `name` varchar(255) default NULL,
 PRIMARY KEY (`adid`),
 UNIQUE KEY `adid`(`adid`),
 KEY `adid_2`(`adid`)
) TYPE=MyISAM COMMENT='';
#
# Dumping data for table `ads`
#
INSERT INTO ads VALUES (8,NULL,NULL,'<script language="javascript1.2" type="text/javascript" src="http://www.funpageexchange.com/468x60.php?uid=399"></script>',1,'',2,'A','FPE Banner');
INSERT INTO ads VALUES (9,NULL,NULL,'<script language="javascript1.2" type="text/javascript" src="http://www.funpageexchange.com/120x600.php?uid=399"></script>',1,'',3,'A','FPE SkyScrapper');
# --------------------------------------------------------
#
# Table structure for table 'categories'
#
CREATE TABLE `categories` (
 `catid` int(10) unsigned NOT NULL default '0',
 `category` varchar(50) NOT NULL default '',
 PRIMARY KEY (`catid`),
 UNIQUE KEY `catid`(`catid`),
 KEY `catid_2`(`catid`)
) TYPE=MyISAM COMMENT='';
#
# Dumping data for table 'categories'
#
INSERT INTO `categories` VALUES("0","Miscellaneous");
INSERT INTO `categories` VALUES("3","Cleaning");
INSERT INTO `categories` VALUES("2","Laundry");
INSERT INTO `categories` VALUES("1","Time Saving");
INSERT INTO `categories` VALUES("4","Organization");
INSERT INTO `categories` VALUES("5","Health and Beauty");
INSERT INTO `categories` VALUES("6","Money Saving");
INSERT INTO `categories` VALUES("7","Pets");
INSERT INTO `categories` VALUES("8","Gardening");
#
# Table structure for table 'emailed_tips'
#
CREATE TABLE `emailed_tips` (
 `sender_email` varchar(255) default NULL,
 `friends_email` varchar(255) default NULL,
 `tipid` int(10) unsigned default NULL
) TYPE=MyISAM COMMENT='';
#
# Dumping data for table 'emailed_tips'
#
#
# Table structure for table 'links'
#
CREATE TABLE `links` (
 `linkid` int(10) unsigned NOT NULL default '0',
 `linkurl` varchar(255) NOT NULL default '',
 `linktext` varchar(255) NOT NULL default '',
 PRIMARY KEY (`linkid`),
 UNIQUE KEY `linkid`(`linkid`),
 KEY `linkid_2`(`linkid`)
) TYPE=MyISAM COMMENT='';
#
# Dumping data for table 'links'
#
INSERT INTO `links` VALUES("4","http://www.riddlespot.com/?source=5","RiddleSpot");
INSERT INTO `links` VALUES("3","http://www.jokesunlimited.com/?source=5","JokesUnlimited");
#
# Table structure for table 'ratings'
#

CREATE TABLE `ratings` (
 `tipid` int(10) unsigned NOT NULL default '0',
 `rating` float(10,2) NOT NULL default '0.00',
 `ip` varchar(50) NOT NULL default ''
) TYPE=MyISAM COMMENT='';
#
# Table structure for table 'search_terms'
#
CREATE TABLE `search_terms` (
 `term` varchar(255) default NULL,
 `count` int(10) unsigned default '0'
) TYPE=MyISAM COMMENT='';
#
# Table structure for table 'sponsored_items'
#
CREATE TABLE `sponsored_items` (
 `itemid` int(10) unsigned NOT NULL default '0',
 `sponsorid` int(10) unsigned NOT NULL default '0'
) TYPE=MyISAM COMMENT='';
#
# Dumping data for table 'sponsored_items'
#
INSERT INTO `sponsored_items` VALUES("90","2");
#
# Table structure for table 'sponsors'
#
CREATE TABLE `sponsors` (
 `sponsorid` int(10) unsigned NOT NULL default '0',
 `sponsorname` varchar(255) NOT NULL default '',
 `image` varchar(255) default NULL,
 `text` varchar(255) default '0',
 `url` varchar(255) default '0',
 PRIMARY KEY (`sponsorid`),
 UNIQUE KEY `sponsorid`(`sponsorid`),
 KEY `sponsorid_2`(`sponsorid`)
) TYPE=MyISAM COMMENT='';
#
# Dumping data for table 'sponsors'
#
INSERT INTO `sponsors` VALUES("2","EasySiteNetwork","2.gif","EasySiteNetwork makes owning a website easier than ever before.  Come and choose from our great selection of pre-built sites.","http://www.easysitenetwork.com/");
#
# Table structure for table 'subscribers'
#
CREATE TABLE `subscribers` (
 `emailaddress` varchar(255) default NULL
) TYPE=MyISAM COMMENT='';
#
# Dumping data for table 'subscribers'
#
INSERT INTO `subscribers` VALUES("[email protected]");
#
# Table structure for table 'tips'
#
CREATE TABLE `tips` (
 `tipid` int(10) unsigned NOT NULL default '0',
 `type` char(1) NOT NULL default '',
 `tip` text NOT NULL,
 `rating` float(10,2) NOT NULL default '0.00',
 `date` date default NULL,
 `title` varchar(255) NOT NULL default '',
 `hits` int(10) unsigned default '0',
 `catid` int(10) unsigned default '0',
 `status` char(1) default 'W',
 `userid` int(10) unsigned default NULL,
 PRIMARY KEY (`tipid`),
 UNIQUE KEY `jokeid`(`tipid`),
 KEY `jokeid_2`(`tipid`,`type`,`rating`)
) TYPE=MyISAM COMMENT='';
#
# Table structure for table 'users'
#
CREATE TABLE `users` (
 `userid` int(10) unsigned NOT NULL default '0',
 `login` varchar(50) NOT NULL default '',
 `password` varchar(50) NOT NULL default '',
 `email` varchar(255) default NULL,
 `newsletter` int(1) unsigned default NULL,
 PRIMARY KEY (`userid`),
 UNIQUE KEY `userid`(`userid`,`login`),
 KEY `userid_2`(`userid`,`login`)
) TYPE=MyISAM COMMENT='';
#
# Dumping data for table 'users'
#
INSERT INTO `users` VALUES("2","ratty","wibble","[email protected]","0");

Link to comment
https://forums.phpfreaks.com/topic/82084-on-login-admin-error-database/
Share on other sites

You need to try and catch the error. Try changing your code to this

 

<?php

$sql = "SELECT count(*) AS count FROM subscribers"; 
$result = mysql_query($sql ,$db)or die(mysql_error()); 
$row = mysql_fetch_assoc($result); 
$subscribers = $row['count'];   

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.