Reputation: 371
I am getting the error
"Warning: mysql_query(): supplied resource is not a valid MySQL-Link resource in on line 21"
I have tried several different Queries none of which has worked. Any help would be appreciated!
Code:
<html><body>
<form action="attempt1.php" method="post">
Interest Rate: <input type="text" name="interest_rate"><br>
<input type="Submit">
</form>
<?php
$server = <removed for safety>;
$login = <removed for safety>;
$pass = <removed for safety>;
$interest_rate=$_POST['interest_rate'];
$dblink = mssql_connect($server, $login, $pass) or die("Error1");
mssql_select_db('<removed for safety>', $dblink) or die( "unable to select the database");
$sqlquery = "INSERT INTO interest_rate VALUES('$interest_rate')";
$res = @mssql_query($sqlquery, $dblink);
$query=" SELECT * FROM 'interest_rate' ";
$result=mysql_query($query,$dblink) or die(mysql_error());
echo "<b>Output to table</b><br>";
echo "<table border='1'>
<tr><th>Interest Rate</th></tr>";
while ($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['interest_rate'] . "</td>";
echo "</tr>";
echo $row['interest_rate'].""."<br>";
}
echo "</table>";
?>
</body></html>
Upvotes: 0
Views: 382
Reputation: 181350
You are mixing stuff here.
This call:
mssql_select_db
And:
mssql_connect
Are for Microsoft SQL Server.
And you are trying to use with a mysql_query
call. Decide whether you are using MySQL or SQLServer and pick function calls accordingly.
Upvotes: 1