Not able to login through my hosted php page..!!

Hello friends,
I am trying host my code in a hosting site #-Link-Snipped-# My code is working fine with my pc but not when i hosted there....Look at this code...




connected";
$rs=mysql_query("select * from signup where user='".$_POST['t1']."'");
print "

queried

"; while($row=mysql_fetch_array($rs)) { print "

under while

"; if($row['pswd']==$_POST['t2']) { print "

You are alowed

"; } else { print "

not alowed

"; } } ?>
and the login page is .....
 
    
    

Login Application

user

pswd

on my pc it will show the output like this.... "connected queried under while You are alowed".
But on my hosted link it will show the output like this...... "connected queried".
Can anyone help me to fix this issue...!!

Replies

  • Manish Goyal
    Manish Goyal
    $conn=mysql_connect("https://www.my3gb.com/phpmyadmin/","username","password");
    This line of code might be creating problem for you?


    Make sure that it is working
  • slashfear
    slashfear
    Hey mohit,

    Change the host name in the connection string as localhost or with the DNS name of the database, because your running the script in the server (where the database is available) so no need of specifying the full url of the host in that machine. That should fix the problem!!

    Hope that helps!! ๐Ÿ˜‰

    -Arvind
  • Kaustubh Katdare
    Kaustubh Katdare
    Not sure about this but you may map the domain name to localhost through hosts file? [ Someone correct me please ]
  • Prasad Ajinkya
    Prasad Ajinkya
    The_Big_K
    Not sure about this but you may map the domain name to localhost through hosts file? [ Someone correct me please ]
    Err, Biggie,
    If the script is running on a shared hosting space like my3gb, then the localhost would refer to that current server and not your machine. I am sure you will not even have access to the server's host file. And the clients host file is pretty much irrelevant in this case
  • Kaustubh Katdare
    Kaustubh Katdare
    Oops - I meant if the testing is being done on the local server, then windows (desktop) hosts file can be edited to simulate the actual server environment. ๐Ÿ˜
  • eternalthinker
    eternalthinker
    Umm.. the script returns no error even on querying the database.. so this would mean that the connection is established smoothly.

    The program is just not entering the while loop. Are you sure the database at the remote host is populated with proper values?
    You can see that the script wouldn't go into the loop in case we entered a non-existent username.

    Try checking if the result set is null with something like:

    if(!$rs) 
        echo "Empty results returned!"
  • Morningdot Hablu
    Morningdot Hablu
    @etk no buddy actually my connection is not established.....you may cehck it by inserting var_dump($rs);
    It will throw the exception caughted.
    Now i got the solution.I have to post DNS name of the database.
    But localhost is not working.
  • slashfear
    slashfear
    Ha I was right ok if localhost is not the name then find the DNS name I am sure you will have an access to the mysql server so connect to the server and then you can execute query

    select user();

    which will give the username and the hostname for example : root@localhost

    where root is the user name and after the @ sign is the DNS name ๐Ÿ˜‰

    -Arvind

You are reading an archived discussion.

Related Posts

I have always wondered what must be the procedure to get inside the Facebook Headquarters. Next to Google, Facebook has the most impressive office space and the employees there seem...
I thought of compiling all the various designations engineers get in IT companies, their meaning and the type of job engineers perform at various designations. I'm sure it would help...
Section - Mobile. IM for Nokia - Chat on the go This is one of the best messenger among all the messengers I have ever used. It is for all...
Please Help... Trying to login at the CE forum from my mobile but appears a message"network is timeout"!๐Ÿ˜”๐Ÿ˜ก I am able to browse full site but unable to login
CEans, Our awesome CEan - Eternalthinker (the crazy brain behind ET On Fire) has created badges for all our engineers to boast your CE Membership and also help in spreading...