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
Database Admin Tool
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
There is a mistake here:
it should be
and
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
Code: Select all
$link=mysql_connect("localhost","user",("password")Code: Select all
$link=mysql_connect("localhost","user","password");Code: Select all
mysql_select_db("db_name") or die ("Could not select required Database")Have you tested the code as that is the easiest way to find out if it works.
Mac
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).
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).
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
Thanks
CK
http://www.networkingbasics.co.uk
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK