List:General Discussion« Previous MessageNext Message »
From:jahan Date:April 26 1999 8:51pm
Subject:Re: mysql_query problem: insert .. select
View as plain text  
Thank you very much.
But you can see in my "try list" ,  I can do every thing if I drop the select.
ie. mysql_query(&mysql,"insert into PostCodes values(0,'NYC','1234567890)");
//No problem

-> Thing that I checked.
-> Connected to MySQL - Yes
-> Can insert to PostCodes , if I drop the select part
-> Tried the <> operator
-> Works very fine in command prompt ( copy /paste, exactly )

Michael Widenius wrote:

> >>>>> "jahan" == jahan  <jahan@stripped> writes:
>
> jahan> PostCodes
> jahan> - ID- auto
> jahan> - City  char 50
> jahan> - PostCode char 20
>
> jahan> Addresses
> jahan> - Name
> jahan> - Age
> jahan> - City char 50
> jahan> - PostCode char 20
>
> jahan> This is the call I make .
>
> jahan> ConnectToMySQL(); // Display Error if not connected
> jahan> UseDatabase("Statistics"); // Display Error if not used
> jahan> if(mysql_query(&mysql,"insert into PostCodes select 0,City,PostCode
> jahan> from Addresses where City !='CAL'")!=0)
> jahan>    Show_error();
>
> jahan> And I get this error.
> jahan> Access denied for user: 'jahan@localhost' to database 'Statistics'
>
> jahan> Thing that I checked.
>
> -> Connected to MySQL - Yes
> -> Can insert to PostCodes , if I drop the select part
> -> Tried the <> operator
> -> Works very fine in command prompt ( copy /paste, exactly )
>
> jahan> Q. Is it built feature not to support subquery in mysql_query ?
> jahan> Q. Any expert sees any problem with the query above ?
>
> jahan> Thank you very much.
>
> Hi!
>
> The above means that the user 'jahan@localhost' doesn't have the right
> to insert rows or update the Statistics database.
>
> Please try this again from the 'mysql' command prompt !  If this
> works, please verify with 'status' that you are really logged in as
> jahan@localhost!
>
> Regards,
> Monty
>
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail mysql-thread2366@stripped
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail mysql-unsubscribe@stripped instead.

Thread
mysql_query problem: insert .. selectjahan25 Apr
  • mysql_query problem: insert .. selectMichael Widenius26 Apr
  • Re: mysql_query problem: insert .. selectjahan26 Apr
  • Re: mysql_query problem: insert .. selectjahan26 Apr