473,395 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Connecting to remote MySQL server.

eragon
431 256MB
i tried using Awardspace.com fot the MySQL servers, and i keep getting errors from the server. So i tried 110mb.com for their servers, and still, i get errors! i put the information that they sent me into my scripts, and it wont work for me... so sad... for my username would i put sqltestsite_sqldb (sqltestsite is the name of my site, sqldb is my user) or would i just put sqldb? and for the host, would http://fdb1.awardspace.com/ work, or do i need to just put fdb1.awardspace.com, or is there a completely differend prefix i put?? PLease help!!!

Hoping you help,

Eragon
May 27 '07 #1
29 6453
Atli
5,058 Expert 4TB
Hi.

I've edited the thread's title.

Please use good, descriptive, thread titles when you post new threads.
Refrain from using phrases like: 'Please help' or 'Need help' or just 'Help'.

Please read our Posting Guidelines before posting.

MODERATOR
May 27 '07 #2
Atli
5,058 Expert 4TB
Could you show us the error's your getting, and perhaps some relevant code?

It's extremely hard to debug code you can't see.
May 27 '07 #3
eragon
431 256MB
sorry about that, im just getting a little frustrated... i cant get a good content management system working... i spent 2 hours following a tutorial, and when i was done, all i got was errors from my sql server. i need another sql server...
May 27 '07 #4
pbmods
5,821 Expert 4TB
i tried using Awardspace.com fot the MySQL servers, and i keep getting errors from the server.
What errors are you getting? That ESP helmet I bought last year is still on backorder...

for my username would i put sqltestsite_sqldb
To connect to a MySQL server:
Expand|Select|Wrap|Line Numbers
  1. $handle = mysql_connect('hostname', 'username', 'password');
  2. mysql_select_db('database', $handle);
  3.  
http://fdb1.awardspace.com/ work, or do i need to just put fdb1.awardspace.com, or is there a completely differend prefix i put
You'd use fdb1.awardspace.com, since you're not using the http protocol.

For more information:
http://php.net/mysql_connect
May 27 '07 #5
eragon
431 256MB
Could you show us the error's your getting, and perhaps some relevant code?

It's extremely hard to debug code you can't see.
certainly, here is my PHP code, one of the many:

[PHP]<?php
// set your infomation.
$dbhost='http://fdb1.awardspace.com';
$dbusername='sqldb';
$dbuserpass='******';
$dbname='sqldb';

// connect to the mysql database server.
mysql_connect ($dbhost, $dbusername, $dbuserpass);
//select the database
mysql_select_db($dbname) or die('Cannot select database');

//create the table, customize it if you want
$query = "CREATE TABLE peep_online(
activity DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
member ENUM('y','n') NOT NULL DEFAULT 'n',
ip_address VARCHAR(255) NOT NULL,
refurl VARCHAR(255) NOT NULL,
user_agent VARCHAR(255) NOT NULL)";
$result = mysql_query($query);
echo "Table Created!";
?>[/PHP]

(stars subsituted for password)

and here is the error i get when i run the code:

Warning: mysql_connect(): Lost connection to MySQL server during query in /home/www/1221581815.awardspace.com/peep_onlinecreate.php on line 9

Warning: mysql_select_db(): Unknown MySQL Server Host 'db1.awardspace.com' (1) in /home/www/1221581815.awardspace.com/peep_onlinecreate.php on line 11

Warning: mysql_select_db(): A link to the server could not be established in /home/www/1221581815.awardspace.com/peep_onlinecreate.php on line 11
Cannot select database

