gh05 Posted August 24, 2008 Share Posted August 24, 2008 Ok so i want to create a website which has a basic database which can be searched (e.g look for venues which cost more than £200) . I am using cpanelX and mysql and php are pre-installed. I set up the SQL database in phpMyAdmin which comes free with cpanelx. So I've read that before using a user can search a mysql database, a connect.php script must first be run. Is this true or can they just go straight ahead and search the database? Well i've copied the following script from a book: ------------------- <?php $user = "gh05";$conn = mysql_connect("91.103.216.201", $user, "donut3"); if($conn){ $msg="Congratulations $user, You connected to MySql"; } ?> <html><head><title>Connecting user</title></head><body><h3><?php echo($msg); ?> </h3></body></html> ------------------------------- But it doesn't work and just gives the following message: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'gh05'@'91.103.216.216' (using password: YES) in /home/jeughogv/public_html/connect.php on line 3. I don't know if i'm connecting to the correct address. The book says to type localhost but that didn't work either so i'm using the IP address that phpMyAdmin displays. Is this correct?? phpMyadmin alsio says that the user is User: jeughogv@localhost. Please help as i'm confused on how to start!!!!! Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/121090-phpmysql-beginner-please-help-very-confused/ Share on other sites More sharing options...
gh05 Posted August 24, 2008 Author Share Posted August 24, 2008 ok scrap that....I just managed to connect using localhost and jeughov (jeughov is my user account for cpanelx) as the user!....but now i'm confused as to how to actually connect to a specific database within my site. You see phpMyAdmin made me create a username and password for the actual database which i created and i was trying to use these to log in (which is why it wasn't working). So how does a user actually query these databases if they haven't got the username and password? Quote Link to comment https://forums.phpfreaks.com/topic/121090-phpmysql-beginner-please-help-very-confused/#findComment-624241 Share on other sites More sharing options...
wildteen88 Posted August 24, 2008 Share Posted August 24, 2008 Pardon. Not sure what you're getting at here. Users which are using your site will not need a mysql username/password. Quote Link to comment https://forums.phpfreaks.com/topic/121090-phpmysql-beginner-please-help-very-confused/#findComment-624260 Share on other sites More sharing options...
coder500 Posted August 24, 2008 Share Posted August 24, 2008 wildteen88 is correct. It seems you want a visitor to query your database. In that case, u need not give them username and password. You write the code for connection. this connection and query statement must be executed, once the visitor enters details like username or when the visitor presses any button... Quote Link to comment https://forums.phpfreaks.com/topic/121090-phpmysql-beginner-please-help-very-confused/#findComment-624261 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.