|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-03-01 18:33 UTC] jndavs at netscape dot net
Description:
------------
Windows XP
PHP 5.1.2
Apache 2.0.55
Mysql 5.0.18
I wrote some code using mysquli() to connect to a Mysql database and list the contents of a table:
$host = "localhost";
$user = "root";
$pass = "password";
$db = "database";
$mysqli = new mysqli($host, $user, $pass, $db);
$query = "SELECT * FROM table";
This worked fine, outputting the expected table data.
I added some code to insert data into the table utilising a form:
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
data: <input type="text" name="data"><br />
<input type="submit" name="submit">
</form>
$query = "INSERT INTO table (data) VALUES ('$data')";
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
This resulted in an error message when the submit button was clicked: "You don't have permission to access /< on this server."
So I stripped out the form code, hard coded the data to be inserted in the table and re executed the query:
// Data to be inserted into database
$data = "dummy";
$query = "INSERT INTO table ( data ) VALUES ('$data')";
// execute query
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
and was rewarded with the following Mysql message: "Access denied for user 'ODBC'@'localhost' (using password: NO)"
Any idea what's causing this?
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 04:00:01 2025 UTC |
Please ignore my last email, I've discovered what was wrong - the insert query should have read $result = $mysqli->query($query) or die ("Error in query: $query. ".$mysqli->error); Thanks for pointing me in the right direction