Noob question (No database selected)
Posted: Thu Aug 27, 2009 11:32 pm
I'm trying to install a poll script. I created a database for it in cPanel:
Database name: psythik_poll
Database user: psythik_poll
Database user pass: aaaaaa (not really, but you know what I mean)
The poll script uses the following code to connect to the db:Obviously I'm missing something here, because No database selected comes up when I try to run the script. I have very limited knowledge (read: none whatsoever) of PHP & mySQL, so if anyone could help me out by describing the solution in layman's terms, I'd appreciate it.
Database name: psythik_poll
Database user: psythik_poll
Database user pass: aaaaaa (not really, but you know what I mean)
The poll script uses the following code to connect to the db:
Code: Select all
<?php
$db = mysql_connect("localhost", "psythik_poll", "aaaaaa") or die("Could not connect.");
if(!$db)
die("no db");
if(!mysql_select_db("db_name",$db))
die("No database selected.");