FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Problem with MYSQL (I believe it is the host)





Diablosblizz
Hey, I am running a custom SQL host on my computer, it runs and works fine but I cannot select things from it's database. First off, here is the code:

Code:
<?php
include('members/config.php');
switch($_GET['page']) {
default:
echo "No username or password specified.";
break;

case 'login':
$name = $_POST['name'];
$pass = $_POST['pass'];
$select = mysql_query("SELECT * FROM `users` WHERE `name` = '$name'");
$login = mysql_fetch_array($select);
$mission = $login['mission'];
echo "$mission";
break;
}
?>


It loads the page (takes a bit to load it, because it is on a separate server) and it's just blank. Doesn't echo out anything. Just in case, here is the config.php file:

Code:
<?php
$connect = mysql_connect("24.36.122.119","root","passwordhere");
mysql_select_db(habbo) or die(mysql_error());
$user1 = mysql_query("SELECT * FROM `users` WHERE `name` = '$_SESSION[name]' AND `password` = '$_SESSION[password]'");
$user = mysql_fetch_array($user1);
?>


** Just so you know, I believe I added frihost to connect to the SQL server, but I am not exactly sure. Below are the steps I used to "allow" frihost. **

1. Went into PHPMYADMIN.
2. Selected my database.
3. On the top navigation bar, I clicked Privileges
4. The details are below:

Access 1:

User - root
Host - % (I believe this means anybody)
Type - global
Privileges - ALL PRIVILEGES
Grant - YES

Access 2:

User - root
Host - localhost
Type - global
Privileges - ALL PRIVILEGES
Grant - YES

Also, when I visit config.php the page is also blank, even when I echo something out on it. Alright, that is out of the way. So, I am wondering if there is something wrong with my code(s), or something wrong with the server (mine).
woodenbrick
Did you forget to include session_start() at the top?
also i think you may need to escape out of the query to put the session data in
ie.
Code:
$user1 = mysql_query("SELECT * FROM users WHERE name =
'".$_SESSION['name']."' AND `password` = '".$_SESSION['password']."'") or die(mysql_error());

also use the mysql_error() after every query, helps with debugging.[/code]
Diablosblizz
Okay, I added session_start(); to my code as well as the mysql error. Still nothing displays. Any more ideas I really need to fix this.
Related topics
A LIST OF FREE PHP HOSTING SITES!
Wolves
Uninstallation & Installation Services
banner problem
PHP templates - u get $frih
Which Feature u most like in Frihost??
FriHost - Google Rankings
Something wrong with signatures
Lame Nameservers Problem Still Not Fixed
gallery2
MySQL Error#: 1130 - help
What is my sql host?
How to Host on Warcraft III with Windows
Problem with my SQL Server (not Frihost)
Php addict
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.