ID:               36576
 User updated by:  jndavs at netscape dot net
 Reported By:      jndavs at netscape dot net
 Status:           Bogus
 Bug Type:         MySQL related
 Operating System: Windows XP
 PHP Version:      5.1.2
 New Comment:

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


Previous Comments:
------------------------------------------------------------------------

[2006-03-01 19:53:41] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Erhm. Are you mixing ext/mysql and ext/mysqli.. ..and OO and
procedural?
If I understand you correctly you have one file where you connected to
the mysql database just fine - then completly diffrent file which
doesnt even try to connect?

No bug here..

------------------------------------------------------------------------

[2006-03-01 18:33:58] 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?



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36576&edit=1

Reply via email to