Re: MySQL Newbie
| From: | hugh danaher | Date: | Mon, 28 Jan 2002 23:32:13 +0000 |
| Subject: | Re: MySQL Newbie | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-82492@lists.php.net to get a copy of this message | ||
Ben,
Making the assumption that you plan on using php as the language to place or
extract data from the mysql database, you'll need to:
open a mysql database on-line (or have the site manager do this for you)
Write a php interface program which would write to, change or extract data
from the mysql database.
if you are familiar enough with the command line prompts you could use a
variation of the following to write to or alter your database:
<html>
<head>
<title>Database Modification Page</title>
</head>
<body bgcolor="Navy" >
<table width="95%" valign="top" cellpadding="7"
bgcolor="silver"><tr><td>
<form action="<?php print $php_self?>" method="post">
<?php
// open database section
print "<table width=100%><tr><td valign=top>Database Name:<br><input
type=text name=db ><br>";
print "Database Password:<br><input type=text
name=pass><br> </td>";
print "<td valign=top align=center><h1>DATABASE MODIFICATION</h1>";
print "</td></tr></table><br>";
print "Database Action:<br><textarea name=request rows=9
cols=90></textarea><br> <br>";
print "<input type=submit value=\" go \">";
print "</form>";
if (isset($db))
{
$link=mysql_connect("localhost","","$pass");
if (! $link) die("couldn't connect to mysql");
mysql_select_db($db,$link) or die ("couldn't open $db ".mysql_error());
$results=mysql_query("$request"); // purpose statement
if (! $results)
{
die ("cannot Modify $db ".mysql_error());
}
else
{
print "Database Action: ".$request;
}
mysql_close($link);
unset($db);
}
?>
</td></tr></table>
</body>
</html>
----- Original Message -----
From: "Ben Clumeck" <bclumeck@home.com>
To: <php-general@lists.php.net>
Sent: Monday, January 28, 2002 2:49 PM
Subject: [PHP] MySQL Newbie
> How do I use MySQL through the web. I currently have MySQL running on my
> personal PC on WinXP. I use a command prompt to add tables, add records,
> and so forth. How do I create tables and records when my database is on
the
> web?
>
> Thanks,
>
> Ben
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>