Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6200905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:27:16+00:00 2026-05-24T04:27:16+00:00

I am EXTREMELY new to the html/php scene but I have been working at

  • 0

I am EXTREMELY new to the html/php scene but I have been working at this for hours. I am stumped.

I am trying to connect to a sql database that will store username and password information. I use fortune city for hosting and I have already used their phpAdmin to setup up all of the necessary stuff (db, tables, etc..).

I am using Eclipse with Zend on the side. I am also running Sql Server and Apache 2.2.

I believe my issue is the following:

I have a db located at a certain ip address (remote fortunecity server) and I am testing my project on the local server. Fortune city offers two different host names, one for internal connections and one for external connections. I get different results from each one:

If I connect to the internal site it doesn’t make any connection, I know this because of my die statement. If I connect to the external host it connects, but doesn’t allow me to connect to the database. (see cases below code)

Currently my process is as follows. (PLEASSSSE TELL ME A BETTER WAY IF I’M DOING THINGS THE INEFFICIENTLY, I feel dirty every time I do it!!)

  1. Create or edit my index.php, login.php, etc… in eclipse.
  2. Copy the files that I edit into my Apache root.
  3. Go back to eclipse and run the project in a browser “firefox.”
  4. repeat n to the n times.

Keep in mind my sql database is located on the net

Can this be done? Testing locally while accessing a db on the net?

Here is the code:

<?php

if (!isset($_POST['username']) || !isset($_POST['password'])) {
header( "Location: http://localhost/index.php" );
}

elseif (empty($_POST['username']) || empty($_POST['password'])) {
header( "Location: http://localhost/index.php" );
}
else{

$user = addslashes($_POST['username']);
$pass = md5($_POST['password']);


$dbHost = "mysql3341.dotsterhost.com";
$dbUser = "*********";
$dbPass = "******";
$dbDatabase = "**********";


$db = mysql_connect("$dbHost", "$dbUser", "$dbPass") or die ("Error connecting to database.");

mysql_select_db("$dbDatabase", $db) or die ("Couldn't select the database.");

$result=mysql_query("select * from userInfo where username='$user' AND password='$pass'", $db);


$rowCheck = mysql_num_rows($result);
if($rowCheck > 0){
while($row = mysql_fetch_array($result)){



session_start();
session_register('username');


echo 'Success!';


header( "Location: checkLogin.php" );

}

}
else {



echo 'Incorrect login name or password. Please try again.';
}
}
?> 

Again, I have never made it past

Case :1 $db = mysql_connect("$dbHost", "$dbUser", "$dbPass") or die ("Error connecting to database.");

Case :2 mysql_select_db("$dbDatabase", $db) or die ("Couldn't select the database.");

Thanks for reading my novel!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:27:17+00:00Added an answer on May 24, 2026 at 4:27 am

    Can this be done? Testing locally while accessing a db on the net?

    Yes you can, but be aware if you are storing anything sensitive in your database you probably wouldn’t want to be sending that data unencrypted over the net. (Unless you are connecting over a VPN or another type of secure network connection.)

    Usually you’d want to setup a development environment on your local box or you can edit your files locally in something like Aptana (http://www.aptana.com/) and have it automatically deploy your files to the server every time you save.

    Also, as suggested in the comments, using a framework to develop on usually give you a powerful database library without the need to reinvent it on your own. (That is unless you feel like wrapping your own!)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm extremely new to JS and have this code that I'm trying to tweak.
I am extremely new to javascript and I have worked on this for hours....
Let me preface this by saying I am extremely new to git but have
For the last few hours I've been trying to set up this http://code.google.com/apis/books/docs/dynamic-links.html on
I am extremely new to Java (just started this weekend) and have a background
So I have installed subversion and am extremely new to it, about 2 hours
I'm extremely new to jQuery. I'm trying to have it so that the text
I have the following code: http://jsfiddle.net/SPWWx/ I'm completely new to javascript, this is my
I've been programming in Java for a little while now but have never really
Extremely new to Java an just playing around with it. I'm trying to add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.