Jump to content

SQL connect problem (using pagination)


karimali831

Recommended Posts

Hi,

 

Can someone tell me how I can fix this please. I get can not connect to SQL server.

 

I'm using pagination -> http://www.phpfreaks.com/tutorial/basic-pagination and works fine when I manually input the database information. E.g:

 

// database connection info
$conn = mysql_connect('localhost','user','password') or trigger_error("SQL", E_USER_ERROR);
$db = mysql_select_db('database',$conn) or trigger_error("SQL", E_USER_ERROR);

-> is fine.

 

But I need to use it like this:

 

// database connection info
include("_mysql.php");
$conn = mysql_connect($host, $user, $pwd) or system_error('ERROR: Can not connect to MySQL-Server');
$db = mysql_select_db($db, $conn) or trigger_error("SQL", E_USER_ERROR);

 

and the _mysql.php file is like:

 

<?php
 $host = "localhost";
 $user = "user";
 $pwd = "password";
 $db = "database";
 define("PREFIX", 'ficocup_');
?>

 

I'm sure that's correct. Anyone help me please?

Thank you :D

Link to comment
https://forums.phpfreaks.com/topic/193685-sql-connect-problem-using-pagination/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.