Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,345 members, 7,819,226 topics. Date: Monday, 06 May 2024 at 01:03 PM

Can Someone Help Me With This "No Database Selected" Challenge - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Can Someone Help Me With This "No Database Selected" Challenge (1331 Views)

The Greatest Programmer On Nairaland / Java Proramers:java Assignment: Can Someone Help Provide A Solution To This / Simple Code Challenge: C#, Java, C, C++ (2) (3) (4)

(1) (Reply) (Go Down)

Can Someone Help Me With This "No Database Selected" Challenge by adamuabu: 7:00am On Mar 03, 2013
I have finish designing a dynamic site with PHP/MySQL in dreamweaver. Upon upload, I keep getting "no database selected" when I try to log in my database as a user.

here is my connection file code:

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_db = "localhost";
$database_db = "dbname";
$username_db = "username";
$password_db = "pasword";
$sya = mysql_connect("localhost", "cplogin", "cppassword", "dbname"winkor trigger_error(mysql_error(),E_USER_ERROR);
?>
Re: Can Someone Help Me With This "No Database Selected" Challenge by solutions247(m): 5:07pm On Mar 03, 2013
Av u imported ur database to ur host. i.e hav u also created ur dbase afta hosting

1 Like

Re: Can Someone Help Me With This "No Database Selected" Challenge by maximale: 6:51pm On Mar 03, 2013
from your code, i see u a learner. why did u create variables u ended up not using? also, your db is no longer 'localhost' after uploading. u hv 2 either upload the database frm localhost or create a corresponding one online. 08182028090 for help

1 Like

Re: Can Someone Help Me With This "No Database Selected" Challenge by hoodboi(m): 9:17pm On Mar 04, 2013
You have probably not created your database. Go back to your php my admin and create your database there. Then you need to use the name of the database you created in php my admin in your connection string. For how to create the database in php my admin, simple google it

1 Like

Re: Can Someone Help Me With This "No Database Selected" Challenge by greatdeveloper(m): 6:16pm On Mar 05, 2013
I have written and uploaded an instruction on what to do for you on the following link

http://www.hypertechnetwork.com/products/pg?a=0001

I think it will help you alot.

1 Like

Re: Can Someone Help Me With This "No Database Selected" Challenge by chuchutech(m): 4:26am On Mar 06, 2013
i think you had a wrong approach in ur coding, after creating the variables for the database and established a connection with mysql_connect("localhost",$dbuser,$dbpass) or die('error connecting to db'); then you should add it to a variable like $conn=mysql_connect blah blah; then next line should be mysql_select_db($conn,$dbname);. It should work well if u grab my sketch up, call 07032973337 for help

1 Like

Re: Can Someone Help Me With This "No Database Selected" Challenge by adamuabu: 11:58pm On Mar 07, 2013
Thanks a lot guys for your solutions. Will work on them and get back to you.
Re: Can Someone Help Me With This "No Database Selected" Challenge by hoodboi(m): 8:25am On Mar 08, 2013
chuchutech: i think you had a wrong approach in ur coding, after creating the variables for the database and established a connection with mysql_connect("localhost",$dbuser,$dbpass) or die('error connecting to db'); then you should add it to a variable like $conn=mysql_connect blah blah; then next line should be mysql_select_db($conn,$dbname);. It should work well if u grab my sketch up, call 07032973337 for help

look at the code again he did just that, he added it a variable. There's no wrong approach there. Since the code didn't scale the first test of connectivity then the dbase name or that the dbase as not been created is the problem
Re: Can Someone Help Me With This "No Database Selected" Challenge by adamuabu: 3:42am On Mar 09, 2013
Thanks a lot guys, it finally works. I wasn't using the complete db and username in cpanel (cpanel username followed by an underscore then the MySQL username I created. same with dbname). Thanks a lot, you guided me to it, really appreciate it.

(1) (Reply)

Android(java) Need An Idea For A Free Calling Project Am Working On / School Of Programming / Layer 7 DDOS – Blocking HTTP Flood Attacks

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 12
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.