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);

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

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

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

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");
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.