Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

Why won't this work??

SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
Watch

Barrucadu

Established Member
Impact
64
myfileminder.com/articles/dbconnect.php
PHP:
$server="---server---";
$user="---username---";
$pass="---password---";
$database="---database---";
$sql="---query---";

webmaster.php
PHP:
include 'http://www.myfileminder.com/articles/dbconnect.php';	 
mysql_connect($server,$user,$pass) or die("Could not connect to database: " . mysql_error());
mysql_select_db($database) or die("Could not select the database: " . mysql_error());
$result=mysql_query($sql) or die("Could not query the database: " . mysql_error());
mysql_close();

When I run it I get the error
Code:
Warning: mysql_connect(): Can't connect to MySQL server on 'localhost' (10061) in e:\domains\m\myfileminder.com\user\htdocs\articles\webmaster.php on line 16

line 16 is this:
PHP:
mysql_connect($server,$user,$pass) or die("Could not connect to database: " . mysql_error());

but I cant find the problem.
 
Last edited:
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Code:
include 'http://www.myfileminder.com/articles/dbconnect.php';

you cant do that if you are on a different server/ip

do this:
Code:
include 'dbconnect.php';
 
0
Close
hmm... thing is I want that script to work on other peoples sites, its an article script I'm working on, thats the script webmasters use to display the articles...
 
0
Close
you're going to have to provide the username/pass/ip as a feed then parse it out since you're doing it remotely. Or you could also just provide the info that they're going to put on their site as a feed then you wouldnt need the whole connection issue.
 
0
Close
provide the info that they're going to put on their site as a feed

how the hell would I do that?
 
0
Close
You may want to research what a feed does..
basically you print all the info on a page, and then you write your script to goto your site and parse the info from that page.
 
0
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

A browser tab with a favicon next to the page title
Search members
You can now search for members by name, company, location and more. Open the search at the top of any page and choose Members. You will...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back