i cant see what i am doing wrong... or can i ?
May 27 '07 #6
pbmods
5,821 Expert 4TB
Warning: mysql_select_db(): Unknown MySQL Server Host 'db1.awardspace.com' (1) in /home/www/1221581815.awardspace.com/peep_onlinecreate.php on line 11
Is your MySQL server on the same machine / at the same address as your web server? In which case, you can use 'localhost' as the host name.
May 27 '07 #7
eragon
431 256MB
im just looking for a really easy way to edit the files on my website with a simple HTML form, and for those said files to remain that way untill i submit other data from the form mentioned above. I also need a way to append to the files for like, say a news bulletin that need to have articles added to it. i have the forms made, and they look great, now i need a PHP script that will take the data submitted by said forms and relay it back to the page of which the forms are meant to edit. All other systems i used (over 15) dont want to work. from the information i gathered, the information sent by the forms is stored in a MySQL database, and then retreived when a user loads the page and posted where it is supposed to go on said page. i have not the knowledge of PHP to complete these tasks alone, therefore i am turning to the forums to help me. (and Google is useless) can you help me?

If you want me to give more specific detail just ask.

Sincerely,

Eragon

P.S. WOOT! Im not a newbie no more! Im a member =p
May 27 '07 #8
eragon
431 256MB
ill try using localhost for the server name, and ill remove the http://
May 27 '07 #9
Atli
5,058 Expert 4TB
btw you should add a die() call after your mysql_connect() function, so your code wont show you extra error messages. Only the first of you three error messages is needed, as the last two are a caused by the first one and serve only to cause confusion.
May 27 '07 #10
eragon
431 256MB
what if i remove the " or die('Cannot select database') " part?
May 27 '07 #11
eragon
431 256MB
that answers my question
May 27 '07 #12
eragon
431 256MB
lol, i wirte fast, i keep getting a "wait 30 secs" message
May 27 '07 #13
eragon
431 256MB
btw you should add a die() call after your mysql_connect() function, so your code wont show you extra error messages. Only the first of you three error messages is needed, as the last two are a caused by the first one and serve only to cause confusion.

How do i fix the first error??? ill add another die() thing, ill see if it works
May 27 '07 #14
eragon
431 256MB
changed code, looks like this:

[PHP]<?php
// set your infomation.
$dbhost='localhost';
$dbusername='1221581815_sqldb';
$dbuserpass='******';
$dbname='1221581815_sqldb';

// connect to the mysql database server.
$handle = mysql_connect('dbhost', 'dbusername', 'dbpassword');
mysql_select_db('dbname', $handle);

//create the table, customize it if you want
$query = "CREATE TABLE peep_online(
activity DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
member ENUM('y','n') NOT NULL DEFAULT 'n',
ip_address VARCHAR(255) NOT NULL,
refurl VARCHAR(255) NOT NULL,
user_agent VARCHAR(255) NOT NULL)";
$result = mysql_query($query);
echo "Table Created!";
?>[/PHP]

and i get this in return:


Warning: mysql_connect(): Lost connection to MySQL server during query in /home/www/1221581815.awardspace.com/peep_onlinecreate.php on line 9

Warning: mysql_select_db(): Unknown MySQL Server Host 'db1.awardspace.com' (1) in /home/www/1221581815.awardspace.com/peep_onlinecreate.php on line 11

Warning: mysql_select_db(): A link to the server could not be established in /home/www/1221581815.awardspace.com/peep_onlinecreate.php on line 11
Cannot select database


its like a plague!!! ill be back soon, im gonna take break, my computers trying to bite me...
May 27 '07 #15
Atli
5,058 Expert 4TB
Its all about the server address. Your PHP code can't connect to the address you are giving it.
You need to find the correct address.

I cant see any problem in you PHP code, except from the incorrect server address.
May 27 '07 #16
eragon
431 256MB
im trying to fix it, the addresse Awardspace gave me is: fdb1.awardspace.com
does that make snse? (I put that in too, still an error, ill try again)
May 27 '07 #17
eragon
431 256MB
the error:

Warning: mysql_connect(): Lost connection to MySQL server during query in /home/www/1221581815.awardspace.com/peep_onlinecreate.php on line 9

Warning: mysql_select_db(): Unknown MySQL Server Host 'db1.awardspace.com' (1) in /home/www/1221581815.awardspace.com/peep_onlinecreate.php on line 11

