--- Dave Carrera <[EMAIL PROTECTED]> wrote:
> $addamysqluser = mysql_query("grant
> select,insert,drop,update,delete,create,index,alter on $_POST[f2] to
> [EMAIL PROTECTED] IDENTIFIED by $_POST[f3]");
> 
> What is wrong with the above php based mysql_query?

I'm not sure about the query itself, but it seems to me your problem is
more about using strings with PHP.

$foo = "grant select,insert,drop,update,delete,create,index,alter on
$_POST[f2] to [EMAIL PROTECTED] IDENTIFIED by $_POST[f3]";
echo $foo;

Try that, and I think the output will show you the problem. The solution
is to use curly braces around $_POST['f2'], in addition to properly
quoting the key as I just did.

In order to more easily identify problems like this, you can:

1. Store the query in a variable, and use that variable in mysql_query().
This will allow you to echo it to the screen or something during
debugging, so that you can identify anything obvious, such as this.

2. Output mysql_error() if mysql_query() does not return true. This will
show you what MySQL thinks the error is, which is very helpful.

Hope that helps.

Chris

=====
My Blog
     http://shiflett.org/
HTTP Developer's Handbook
     http://httphandbook.org/
RAMP Training Courses
     http://www.nyphp.org/ramp

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to