This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-10-25 18:15:20

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

remote MySQL help! :(

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:
http://dl.dropbox.com/u/22935223/1.PNG

the remote database access host I think I set up (dreamhost.com)
http://dl.dropbox.com/u/22935223/2.PNG

my connection script:

http://dl.dropbox.com/u/22935223/3.PNG

There are simply so many things that could be causing the problem! Since I've not done it before I'm a bit stuck  hmm

Last edited by sparks (2011-10-25 18:16:26)


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#2 2011-10-25 21:07:17

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: remote MySQL help! :(

Code:

<?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.


http://block.site90.net/scratch.mit/text.php?size=30&amp;text=%20A%20signature!&amp;color=333333

Offline

 

#3 2011-10-26 02:55:37

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: remote MySQL help! :(

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.


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#4 2011-10-26 05:45:41

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: remote MySQL help! :(

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)


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#5 2011-10-26 11:49:21

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: remote MySQL help! :(

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

 

#6 2011-10-26 12:44:15

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: remote MySQL help! :(

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.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#7 2011-10-26 13:30:37

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: remote MySQL help! :(

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

 

#8 2011-10-26 14:22:22

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: remote MySQL help! :(

How do I find it out?


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#9 2011-10-26 14:50:42

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: remote MySQL help! :(

Use your own IP. Or it might say it somewhere in the webhost CP panel!


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#10 2011-10-26 14:56:17

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: remote MySQL help! :(

sparks wrote:

How do I find it out?

Usually it says in the host's info...  hmm  It says for 000wh for example.

Offline

 

#11 2011-10-26 15:08:50

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: remote MySQL help! :(

Hey sparks, how come you aren't using notepad++ there? i use it all the time  wink  Also, I'm having MySQL problems. Could you help me:

Code:

<?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  sad  Is there an alternative to the mysql_num_rows() command, or can you help me fix this?


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#12 2011-10-26 15:40:58

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: remote MySQL help! :(

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.  smile

Offline

 

#13 2011-10-26 15:45:18

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: remote MySQL help! :(

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.  smile

If what you said is true, I'm celebrating my knowledge tonight  tongue

Offline

 

#14 2011-10-26 16:57:26

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: remote MySQL help! :(

Hmm, it didn't work  sad  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)


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#15 2011-10-27 12:46:50

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: remote MySQL help! :(

sparks wrote:

Hmm, it didn't work  sad  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

 

#16 2011-10-28 22:15:57

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: remote MySQL help! :(

LS97 wrote:

sparks wrote:

Hmm, it didn't work  sad  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

 

#17 2011-12-30 20:18:39

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: remote MySQL help! :(

Umm... Why is the access host 192.168.1.%? That is a local IP.


http://block.site90.net/scratch.mit/text.php?size=30&amp;text=%20A%20signature!&amp;color=333333

Offline

 

#18 2011-12-31 01:57:09

TRocket
Scratcher
Registered: 2009-08-18
Posts: 1000+

Re: remote MySQL help! :(

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';

http://i.imgur.com/1QqnHxQ.png

Offline

 

#19 2012-01-08 14:42:37

rookwood101
Scratcher
Registered: 2011-07-29
Posts: 500+

Re: remote MySQL help! :(

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.


http://i.imgur.com/zeIZW.png

Offline

 

#20 2012-01-08 16:44:59

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: remote MySQL help! :(

[offtopic]
Accidentalgames.com is your website? I'm subscribed to an email newsletter and I don't even remember subscribing...
[/offtopic]


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&amp;display=small

Offline

 

#21 2012-01-08 16:57:49

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: remote MySQL help! :(

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  smile  you can also get to us by emailing help@accidentalgames.com


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#22 2012-01-08 17:00:55

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: remote MySQL help! :(

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  smile  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


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&amp;display=small

Offline

 

#23 2012-01-08 17:06:16

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: remote MySQL help! :(

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  smile  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!


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#24 2012-01-08 17:15:26

nathanprocks
Scratcher
Registered: 2011-04-14
Posts: 1000+

Re: remote MySQL help! :(

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 there  smile  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!

awesome!
/me ends offtopicishness oh wait this isn't an mc server  tongue


http://carrot.cassiedragonandfriends.org/Scratch_Signature/randomsig.php
http://trinary.site40.net/images/scratchrank.php?username=nathanprocks&amp;display=small

Offline

 

Board footer