Jump to content

finding it hard to include my database


jeppers

Recommended Posts

i am using a an include statment to gain access to the database but it just won't play hear in my code so if you have any idea please help

 

session_start();

include("database.php");

 

______________________________________________________________

this is the entry to the database

$conn = mysql_connect("localhost", "root", "mouse") or die(mysql_error());

mysql_select_db('pass', $conn) or die(mysql_error());

 

just dose not work but when i put the conection to the database in the form it works what is the problem

 

 

Link to comment
https://forums.phpfreaks.com/topic/48248-finding-it-hard-to-include-my-database/
Share on other sites

<?php
session_start();
$conn = mysql_connect("localhost", "root", "mouse") or die(mysql_error());
mysql_select_db('pass', $conn) or die(mysql_error());
.... 

 

is identical to

<?php
session_start();
include("database.php");.... 

 

as long as database.php is in the same folder and looks exactly like this (note the php start and end tags):

 

<?php
$conn = mysql_connect("localhost", "root", "mouse") or die(mysql_error());
mysql_select_db('pass', $conn) or die(mysql_error());
?>

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.