Warning: mysql_select_db(): A link to the server could not be established in /home/www/1221581815.awardspace.com/peep_onlinecreate.php on line 11
Cannot select database

the code:

[PHP]<?php
// set your infomation.
$dbhost='fdb1.awardspace.com';
$dbusername='1221581815_sqldb';
$dbuserpass='******';
$dbname='1221581815_sqldb';

// connect to the mysql database server.
$handle = mysql_connect('dbhost', 'dbusername', 'dbpassword');
mysql_select_db('dbname', $handle);

//create the table, customize it if you want
$query = "CREATE TABLE peep_online(
activity DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
member ENUM('y','n') NOT NULL DEFAULT 'n',
ip_address VARCHAR(255) NOT NULL,
refurl VARCHAR(255) NOT NULL,
user_agent VARCHAR(255) NOT NULL)";
$result = mysql_query($query);
echo "Table Created!";
?>[/PHP]
May 27 '07 #18
pbmods
5,821 Expert 4TB
Let's start with this line:

[PHP]<?php
$handle = mysql_connect('dbhost', 'dbusername', 'dbpassword');[/PHP]
Change it to this:

Expand|Select|Wrap|Line Numbers
  1. if(! ($handle = mysql_connect('dbhost', 'dbusername', 'dbpassword')))
  2.     throw new Exception('Unable to connect to the database.');
  3.  
There are four possibilities:
  1. Your hostname is incorrect.
  2. Your username is incorrect.
  3. Your password is incorrect.
  4. Any combination of the above three.

You might be supplying the correct hostname, but your username or password might be incorrect, or the Username you provided might not have access privileges.
May 27 '07 #19
eragon
431 256MB
you know, i never checked to see if im using the right password... lol

if that was my problem the whole time im gonna be [bleeped].
May 27 '07 #20
eragon
431 256MB
it kinda works!

The Code:
[PHP]<?php
// set your infomation.
$dbhost='fdb1.awardspace.com';
$dbusername='1221581815_sqldb';
$dbuserpass='******';
$dbname='1221581815_sqldb';

// connect to the mysql database server.
if(! ($handle = mysql_connect('dbhost', 'dbusername', 'dbpassword')))
throw new Exception('Unable to connect to the database.');

mysql_select_db('dbname', $handle);

//create the table, customize it if you want
$query = "CREATE TABLE peep_online(
activity DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
member ENUM('y','n') NOT NULL DEFAULT 'n',
ip_address VARCHAR(255) NOT NULL,
refurl VARCHAR(255) NOT NULL,
user_agent VARCHAR(255) NOT NULL)";
$result = mysql_query($query);
echo "Table Created!";
?>[/PHP]

The Error:
Parse error: parse error, unexpected T_NEW in /home/www/1221581815.awardspace.com/peep_onlinecreate.php on line 10

The Solution:
????????????????? ????? ?? ????? ? ? ??
May 27 '07 #21
pbmods
5,821 Expert 4TB
The Error:
Parse error: parse error, unexpected T_NEW in /home/www/1221581815.awardspace.com/peep_onlinecreate.php on line 10

The Solution:
????????????????? ????? ?? ????? ? ? ??
Aw shoot. Did you mention you were using PHP 4? The statement I gave you won't work. You'll have to do this instead:

Expand|Select|Wrap|Line Numbers
  1. if(! ($handle = mysql_connect('dbhost', 'dbusername', 'dbpassword')))
  2.     die('Unable to connect to the database.');
  3.  
