Jump to content

php/mysql beginner Please help. Very confused.


gh05

Recommended Posts

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.

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? 

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...

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.