1

Topic: Unable to search or browse from front page

I am a php/MySQL newbie. I read tons of tutorials and forums and I can't figure out a solution to this problem.

My system:
Windows XP/sp2, I am running the following programs locally on my computer--Apache 2.2.4/Win32, php version 5.2.3, MySQL 5.0.45-community-nt, phpMyAdmin 2.10.3.

I followed the Labstore 1.5.2 installation procedures--set up MySQL 'labstock' database, stocks & uploads folders have execute and write premissions, edited config.php as per suggestions. I have no trouble logging in as 'Admin' or 'normal' user and inserting cell-lines etc, or as 'admin' entering interface_creator editing, searching & browsing tables. However, from the front page-->http://localhost/stocks, when I click on i.e. cell-lines to search or browse I get this message:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\stocks\header.php on line 54
ERROR: Could not connect to the MySQL server! Either it is down or the username/password used for connecting to it as specified in the config.php file are incorrect. If the MySQL server is running, it will respond with an error message (below)

Access denied for user 'ODBC'@'localhost' (using password: NO)

htdocs is my public folder.
Additional info:
config.php authorizations:
$all_see_tables = "yes";
$all_affect_items = "no";
$allowed = array(specific IP addresses including localhost "127.0.0.1")

$enable_admin_authentication = 1
$enable_authentication = 1
(delete, update & browse set to 0)
I'm not using htaccess

Any help or suggestions would be greatly appreciated. This is a cool program and I would like to get it to work.

Thanks,
Judy Narvaez

2

Re: Unable to search or browse from front page

Strange! The PHP function and the database details (password, username, etc.) that are used to connect to the MySQL database are the same in both cases that you describe -- when things are working (code used is from files interface_creator/functions.php and interface_creator/common_start.php) and when there is the issue (code used is from file 'header.php').

You can edit file 'header.php' and add these lines before the line '$connection = mysql_connect($host, $user, $pass)' (line number 54 or so), and see if any extra warning etc. provide a hint as to the cause of the issue. Also view the source code of the web page in the browser (e.g., Firefox -> View -> Page source) and see if the MySQL password, etc., are what they should be:

// displaying errors etc in PHP code
error_reporting(E_ALL | (defined('E_STRICT') ? E_STRICT : 0));
ini_set('display_errors', 1);
// see what MySQL connection details are getting used
echo "MySQL connection details (user, password, host): \n\n", htmlspecialchars($user), ' ', htmlspecialchars($pass), ' ', htmlspecialchars($host), ' ', "\n\n";

3

Re: Unable to search or browse from front page

Thanks for your help testly.  I'm stuck.

After inserting the code into header.php I get the following:

MySQL connection details (user, password, host):
Notice: Undefined variable: user in C:\xampp\htdocs\stocks\header.php on line 58

Notice: Undefined variable: pass in C:\xampp\htdocs\stocks\header.php on line 58

Notice: Undefined variable: host in C:\xampp\htdocs\stocks\header.php on line 58

Notice: Undefined variable: host in C:\xampp\htdocs\stocks\header.php on line 59

Notice: Undefined variable: user in C:\xampp\htdocs\stocks\header.php on line 59

Notice: Undefined variable: pass in C:\xampp\htdocs\stocks\header.php on line 59

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\xampp\htdocs\stocks\header.php on line 59
ERROR: Could not connect to the MySQL server! Either it is down or the username/password used for connecting to it as specified in the config.php file are incorrect. If the MySQL server is running, it will respond with an error message (below)

Access denied for user 'ODBC'@'localhost' (using password: NO)

However, my front page-->http://localhost/stocks I get this:

MySQL connection details (user, password, host): root placid localhost
Notice: Undefined variable: head_extra in C:\xampp\htdocs\stocks\header.php on line 122

Laboratory of JoEllen Welsh - LabStoRe Stocks and Records.....plus more undefined variables

My user, password & host are being recognized but are not being carried over to the other pages?? I also created user 'ODBC'@'localhost' using phpMyAdmin--MySQL server connected OK but access was denied to database.

BTW, I don't have a MyODBC driver on my computer--I don't know what it does or if I need it to run LabStore.

Any suggestions you have would be greatly appreciated.
Thanks, Judy

4

Re: Unable to search or browse from front page

PHP on Windows uses 'ODBC' as a default user for MySQL work if a user is not specified. And since there is no account on the MySQL server for 'ODBC', the attempt to connect is rejected. This and the 'undefined variable' notices suggests that somehow the $user, etc., values are not getting passed to header.php.

Try downloading the software and replacing just the current index.php and header.php files with the newly downloaded one. Perhaps inadvertently some code had got altered on your setup.

If problem still persists, a temporary fix may be to redefine $user, etc., in header.php  -- copy those 3 lines or so from config.php and paste them before '$connection = mysql_connect($host, $user, $pass)' (line number 54 or so) in header.php.

5

Re: Unable to search or browse from front page

I downloaded the software--problem persisted, then I copied the 3 lines from config.php defining mysql (host, user, pass) and I got this:

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\stocks\header.php on line 139

|| Help || Tuesday, October 9, 2007


Warning: Division by zero in C:\xampp\htdocs\stocks\top_part.php on line 64

Has in name or...NatureSourceSpecies made inReactivityConjugateLocationUpdate dateAdd dateUpdaterAdderAndOrHas in name or...NatureSourceSpecies made inReactivityConjugateLocationUpdate dateAdd dateUpdaterAdder?

Showing all 1 of 1 entries on one page


Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\stocks\top_part.php on line 287
Name/description Nature Source Location 
Export all 1 entries in Excel format, or... All 1 entries in CVS format  ?


Add
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\stocks\footer.php on line 9
|| Help || Admin || ||

Keywords - - -

Any ideas?
Thanks, Judy

6

Re: Unable to search or browse from front page

It certainly looks like the include() call in header.php is failing for some reason:

include 'config.php';

Can you try the following variants one by one and see what works? Also, remove any 'error_reporting(E_ALL | (defined('E_STRICT') ? E_STRICT : 0)); ini_set('display_errors', 1);' (or set the 'display_errors' value to 0) that you may have in the file following my earlier suggestion.

include('./config.php');
include(realpath(dirname(__FILE__).'/config.php'));

7

Re: Unable to search or browse from front page

Thanks testly. It works!!

The second code did the trick-->include(realpath(dirname(__FILE__).'/config.php'));

Judy

8

Re: Unable to search or browse from front page

Issue fixed in release 1.5.3 (Feb 2009)