0

Hi,

It always stated that 'No Database Selected'. Really need your help. Thanks :)

This is the coding

<?php
require('include/config.php');
$conn = mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db,$conn); 
$sql = " SELECT * FROM hod_approval WHERE hod_approval='2' ";
$result = mysql_query($sql) or die (mysql_error());

Here's my config.php

<?php

$db = 'TADMS';
$db_host = 'localhost';
$db_user = 'an';
$db_pwd = 'nopassword';

$conn = odbc_connect($db, $db_user, $db_pwd);

Edited by mln_ndh: n/a

3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by mohamedasif18
0

please replace the value of $db_host from "TADMS" to "localhost" it might work.

Hi, I've tried changing it but it's still the same

0

I checked you code in my system its working well I think the database name given will be incorrect so please recheck your database name Or there will be a space before the datebase name while you declare the database name so please also check the database name " TADMS" with a space before the database name it might work

Edited by Kannan R: n/a

0

Hi mln_ndh, Example config file

$con = mysql_connect("localhost","root","") or die("Oops ! Server Not Connected");
$db = mysql_select_db("sms") or die("Oops ! DB Not Connected");

Edited by mohamedasif18: Spelling Mistake

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.