473,708 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Connecting my Mysql Database with my web server

Vkas
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. }
  12.  
  13. if($_SERVER['HTTP_HOST']=="localhost" || $_SERVER['HTTP_HOST']=="192.168.1.12"){
  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. }
  24.  
  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 8478
Dormilich
8,658 Recognized Expert Moderator Expert
you don’t connect to a DB via the HTTP protocol. just omit "http://".
Nov 14 '09 #2
Vkas
78 New Member
ya that i done immediately.... ..this was the 1st problemmm

thanks...
But

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

Db= thesun_Sunrise
user=****
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
Dormilich
8,658 Recognized Expert Moderator Expert
@Vkas


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

i am using this configuration for my local site
$dbuser='root'
$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
Vkas
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
Dormilich
8,658 Recognized Expert Moderator Expert
did you enable remote acces for the DB (that is usually disabled)?
Nov 14 '09 #7
Vkas
78 New Member
from where should i do that from c panel ????
Nov 16 '09 #8
Dormilich
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

0
3635
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 server on Windows and connect to it through the socket API in PHP on Linux (if you have installed...
3
6170
by: kamilla | last post by:
I have a mysql 3.5 server installed on a suse linux 8.1, with address 10.0.0.100. Now I want to access that db from a W2K pc, address 10.0.0.200. I am able to ping 10.0.0.100, 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.%' and also tried .... to root@10.0.0.200 and others seen on posted messages. I can access that db...
6
1802
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 what is wrong. I don't get any error messages at all. It's almost as if PHP stops processing the...
4
8416
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
2
1771
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 "localhost" to the IP/port number of the new server, what else should be done, especially in the...
4
1799
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
1
2352
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 but cannot find any examples of Korn Shell connecting to a database on another server. Is there...
3
2702
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 do i need to give it? i cant see any dsn specified anywhere on the database control panel. i am a...
5
2739
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.*;
0
8787
marktang
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8697
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9158
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9060
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
7921
agi2029
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5939
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4712
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3151
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2096
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.