Dynadot โ€” .com Registration $8.99

Got a question : Php + Mysql = Love

Spaceship Spaceship
Watch

counter

Account Closed
Impact
1
the title is just to make u read this topic :)

What is the best Free news script which is available online ?
i am planning to run a news site and am not sure what script to choose


anyways i want to know how can i take data from a mysql database which is not on my server

like i got a database on an other server i want to take data from it from my first server how is the code in php for that written

thx
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Code:
mysql_connect('server', 'mysql_user', 'mysql_password');

Can be expanded to...


$link = mysql_connect('example.com:3307', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);

You'll need the settings that govern external DB connections to be set up correctly.
 
Last edited:
0
•••
No need for a $link variable, unless you plan to have multiple connections open at once.

PHP:
mysql_connect('example.com:3307', 'mysql_user', 'mysql_password')or die(mysql_error());

/* Stuff Here */

mysql_close();
 
0
•••
What danltn has provided is 100% correct but bear in mind that the database server must be set up to allow connections from external sources (most people set up their servers to only allow connections from trusted people.

Also if the mySQl server is on a different network then you will encounter lag time. If you are using it to output data to a user then the load time of the page will be affected adversely.
 
0
•••
Don't get intimidated by all the configuration. it's not too difficult. In CPanel, set an access host on the database server to be the IP address of the client system that is accessing it. Then, if it still doesn't work, contact your database server's host to disable any firewalls for that domain on port 3307. Even if you didn't order firewall services, their networking team may have instilled a block on it.

I had to do this to get my C# application on my PC to access a database on my server in Canada. The support team figured out what was causing the block and fixed it. It's really simple, really then:

1. Set access host to allow the IP of the accessor.
2. Contact host of db server if there are still problems.
 
0
•••
ok guys that was helpful ( i just wanted to know the way to write it) ill try it and let u know the result
anyways i got more important question
i am working on a news script that is about to collaps as its going to take me sometime to make a proper one when i can find loads of good scripts online

What is the best Free news script which is available online ?
i am planning to run a news site and am not sure what script to choose
 
0
•••
An alternative to reading it from MySql is CuteNEWS.

It is a fantastic news system, that uses flat files (information stored in files):
http://cutephp.com/cutenews/
It is very easy to use!

They do, however, have a copyright that is placed at the bottom of your page.

Joe
 
0
•••
hmm
saw this please do u know other (better or without credit)

BTW please guys i want it very very search engines friendly
 
0
•••
Well, WordPress could be modded up a bit... ;)
 
0
•••
oh where can i get WordPress
i googled it i couldnt find what am searching for what is that
 
0
•••
0
•••
counter said:
oh where can i get WordPress
i googled it i couldnt find what am searching for what is that

Wow, no offence but that is the dumbest thing I've ever heard.

http://www.google.co.uk/search?q=WordPress
http://search.yahoo.com/search?p=WordPress
http://www.ask.com/web?q=WordPress
http://search.live.com/results.aspx?q=WordPress

All of which it ranks #1 for... Along with http://wordpress.org (and other exts.)

Did you even try searching for it?

Here's the link:

http://wordpress.org
 
1
•••
0
•••
Appraise.net
Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back