Database Admin Tool

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
cksrealm
Forum Newbie
Posts: 3
Joined: Tue Oct 14, 2003 9:10 am

Database Admin Tool

Post 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
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
cksrealm
Forum Newbie
Posts: 3
Joined: Tue Oct 14, 2003 9:10 am

Post by cksrealm »

OK thanks for that, any ideas on how to get the script working so that users can update the call
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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).
cksrealm
Forum Newbie
Posts: 3
Joined: Tue Oct 14, 2003 9:10 am

Post 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
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
Post Reply