473,551 Members | 2,775 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Connecting my Mysql Database with my web server

78 New Member
i have a domain www.thesunriseschool.com

for connecting the database i am using

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $sId=session_id();
  3. $uIp=$_SERVER['REMOTE_ADDR'];
  4. $time=time();
  5. $date_now=date("d/m/Y", $time);
  6. $time_now=date("G:i:s", $time);
  7. if(isset($_SERVER['HTTP_REFERER'])){
  8.     $referer=$_SERVER['HTTP_REFERER'];
  9. }else{
  10.     $referer="http://www.thesunriseschool.com";
  11. }
  13. if($_SERVER['HTTP_HOST']=="localhost" || $_SERVER['HTTP_HOST']==""){
  14.     $dbhost = 'localhost';
  15.     $dbuser = 'root';
  16.     $dbpass = '';
  17.     $dbname = 'Sunrise';
  18. }else{
  19.     $dbhost = 'http://www.thesunriseschool.com/';
  20.     $dbuser = 'xxxxx';
  21.     $dbpass = 'xxxxx';
  22.     $dbname = 'thesun_Sunrise';
  23. }
  25. $conn = mysql_connect ($dbhost, $dbuser, $dbpass) or die ('I cannot connect to the database because: ' . mysql_error());
  26. mysql_select_db ($dbname);
  27. function dbQuery($sql){
  28.     $qry=mysql_query($sql);
  29.     return $qry;}
  30. ?>

i have created , a user as welll as uploaded thedatabase using the cpanel of the domain successfully but it is giving me this error

Can Any one can help me.... i think i am not writing the exact parameters

Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'http' (1) in /home/thesun/public_html/includes/config.php on line 25
I cannot connect to the database because: Unknown MySQL server host 'http' (1)
Nov 14 '09 #1
8 8470
8,658 Recognized Expert Moderator Expert
you don’t connect to a DB via the HTTP protocol. just omit "http://".
Nov 14 '09 #2
78 New Member
ya that i done immediately.... ..this was the 1st problemmm


Now its giving this error Yet i have created following using Mysql database wizard in cpanel ........

Db= thesun_Sunrise
pass= ****

but it gives this ... error

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'thesun_Vkassun '@'server.pmnho st.net' (using password: NO) in /home/thesun/public_html/includes/config.php on line 25
I cannot connect to the database because: Access denied for user 'thesun_Vkassun '@'server.pmnho st.net' (using password: NO)
Nov 14 '09 #3
8,658 Recognized Expert Moderator Expert

obviously you forgot to pass the password.
Nov 14 '09 #4
78 New Member
which password i should give for this user!!!!!!!

i am using this configuration for my local site
$dbpass='' (Empty)
$dbname='Sunris e'

and it works... connects to the database after this i export the database file
and save it on my hard disk...

Now for web server
i have created a data base name Sunrise Using mysqlwizard in cpanel of the site...

and user Vkasun with a password
i import my local database using phpmyadmin of cpanel it is restored successfully ... and change the configuration of my phpmysql connection but it doesnt works... y???
Nov 14 '09 #5
78 New Member
which password should i passed

My local configuration is
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$dbname = 'sunrise';
phpmyadmin Having (root with password:NO)

this works perfectly at local then with the same condition i Export the database and save it top my hard drive after that

i goto the cpanel make a data base using mysqlwizard
Databasename : thesun_Sunrise
User :thesun_Vkassun
pass : xyx

and the restore the database by the phpmyadmin...in the cpanel
database is successfully store

the i change the setting of my connection to
$dbhost = 'www.thesunrise school.com';
$dbuser = '****';
$dbpass = '****';
$dbname = 'thesun_Sunrise ';.

but it gives me this error

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'thesun_Vkassun '@'server.pmnho st.net' (using password: YES) in /home/thesun/public_html/includes/config.php on line 25
I cannot connect to the database because: Access denied for user 'thesun_Vkassun '@'server.pmnho st.net' (using password: YES)

i dont know y
Nov 14 '09 #6
8,658 Recognized Expert Moderator Expert
did you enable remote acces for the DB (that is usually disabled)?
Nov 14 '09 #7
78 New Member
from where should i do that from c panel ????
Nov 16 '09 #8
8,658 Recognized Expert Moderator Expert
I do not use c panel… so I don’t know
Nov 16 '09 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Google Mike | last post by:
After a lot of thought and research, and playing with FreeTDS and InlineTDS, as well as various ODBC connections, I have determined that the fastest and cheapest way to get up and going with PHP on Linux, connecting to MS SQL Server, unless it was already pre-installed by your Linux installation, is to build your own multithreaded TCP socket...
by: kamilla | last post by:
I have a mysql 3.5 server installed on a suse linux 8.1, with address Now I want to access that db from a W2K pc, address I am able to ping, but I cannot connect to the db, and get error 2013. I have tried with MySQL Administrator 1.0 and also with ODBC. The db on linux has grant all on *.* to ''@'10.0.0.%'...
by: MBS | last post by:
Yeah, read the previous posts...I did that. None answer my question. I just installed PHP 5.0.4, Apache 2.0.54, and MySQL 4.1.13 a few days ago on WinXP SP2. My goal is to learn to use these programs. I cannot, absolutely cannot connect to MySQL using PHP. I've tried everything possible including the mysqli functions. I have no idea...
by: Ian Davies | last post by:
Hello all The following code allows me to connect to a local MySQL database on my pc from a VB6 project. **************************************************************************** ** Dim conn As ADODB.Connection Dim cs As String Dim MyServer As String
by: news | last post by:
We currently have our mySQL server on the same box as the Apache server. For security and load balancing, we're going to be moving the mySQL server to another box. We're already using a single included connection file in all of our PHP pages that has the server, username, password line that connects to the database. Aside from changing...
by: CodeImp | last post by:
A simple app I quickly wrote to try getting info from a database. Here is the first part of its code. The rest of the code is irellevant. using System; using System.Data; using System.Data.SqlClient; using System.Threading; namespace TestSQL { class Class1
by: mm | last post by:
I have several korn shell scripts I use with a MySQL database on the same server (Solaris). I am moving to a Linux environment where the MySQL database is on another server. I would like to convert the database connection code to connect to the database on another Linux server. I see alot of information on Perl DBI CLI and PHP DBI CLI...
by: Paradox Synthesist | last post by:
hi, i am a newbie to asp.net and have started learning mainly from websites. i have a question which IS very silly and trivial. http://msdn2.microsoft.com/en-us/library/system.data.odbc.odbcconnectionstringbuilder.dsn(VS.80).aspx i looked through this url to see how could i connect to a mysql database...where does the dsn figure out? why...
by: Ananthu | last post by:
Hi I have done all the codings part for connecting mysql server with java application but when i try to compile,the compilation is successful and during execution i get the following message, Exception in thread "main" java.lang.NoClassDefFoundError: MysqlConnect Coding Part: import java.sql.*; import java.lang.*;
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.