Database issues

Bgermain

New Member
It's been awhile since I created a new database and connected to it. A couple of questions.
I created a new database and found an information schema there. Is this a new thing or did I do something wrong?

When I attempt to connect to the database, I get the error "database not found."
I have always connected with this:
$DBASE="database name but now with the new prefix appended";
$DBTABLE="tablename";
$DBASEUSER="username but now with the new prefix appended";
$DBASEPASSWORD="password";

Is this correct?

Thank you for your time in helping me.
 
I think @mysql_connect was deprecated in PHP5.5, try mysqli instead or PDO_mysql instead. Happy learning!!! :)


<?php
// Old way
@mysql_connect("localhost", "$DBASEUSER", "$DBASEPASSWORD");
// New way
$connection = mysqli_connect("localhost", "$DBASEUSER", "$DBASEPASSWORD");

// Old way
mysql_query('CREATE TEMPORARY TABLE `table`', $connection);
// New way
mysqli_query($connection, 'CREATE TEMPORARY TABLE `table`');
?>

Not sure if it is ' or " needed.
 
Found out about mysqli. Still doesn't work. I am still very confused about referencing the database name and username. Do I need to use the generated prefix or just the database name and username I assigned? I suspect that is part of my issue too.
 
Yes, you need to use the entire db and username. It should look like (assuming Cpanel) "account_database", and "account_username", with "account" being the user account the db was created using/for.
 
Top