i dont have it open at this minute, but logged into cpanel, i loaded my files into file manager, one of which asked me to fill in where it says something like mysql_connect (server, user, password, dbname), created a database, gave it a name, user and password, i then went into myphpadmin and put files into the databases i created…
i typed in the web address using my domain name, clicked the file, logged in and it open up… but most i couldnt access most of the stuff on there because of the error message telling me “fatal error undefined mysql_connect” which leads back to this file i uploaded and the line where it says i should enter my (server, user, password, dbname)
thanks for any help anyone can offer on this. its really driving me around the bend.
I read somewhere that all i need to do is delete a semicolon infront of the MySQL extension to enable it. Would i need to contact my host for that is can i do that myself?
there shouldn’t be a problem with the code… i’ve pasted it is below… i’ve edited it in file manager to show the relevant info, i.e. abc_user. and the error mesage points to line 6, but i’m confident i’ve put in the correct info in the correct manner.
im wondering… does it matter that the code says mysqli when cpanel is using mysql??
<?php
require_once ‘config.php’;
function db_open() {
$dbase = mysqli_connect (DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME);
if (mysqli_connect_errno()) {
printf ("<font class='error'>Connect failed</font> : %s\
", mysqli_connect_error());
return null;
}
return $dbase;
}
function db_close($dbase) {
mysqli_close($dbase);
}
?>
thanks again for any help given. much appreciated!
Check the server name (It should be “localhost”), also check your username amd database name. Most hosts require a prefix to the main database name. If your capnel login name is abc, your database name will be named abc_dbname and your database user name will also be abc_username. Your password can be anything.
Also check the priviledge granted to your user name. It must be at least a SELECT priviledge