11 Replies - 1735 Views - Last Post: 14 September 2012 - 12:27 PM

#1 smaboud  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 119
  • Joined: 22-April 12

problem with mysql connection after uploading

Posted 14 September 2012 - 10:08 AM

hi

I have build my site on my computer localhost, and now i have uploaded the site to www.itaobao.net

But it can not get connected to the mysql DB, of course I have set the username, password and DB name the same as the one in my code.

but still cant get connected to the DB, if you try to login, the site will be redirected to the validate.php and nothing will be happened then, no connection to the DB no error, no nothing just a white page, but it works perfectly locally


please help, whats wrong with my code?



      <!DOCTYPE html>

      <html>
      <head>
      <meta http-equiv="content-type" 
		content="text/html;charset=utf-8"></meta>
      <title>Validate</title>
      <base target="-blank"></base>
      <link rel="stylesheet" type="text/css" href="FirstSite.css">
      <link rel="icon" href="Logo.png"></link>
      </head>
     <body>
     <div class="main_container"> 
     <div class="container">
     <p class="valid_one">

     </p>
     <p>
     </p>
     <p class="valid_two">
     <?php
     $username = "XXXX";
     echo $username;
     $password = "XXXXX";
     $database = "XXXXXX";
     $link = mysql_connect("localhost", "$username", "$password");
     echo $link;
     if(!$link) {echo("Failed to establish connection to mysql server");
             exit();}

     $status = mysql_select_db($database);

     $uname =  mysql_real_escape_string($_POST['email']);
     $pword =  mysql_real_escape_string($_POST['password']);

     $sql= "Select email,password,first_name,user_id,persent FROM personal_info where email='$uname' and password='$pword'";
     echo $sql;
     $result = mysql_query($sql);
     if (isset($result)){
	
     $persentage=mysql_result($result,0,"persent");
     $user_email=mysql_result($result,0,"email");
     $user_password=mysql_result($result,0,"password");
     $user_firstname=mysql_result($result,0,"first_name");
     $userrandid=mysql_result($result,0,"user_id");

     setcookie("uId","$userrandid");
     setcookie("uEmail","$user_email");
     setcookie("uPassword","$user_password");
     setcookie("uFirstname","$user_firstname");
     setcookie("perschk","$persentage");


     header( 'Location:ibuytaobao.com/ru/index.php' ) ;

     } else {
	echo "User not found, Please try again";
	setcookie("eMassage","$error_message");
        header( 'Location:ibuytaobao.com/ru/index.php' ) ;      

     }

     ?>




I have changed the header location to what you see, but still....

please help

Is This A Good Question/Topic? 0
  • +

Replies To: problem with mysql connection after uploading

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9208
  • View blog
  • Posts: 34,589
  • Joined: 12-June 08

Re: problem with mysql connection after uploading

Posted 14 September 2012 - 10:18 AM

I am guessing your DB's not on "localhost" anymore.. you know.. since it's on your website and all. You may want to investigate that option.
Was This Post Helpful? 0
  • +
  • -

#3 smaboud  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 119
  • Joined: 22-April 12

Re: problem with mysql connection after uploading

Posted 14 September 2012 - 10:33 AM

View Postmodi123_1, on 14 September 2012 - 10:18 AM, said:

I am guessing your DB's not on "localhost" anymore.. you know.. since it's on your website and all. You may want to investigate that option.


could you please explain in more detail? what do you mean by "your DB's not on "localhost" anymore" are you talking about the phpmyadmin on the host? if yes, the answer is they are localhost too, its printed there
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9208
  • View blog
  • Posts: 34,589
  • Joined: 12-June 08

Re: problem with mysql connection after uploading

Posted 14 September 2012 - 11:04 AM

 $link = mysql_connect("localhost", "$username", "$password");

This line.. local host is for when you are on your machine doing the design... when you are talking about your database on your website that's a different thing. You hosting admin panel will tell you what to use.
Was This Post Helpful? 0
  • +
  • -

#5 smaboud  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 119
  • Joined: 22-April 12

Re: problem with mysql connection after uploading

Posted 14 September 2012 - 11:29 AM

View Postmodi123_1, on 14 September 2012 - 11:04 AM, said:

 $link = mysql_connect("localhost", "$username", "$password");

This line.. local host is for when you are on your machine doing the design... when you are talking about your database on your website that's a different thing. You hosting admin panel will tell you what to use.


it didn't tell me, i have changed it to $link = mysql_connect("127.0.0.1", "$username", "$password");
but still no luck
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9208
  • View blog
  • Posts: 34,589
  • Joined: 12-June 08

Re: problem with mysql connection after uploading

Posted 14 September 2012 - 11:42 AM

Again.. local host is your own machine.. NOT your website's machine.

127.0.0.1 is the same as localhost.

You need to root through your host's panel.
Was This Post Helpful? 0
  • +
  • -

#7 smaboud  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 119
  • Joined: 22-April 12

Re: problem with mysql connection after uploading

Posted 14 September 2012 - 11:44 AM

where can i find it ?
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9208
  • View blog
  • Posts: 34,589
  • Joined: 12-June 08

Re: problem with mysql connection after uploading

Posted 14 September 2012 - 11:46 AM

I have no idea where hides it.. Nocster/BurstNET hides it and I really doubt anyone here will either. You need to go talk to them... read their FAQ.. maybe in their introductory email they sent you or perhaps in their user's forum.
Was This Post Helpful? 1
  • +
  • -

#9 smaboud  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 119
  • Joined: 22-April 12

Re: problem with mysql connection after uploading

Posted 14 September 2012 - 11:48 AM

View Postmodi123_1, on 14 September 2012 - 11:46 AM, said:

I have no idea where hides it.. Nocster/BurstNET hides it and I really doubt anyone here will either. You need to go talk to them... read their FAQ.. maybe in their introductory email they sent you or perhaps in their user's forum.



gonna write the admin
Was This Post Helpful? 0
  • +
  • -

#10 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5314
  • View blog
  • Posts: 27,220
  • Joined: 10-May 07

Re: problem with mysql connection after uploading

Posted 14 September 2012 - 11:57 AM

Local host would still be Local host if the mysql server is running on the same machine as the web server.

However, if the code was not changed, & was only uploaded, then your 1st step should be contacting the admin (as you are doing), as likely something is blocked or incorrect.
Was This Post Helpful? 0
  • +
  • -

#11 smaboud  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 119
  • Joined: 22-April 12

Re: problem with mysql connection after uploading

Posted 14 September 2012 - 12:15 PM

View Postno2pencil, on 14 September 2012 - 11:57 AM, said:

Local host would still be Local host if the mysql server is running on the same machine as the web server.

However, if the code was not changed, & was only uploaded, then your 1st step should be contacting the admin (as you are doing), as likely something is blocked or incorrect.


I did and they replied like :
.................................

Hello,

There are no issues with the server settings and all the settings is related with that particular application/software. We cannot provide such support as it is a third party application.
Please let us know if anything needs to be changed at the server end .
...................................

they don't want to solve the problem.

i have Failed to establish connection to mysql server message now. the DB is uploaded correctly
password is correct, i copy paste the password from the source code.

when you click on the DB name you will have the tables listed,
but when you go to

information_schema > user_privileges >

the table_catalog is NULL
Was This Post Helpful? 0
  • +
  • -

#12 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5314
  • View blog
  • Posts: 27,220
  • Joined: 10-May 07

Re: problem with mysql connection after uploading

Posted 14 September 2012 - 12:27 PM

Can you upload the information schema from your local mysql database?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1