PDA

View Full Version : Database Connection problems


bernardkane381926
08-14-2009, 11:20 AM
Sorry but I thought I had go this cracked but clearly not. When I try to access the user registration page I get the message - No database selected. My localhost.php code is

<?php
# FileName="localhost.php"
# Type="MYSQL"
# HTTP="true"
$hostname_localhost = "localhost";
$database_localhost = "bksol_adminbks";
$username_localhost = "bksol_beeky";
$password_localhost = "rara09winks63";
$localhost = mysql_pconnect($hostname_localhost, $username_localhost, $password_localhost) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db("bksol_adminbks");
?>

Where I have added a new user name "bksol_beeky" and a password "rara09winks63". I am really frustrated over tis can you help please before I decide to go and join a bowls club!!

Jason Byrnes
08-14-2009, 01:47 PM
the error suggests that there is no database named "bksol_adminbks" on the MySQL server.

bernardkane381926
08-15-2009, 08:35 AM
Sorry but there is a database called bksol_adminbks and user is bksol_beeky. I am looking at both these in the cpanel url https://shcp02.hosting.zen.net.uk:2083/frontend/x3Bronze/sql/index.html see attached jpegs. I have also included a dump of the phpmyadmin page which clearly shows the database and your users table.

Also now when I try to access the users_registration.php form through a link on my index page I get this message:


Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /data03/bksol/public_html/WA_Globals/WA_Globals.php:78) in /data03/bksol/public_html/WA_ValidationToolkit/WAVT_ValidatedForm_PHP.php on line 3

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /data03/bksol/public_html/WA_Globals/WA_Globals.php:78) in /data03/bksol/public_html/WA_ValidationToolkit/WAVT_ValidatedForm_PHP.php on line 3
No database selected

Is there anything else I can do to check or get going with the connection because I am absolutely stumped if not. Alternatively if I can send anything else that may help an answer to the problem let me know.

Beeky

Jason Byrnes
08-17-2009, 04:49 PM
I have created a tech support ticket for you so we can look into this issue.

Pleas update your ticket by logging into your support history:
http://www.webassist.com/mywebassist/supporthistory.php

michaelf0199272
09-01-2009, 12:06 PM
I think I know the solution to this issue.

I think that your issue is with the phpMyAdmin that you are using. It is encounting a statement that it could not translate. So this cause it to give error #1044, where access is denied or did not recognize\see the database.


1) remove -- CREATE DATABASE IF NOT EXISTS <name of data base that you tried to import>; from the database.

Then save the revised copy.


2) You also need to edited Connection\localhost.php to reflect the actual database.

This is what you have -- it looks correct to me.

<?php
# FileName="localhost.php"
# Type="MYSQL"
# HTTP="true"
$hostname_localhost = "localhost";
$database_localhost = "bksol_adminbks";
$username_localhost = "bksol_beeky";
$password_localhost = "rara09winks63";
$localhost = mysql_pconnect($hostname_localhost, $username_localhost, $password_localhost) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db("bksol_adminbks");
?>

All that you need is to do step 1 of my suggestion and you should be fine.

I hope that this helps.

bernardkane381926
09-02-2009, 02:42 AM
Fine now thanks.