View Full Version : Help Help
Kabouter
08-29-2001, 02:48 PM
Hi Reuben,
I need some help badly,
my database doesn't seems to work.
In Cpanel it's working fine, ( I believe ),
but I can't find it on my site. what am I doing wrong ???
I'm a newbie with SQL and PHP.
greetings Kabouter ;)
reuben
08-29-2001, 02:50 PM
Hello,
Your database isn't actually stored in your account, so you won't be able to see it directly. It is stored in our database folder.
nsr81
08-29-2001, 07:31 PM
You access a mySQL database not through a folder but in the following manner:
mysql_connect("localhost","username","password");
mysql_select_db("databasename");
Kabouter
08-30-2001, 09:27 AM
hi nsr81,
Your right I can access a mySQL database, through telnet in the following manner:
mysql_connect("localhost","username","password");
mysql_select_db("databasename");
but ........ I need to acces it through my homepage, how do I do that ???
greetings Kabouter ;)
nsr81
08-30-2001, 01:03 PM
This is the PHP code I use for DB access.
<?
$db_name="DBname";
$connection = @mysql_connect("localhost", "username", "password") or die ('Cannot connect to the database.');
$db = @mysql_select_db($db_name, $connection) or die("Database is unavailable.");
$sql = "INSERT INTO emails (id, email, date) VALUES ('', '$email', NOW(''))";
$result = @mysql_query($sql, $connection) or die("Database is unavailable at the moment.");
?>
<html>
<head>
<title>Emails</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?
if($result)
{
echo "<p> Your email has been added successfully to the mailing list. </p>";
}
?>
</body>
</html>
All this is stored in "emails.php", which is called from a form like this.
<Form action="emails.php" method="post">
This page is currently active at www.al-iqbal.org . I'm collecting people's emails through this script. You can also try to go through the source of the main page to see how exactly I use it.
nsr81
Kabouter
08-30-2001, 01:31 PM
hi nsr81,
thanks for the reply, I wil certainly have a look and try to learn about it.
greetings Kabouter ;)
vBulletin® v3.8.1, Copyright ©2000-2010, Jelsoft Enterprises Ltd.