Hello again. I cant seem to find the answer to this or find what I need anywhere. My brain just doesnt want to register in I guess... If someone could have a look at this: http://pastebin.com/330111 The page that the script is on has an error that says: Could not do a mysql query. Reason why: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ''database','localhost','username','password') values Any help is greatly appreciated.
If you dont want to see the script there, it is below with the html that is in it too.
<?php
if (isset($_POST['submit']))
{
$getdbname=$_POST['dbname'];
$getdbhost=$_POST['dbhost'];
$getdbuser=$_POST['dbuser'];
$getdbpswd=$_POST['dbpswd'];
}
if(!empty($getdbname) && !empty($getdbhost)&& !empty($getdbuser) && !empty($getdbpswd) ) {
echo $getdbname."<br>".$getdbhost."<br>".$getdbuser."<br>".$getdbpswd ;
$query = "insert into schedule (`$getdbname`, `$getdbhost`, `$getdbuser`, `$getdbpswd`) values ('$dbname', '$dbhost', '$dbuser', '$dbpswd')";
$db = mysql_connect($dbhost,$dbuser,$dbpswd)
or die("could not connect to MySQL server!");
mysql_select_db($dbname)
or die("Something went wrong. Please check to see if you have the correct information.");
$result = mysql_query($query)or die("Could not do a mysql query. Reason why: ".mysql_error());
echo "<meta http-equiv=\"refresh\" content=\"0; URL=installcomplete.htm\">";
if(!$query){echo "something screwed up! try again"; }
mysql_close();
}
?>
Here is the html that is at the top of the page:
<html>
<head>
<title>Band Schedule Install</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<style type="text/css">
BODY {scrollbar-face-color: #020302; scrollbar-shadow-color: #020202; scrollbar-highlight-color: #000000;
scrollbar-3dlight-color: #333333; scrollbar-darkshadow-color: #020202; scrollbar-track-color: #333333;
scrollbar-arrow-color: #660000}
</style>
<body bgcolor="#000000" text="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="36">
<table width="100%" border="0" background="images/headerback.gif" cellspacing="0" cellpadding="0">
<tr>
<td height="60" width="6%"> </td>
<td height="60" width="94%">
<div align="center"><font face="Arial, Helvetica, sans-serif"><b><font color="#CCCC00">Concert
Schedule V: 1.2</font></b></font></div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="2"><font color="#CCCC00" face="Arial, Helvetica, sans-serif">Database
connection setup<br>
<font color="#000000">. </font></font></td>
</tr>
<tr>
<td height="2">
<div align="center"><font face="Arial, Helvetica, sans-serif" size="2" color="#CCCCCC"><b><font color="#DFDFDF">Next
we need to set up connection to the database. Enter the information below
and click on enter.</font></b></font></div>
</td>
</tr>
</table>
<form action="" method="post">
<table width="70%" border="1" align="center" bordercolorlight="#333333" bordercolordark="#666666">
<tr>
<td width="39%"><font size="2" face="Arial, Helvetica, sans-serif"><b>Name
of Database:</b><br>
<font color="#CCCCCC">(Ex: mydomain_database Seen when setting up)</font></font></td>
<td width="31%">
<input type="text" name="dbname" size="" value="" />
</td>
<td width="30%"> </td>
</tr>
<tr>
<td width="39%"><font size="2" face="Arial, Helvetica, sans-serif"><b>Name
of Database Host:</b><br>
<font color="#CCCCCC">(Almost always: localhost if not then erase and
replace it)</font></font></td>
<td width="31%">
<input type="text" name="dbhost" size="" value="localhost" />
</td>
<td width="30%"> </td>
</tr>
<tr>
<td width="39%"><font size="2" face="Arial, Helvetica, sans-serif"><b>User
Name: </b><br>
<font color="#CCCCCC">(Typically the name you gave when setting up the
database)</font></font></td>
<td width="31%">
<input type="text" name="dbuser" size="" value="" />
</td>
<td width="30%"> </td>
</tr>
<tr>
<td width="39%"><font size="2" face="Arial, Helvetica, sans-serif"><b>Password:
</b><br>
<font color="#CCCCCC">(Typically the password you gave when setting up
the database) </font></font></td>
<td width="31%">
<input type="text" name="dbpswd" size="" />
</td>
<td width="30%">
<div align="center">
<input type="submit" name="submit" value="Enter" />
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
The objective is to have the form do two things... To connect to the database, and also enter the information that is used to connect to it to certain fields of the database table. The table is already installed.
Much appreciation for any help. I know this seems a repeat, but I have got a little further in it.
Peredy