May 27 '07 #22
eragon
431 256MB
still have my problem
=[
May 27 '07 #23
eragon
431 256MB
MySQL dosn't like me, so ill move on. PHPCMS is very confusing, so i thought of an easier way Microsoft Access Database. i will make a form that writes to the database, and when a user views the page it retrieves from tha database.. pretty schnazzy, right? wrong. i know this will work, i just dont know how to make it work. can somebody send me a sample form code that will write to a database, and other codes to make it work? that would be great!

Sincerely,

Eragon
May 27 '07 #24
eragon
431 256MB
ok, i like dreamweaver now, all the functions i need are right there, so, now comes the big question:

ASP, JSP, ASP.net, or ColdFusion???

Which one is user-friendly, until i get a response, ill do ASP.
May 27 '07 #25
Atli
5,058 Expert 4TB
ok, i like dreamweaver now, all the functions i need are right there, so, now comes the big question:

ASP, JSP, ASP.net, or ColdFusion???

Which one is user-friendly, until i get a response, ill do ASP.
Ok, your problem is not PHP, its your MySQL information. You simply need to find the correct information. You PHP code has no errors, it is only the server info that is incorrect.

If you want to try something else, however, I would reccomend ASP.NET.
Keep in mind tho, it's not as easy to learn as PHP.
May 28 '07 #26
eragon
431 256MB
asp.net you say? ok

i dont need to learn if Dreamweaver knows it for me. ;]
May 28 '07 #27
pbmods
5,821 Expert 4TB
i dont need to learn if Dreamweaver knows it for me. ;]
You must post to WTF a lot.
May 28 '07 #28
eragon
431 256MB
thats funny... i still dont get it.
May 28 '07 #29
eragon
431 256MB
back to the origional topic... i decided to drop MySQL as a result of it not working for me, now im using a Microsoft Access Database, but Dreamweaver's built in functions wont work for me, so ill start from the top. i will make a sample db and asp.net page and i will post in the ASP.NET forum. look for the post, most likely titled "Linking *.mdb databases to ASP.NET page for editing." (That is, unless a mod changes the title [thats happened to all my posts]) offer help on the subject.

Sincerely,

Eragon

<?php ... ?> those question marks are how i feel about PHP.
May 28 '07 #30

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Google Mike | last post by:
After a lot of thought and research, and playing with FreeTDS and InlineTDS, as well as various ODBC connections, I have determined that the fastest and cheapest way to get up and going with PHP on...
0
by: maddunr | last post by:
Hi, I just installed PHP 4.3.9, MySQL 4.0.2 and PHPMyAdmin 2.6.0-pl3 on our intranet server (Win2k3 running IIS). I also have a similar setup on my local machine (http://localhost/phpmyadmin). ...
3
by: kamilla | last post by:
I have a mysql 3.5 server installed on a suse linux 8.1, with address 10.0.0.100. Now I want to access that db from a W2K pc, address 10.0.0.200. I am able to ping 10.0.0.100, but I cannot connect...
4
by: Ian Davies | last post by:
Hello all The following code allows me to connect to a local MySQL database on my pc from a VB6 project. **************************************************************************** ** Dim...
5
by: bill | last post by:
I am having difficulties connecting to a remote Sql server database in VB.net. Lets say my remote server is found at 255.255.255.255 and its name is MyServer. The database is called MyDatabase....
0
by: Suresh | last post by:
Hi Guys I have Db2 server installed on remote server. i am connecting to that remote server by using VPN. I want to connect that remote DB2 server instance using my local machine DB2...
2
by: samadams_2006 | last post by:
Hello, I have a problem that I'm hoping someone will be able to help me resolve. 1) I have a C# Web Site in which I connect to the database: "Install Microsoft SQL Server 2005 Express...
3
by: Me LK | last post by:
I did a search but could not find an aswer that worked so here it goes. I just did an upgrade from 2003 to vs 2005 express. I am using a remote sql server 2000. I specifically upgrade to make...
0
by: aboutjav.com | last post by:
Hi, I need some help. I am getting this error after I complete the asp.net register control and click on the continue button. It crashed when it tries to get it calls this Profile property ...
4
by: Cyprus106 | last post by:
I realize how I'm going about this is somewhat odd. I have to construct a program for windows mobile that only sends a couple queries to a remote MySQL server and hopefully gets some success/fail...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.