472,331 Members | 1,633 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,331 software developers and data experts.

Connecting my Mysql Database with my web server

Vkas
78
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

✓ answered by Dormilich

you don’t connect to a DB via the HTTP protocol. just omit "http://".

8 8386
Dormilich
8,658 Expert Mod 8TB
you don’t connect to a DB via the HTTP protocol. just omit "http://".
Nov 14 '09 #2
Vkas
78
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.pmnhost.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.pmnhost.net' (using password: NO)
Nov 14 '09 #3
Dormilich
8,658 Expert Mod 8TB
@Vkas


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

i am using this configuration for my local site
$dbuser='root'
$dbpass='' (Empty)
$dbname='Sunrise'

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
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.thesunriseschool.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.pmnhost.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.pmnhost.net' (using password: YES)


i dont know y
Nov 14 '09 #6
Dormilich
8,658 Expert Mod 8TB
did you enable remote acces for the DB (that is usually disabled)?
Nov 14 '09 #7
Vkas
78
from where should i do that from c panel ????
Nov 16 '09 #8
Dormilich
8,658 Expert Mod 8TB
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
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...
3
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...
6
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...
4
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. ...
2
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...
4
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...
1
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...
3
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. ...
5
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...
0
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
0
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...

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.