Re: php insert command failure Jon Slaughter wrote:
> "Carlton" <USENET@adent.demon.co.uk> wrote in message
> news:f61a5d$j57$1$8300dec7@news.demon.co.uk...
>> I have a mySQL database I am accessing via php using the code
>> if(!$connection = mysql_pconnect("localhost",DBUSER,DBUSERPW))
>> {
>> Fatalerror($connection);
>> }
>>
>> then calling
>> if(!mysql_select_db(DATABASE,$connection)) to select the database.
>>
>> where DBUSER,DBUSERPW and DATABASE are defined variables
>>
>> These functions appear to operate correctly.
>> If I run SELECT queries, using $result=mysql_query($query,$connection);
>> I get the correct data returned from the database.
>>
>> However, running INSERT queries fail.
>> mysql_errno($connection) and mysql_error() both return empty strings,
>> giving no indication of the cause of the error.
>>
>> I have checked the insert query syntax by cutting and pasting into mySQL
>> at the command line.
>>
>>
>
> Perhaps you do not have the proper permissions?
>
>
I have checked the privilege data from mysql, all appears OK to me.
mysql> SHOW PRIVILEGES;
+-------------------------+--------------------------+-------------------------------------------------------+
| Privilege | Context | Comment
|
+-------------------------+--------------------------+-------------------------------------------------------+
| Alter | Tables | To alter the
table |
| Create temporary tables | Databases | To use CREATE
TEMPORARY TABLE |
| Create | Databases,Tables,Indexes | To create new
databases and tables |
| Delete | Tables | To delete
existing rows |
| Drop | Databases,Tables | To drop databases
and tables |
| File | File access on server | To read and write
files on the server |
| Grant option | Databases,Tables | To give to other
users those privileges you possess |
| Index | Tables | To create or drop
indexes |
| Insert | Tables | To insert data
into tables |
| Lock tables | Databases | To use LOCK
TABLES (together with SELECT privilege) |
| Process | Server Admin | To view the plain
text of currently executing queries |
| References | Databases,Tables | To have
references on tables |
| Reload | Server Admin | To reload or
refresh tables, logs and privileges |
| Replication client | Server Admin | To ask where the
slave or master servers are |
| Replication slave | Server Admin | To read binary
log events from the master |
| Select | Tables | To retrieve rows
from table |
| Show databases | Server Admin | To see all
databases with SHOW DATABASES |
| Shutdown | Server Admin | To shutdown the
server |
| Super | Server Admin | To use KILL
thread, SET GLOBAL, CHANGE MASTER, etc. |
| Update | Tables | To update
existing rows |
| Usage | Server Admin | No privileges -
allow connect only |
+-------------------------+--------------------------+-------------------------------------------------------+
mysql> SHOW GRANTS for carlton@localhost;
+------------------------------------------------------------------------------------------------------------------+
| Grants for carlton@localhost
|
+------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'carlton'@'localhost' IDENTIFIED BY
PASSWORD '67016e577800cc48' WITH GRANT OPTION |
| GRANT ALL PRIVILEGES ON `picwin`.* TO 'carlton'@'localhost'
|
| GRANT ALL PRIVILEGES ON `picturewin`.* TO 'carlton'@'localhost'
|
+------------------------------------------------------------------------------------------------------------------+
I believe this indicates I have sufficient privileges to access the
database. I have also added mysql to my user group, but still no access.
If the problem is with access rights, where is the problem most likely
to be?
regards,
Carlton. |