Page 1 of 1

Database Admin Tool

Posted: Tue Oct 14, 2003 9:10 am
by cksrealm
All I am trying to develop a script whereby via a web interface users can add/update/edit details on a MySQL database. I do not want it to be something like phpMyadmin at all, as this does not give me the ability to monitor what they are doing. As I am new to PhP I have been doing some research from http://www.php.net and just wanted to make sure that the below code is correct in that it will make a server connection select the database and then close the connection, Pleae can you advise if this is correct.

Thanks

CK
http://www.networkingbasics.co.uk

Code is as follows

<?

/* Connect to the MySQL Database

$link=mysql_connect("localhost","user",("password")

or die("Sorry could not connect to database. Please contact support")

/* Select Database to run script on

mysql_select_db("db_name") or die ("Could not select required Database")

/* Closing connection to Database

mysql_close($link);


Thanks in advance

Posted: Tue Oct 14, 2003 9:32 am
by twigletmac
There is a mistake here:

Code: Select all

$link=mysql_connect("localhost","user",("password")
it should be

Code: Select all

$link=mysql_connect("localhost","user","password");
and

Code: Select all

mysql_select_db("db_name") or die ("Could not select required Database")
should be ended with a semi-colon.

Have you tested the code as that is the easiest way to find out if it works.

Mac

Posted: Tue Oct 14, 2003 10:25 am
by cksrealm
OK thanks for that, any ideas on how to get the script working so that users can update the call

Posted: Tue Oct 14, 2003 5:59 pm
by JAM
There are numerous of ways.

I'm not sure what your final idea of the script is, but mysql_query() is used to add/delete/update information in the database.

But there is so much more than that involved, just talking about how the script should work alongside with the html-form(s).

You state something about monitoring the users. Can you define that abit more? I have a feeling that if you can't do it in phpMyAdmin, you simply can't do it at all (it's that good in my eyes).

Posted: Wed Oct 15, 2003 3:04 am
by cksrealm
When looking at PhPMyadmin I am not able to create a new user correctly. When I try and create say one usser with access to a given database I am getting various errors. What is the best way to get around this.

Thanks

CK
http://www.networkingbasics.co.uk

Posted: Wed Oct 15, 2003 3:34 am
by twigletmac
How are you trying to create the user. Are you using phpMyAdmin's privilege tool? What are the errors that you are getting, we can't help if we don't know what the problem is.

Mac