Hey guys, I'm currently trying to allow the blocks.scratcher.org site to use a MySQL database hosted on my website, accidentalgames.com. It's not working very well.
Could someone tell me what I'm doing wrong?
current error message:
the remote database access host I think I set up (dreamhost.com)
my connection script:
There are simply so many things that could be causing the problem! Since I've not done it before I'm a bit stuck
Last edited by sparks (2011-10-25 18:16:26)
Offline
<?php
$link = mysql_connect('accidentalgames.com', 'accident', 'INSERT PASS HERE');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>Dunno if this is any different but you can try. I got it from here.
Offline
Yes. I got this error. It is because MySQL only allows you to connect if you are on the same website as the MySQL database was created. You would need to use a PHP include function and make a seprate comment box on your own website.
Offline
WindowsExplorer wrote:
Yes. I got this error. It is because MySQL only allows you to connect if you are on the same website as the MySQL database was created. You would need to use a PHP include function and make a seprate comment box on your own website.
This is why in image 2, I show that I have created a remote host with dreamhost (which I may have done wrong). If you read the small text on the top of the image, you will see that doing so allows dreamhost to access my database providing it has the password and username, which my connects script does.
Mathwizz, the one you suggest is exactly the same as mine except it sets it to a variable and then runs the variable. It didn't work. One of the fields in the connect script will be wrong, or i've chosen the wrong remote host name...
Last edited by sparks (2011-10-26 06:05:27)
Offline
You should add the domain or IP for blocks.scratchr.org . You are only allowing dreamhost.com and anything from the internal IP ( or on the VPN of your host ).
Offline
Magnie wrote:
You should add the domain or IP for blocks.scratchr.org . You are only allowing dreamhost.com and anything from the internal IP ( or on the VPN of your host ).
Though it isn't in the screenshot, I've tried that already after the shot was taken, allowing "blocks.scratchr.org" to connect.
Offline
sparks wrote:
Magnie wrote:
You should add the domain or IP for blocks.scratchr.org . You are only allowing dreamhost.com and anything from the internal IP ( or on the VPN of your host ).
Though it isn't in the screenshot, I've tried that already after the shot was taken, allowing "blocks.scratchr.org" to connect.
What about the IP of blocks.scratchr?
Offline
sparks wrote:
How do I find it out?
Usually it says in the host's info...
It says for 000wh for example.
Offline
Hey sparks, how come you aren't using notepad++ there? i use it all the time
Also, I'm having MySQL problems. Could you help me:
<?PHP
//Database Information
$dbhost = "host";
$dbname = "name";
$dbuser = "user";
$dbpass = "pass";
//Connect to database
mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());
$name = $_POST['name'];
$email = $_POST['email'];
$username = $_POST['username'];
$password = ($_POST['password']);
// lets check to see if the username already exists
$checkuser = mysql_query("SELECT username FROM users WHERE username='$username'");
$username_exist = mysql_num_rows($checkuser);
if($username_exist > 0){
echo "username already taken";
unset($username);
include 'registration.html';
exit();
}The error is near the end. It keeps saying that it doesn't recognize the mysql_num_rows() as a valid command. It worked before, but not now
Is there an alternative to the mysql_num_rows() command, or can you help me fix this?
Offline
You can find the IP with a console/command line with the command "ping 'domain'" so: ping blocks.scratchr.org
I got 173.236.175.53 for the ping. So try that I guess.
I realized why 'blocks.scratchr.org' didn't work; because when sending the MySQL connection request, it doesn't go through the domain name, just the IP. So 173.236.175.53 should work, dreamhost.com won't.
Offline
Magnie wrote:
You can find the IP with a console/command line with the command "ping 'domain'" so: ping blocks.scratchr.org
I got 173.236.175.53 for the ping. So try that I guess.
I realized why 'blocks.scratchr.org' didn't work; because when sending the MySQL connection request, it doesn't go through the domain name, just the IP. So 173.236.175.53 should work, dreamhost.com won't.![]()
If what you said is true, I'm celebrating my knowledge tonight
Offline
Hmm, it didn't work
I added that IP to the list of remote servers. I can't actually access the site info as I don't have the login, it belongs to the Scratch team. I AM supposed to be connecting to accidentalgames.com, right?
mysql_connect('accidentalgames.com', 'accident', '********')
Last edited by sparks (2011-10-26 16:57:41)
Offline
sparks wrote:
Hmm, it didn't work
I added that IP to the list of remote servers. I can't actually access the site info as I don't have the login, it belongs to the Scratch team. I AM supposed to be connecting to accidentalgames.com, right?
mysql_connect('accidentalgames.com', 'accident', '********')
check with your hosting provider. For example, 000webhost tells you to connect to the mysql14 subdomain.
Offline
LS97 wrote:
sparks wrote:
Hmm, it didn't work
I added that IP to the list of remote servers. I can't actually access the site info as I don't have the login, it belongs to the Scratch team. I AM supposed to be connecting to accidentalgames.com, right?
mysql_connect('accidentalgames.com', 'accident', '********')check with your hosting provider. For example, 000webhost tells you to connect to the mysql14 subdomain.
Yeah, that should work too.
Offline
TRocket wrote:
execute this from a mysql shell/a php page on accident.com:
Code:
GRANT SELECT, INSERT, DELETE ON blocklib.* TO accident@'173.236.175.53' IDENTIFIED BY 'password';
I was actually having a similar problem to sparks on my dedicated server, and to fix it I used a very similar solution.
Offline
[offtopic]
Accidentalgames.com is your website? I'm subscribed to an email newsletter and I don't even remember subscribing...
[/offtopic]
Offline
nathanprocks wrote:
[offtopic]
Accidentalgames.com is your website? I'm subscribed to an email newsletter and I don't even remember subscribing...
[/offtopic]
Yes it is, the subscription checkbox is auto-checked in the registration form. If you don't want the emails, you can sign in and go to "my account", click edit and unsubscribe there
you can also get to us by emailing help@accidentalgames.com
Offline
sparks wrote:
nathanprocks wrote:
[offtopic]
Accidentalgames.com is your website? I'm subscribed to an email newsletter and I don't even remember subscribing...
[/offtopic]Yes it is, the subscription checkbox is auto-checked in the registration form. If you don't want the emails, you can sign in and go to "my account", click edit and unsubscribe there
you can also get to us by emailing help@accidentalgames.com
Lol I don't wanna unsubscribe... I like those little comic things it sends me :p
Offline
nathanprocks wrote:
sparks wrote:
nathanprocks wrote:
[offtopic]
Accidentalgames.com is your website? I'm subscribed to an email newsletter and I don't even remember subscribing...
[/offtopic]Yes it is, the subscription checkbox is auto-checked in the registration form. If you don't want the emails, you can sign in and go to "my account", click edit and unsubscribe there
you can also get to us by emailing help@accidentalgames.com
Lol I don't wanna unsubscribe... I like those little comic things it sends me :p
Haha, I'm glad you like them! Our first full-length game: Honey, I Accidentally Downloaded A Small Boy Into A Video Game is nearly finished too!
Offline
sparks wrote:
nathanprocks wrote:
sparks wrote:
Yes it is, the subscription checkbox is auto-checked in the registration form. If you don't want the emails, you can sign in and go to "my account", click edit and unsubscribe thereyou can also get to us by emailing help@accidentalgames.com
Lol I don't wanna unsubscribe... I like those little comic things it sends me :p
Haha, I'm glad you like them! Our first full-length game: Honey, I Accidentally Downloaded A Small Boy Into A Video Game is nearly finished too!
awesome!
/me ends offtopicishness oh wait this isn't an mc server
Offline