srinivasa Posted April 21, 2010 Report Share Posted April 21, 2010 i am doing a project named 'product management store' i have attached four files namely login.html,login.php,success.php,admin(sql file) basically am doin admin authorization(first step) in that only am facing problem after entering/not entering input just showing blank page...please help me out....am feeling mysql_fetch_array function giving troble.... i hav also provided grant statement //admin table -- -- Database: `products` -- -- -------------------------------------------------------- -- -- Table structure for table `admin` -- CREATE TABLE IF NOT EXISTS `admin` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(20) NOT NULL, `password` varchar(20) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Dumping data for table `admin` -- INSERT INTO `admin` (`id`, `username`, `password`) VALUES (1, 'admin', 'admin'); please help me out...what is the prob... login.html login.php success.php Quote Link to comment Share on other sites More sharing options...
falkencreative Posted April 21, 2010 Report Share Posted April 21, 2010 There are two things I would do here... First, if you are getting a blank page, that seems to me to be an indication of a PHP error of some kind, but you most likely have PHP Errors turned off. To enable them either add this to the top of your login.php code, or change the PHP.ini file itself (change the values of "error_reporting" and "display_errors") ini_set('display_errors',1); error_reporting(E_ALL); My guess is that the issue you are having in the login.php file involves line 19: $count = mysql_fetch_array($result) or die(mysql_error()); You may need to go about it like this instead: $count = mysql_num_rows(mysql_query($result)); Quote Link to comment Share on other sites More sharing options...
srinivasa Posted April 22, 2010 Author Report Share Posted April 22, 2010 Still am facing same problem........ in login.php $result = mysql_query(' SELECT * FROM admin ') or die(mysql_error()); //working well but my duty is to verity username and password(i,e matching user entered and database entry)if i write like this $result = mysql_query(' SELECT * FROM admin WHERE username = "$myusername" AND password = "$mypassword" ') or die(mysql_error()); am getting blank page so this part giving troble or unable to parse (where username = "$myusername" and password = "$mypassword") whats your view please assist me to rectify this........one more questions is it not possibe to use variabe inside mysql_query function as i did above? kindly reply soon.............. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted April 22, 2010 Report Share Posted April 22, 2010 Have you done anything I suggested in my post? Have you turned on error reporting? Have you updated the "$count = mysql_fetch_array($result) or die(mysql_error());" line? If so, what is the current code you are using in login.php? Quote Link to comment Share on other sites More sharing options...
srinivasa Posted April 22, 2010 Author Report Share Posted April 22, 2010 Thanks your suggestions hepls me a lot, ITS WORKING NOW EXCEPT SMALL PART HERE BY I DO ATTACH MY FILES FOR YOUR REVIEW else{echo"Wrong Username Or Password";} //IN log.php THIS above PART is not showing on wrong user/pass(just giving blank page) please reply soon.............. PROJECT.zip Quote Link to comment Share on other sites More sharing options...
falkencreative Posted April 22, 2010 Report Share Posted April 22, 2010 looks like if you change this line in login.php $count = mysql_num_rows($result) or die(mysql_error()); to $count = mysql_num_rows($result); That takes care of things. It seems like if mysql_num_rows returned "0", that triggered the die() statement causing the blank page. Quote Link to comment Share on other sites More sharing options...
srinivasa Posted April 23, 2010 Author Report Share Posted April 23, 2010 ITS WORKING NOW......THANKS Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.