[PHP] Re: Strange error in PHP/MySQL
On Sun, 01 Oct 2006 19:59:08 +0100, Deckard wrote: Hello, I have this code: // insert new user in mysql user table $sqlInsertUser = INSERT INTO user (Host, User , Password , Select_priv, Insert_priv, Update_priv, Delete_priv) VALUES ('$hostname', '$mysql_username', '$mysql_password', 'N', 'N', 'N', 'N'); if (mysql_query($sqlInsertUser, $conn)) $messagesqlInsertUser = 'Success...'; else $messagesqlInsertUser = 'Error: ' . mysql_error(); $result = mysql_query($sqlInsertUser); that gives me the error: Error: Duplicate entry 'localhost-' for key 1 I can't see nothing wrong with it and if i run it in MySQL's prompt everything's fine. Any ideas ? Besta Regards, Deckard. Hi, Wouldn't it be easier to just use the MySQL GRANT statement? Ivo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Strange error
Sid [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello everyone, Am I having a bad day or WHAT! I have exactly 5 lines of code as follows what is the problem here. works fine at my localhost. rush -- http://www.templatetamer.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: strange error message when trying to start apache
Hello again, so earlier I was trying to install PHP-4.2.2 with Apache-2.0.40 and was having some sapi problems. I then read that I might be better off going with Apache-1.3.26. Well, I installed 1.3.26, and then configured and installed php into apache as a DSO. Everything appeared to go smoothly, except when I try to start up Apache, I get the following error message: Syntax error on line 205 of /usr/local/apache/conf/httpd.conf: API module structure `php4_module' in file /usr/local/apache/libexec/libphp4.so is garbled -perhaps this is not an Apache module DSO? /usr/local/apache/bin/apachectl start: httpd could not be started When you compiled PHP, it didn't really work. There are some error messages you missed as they flew by during that whole ./configure make make install thing. Re-do that part, only do things like this: ./configure --with-apxs=... --with-mysql=... 21 configure.output make 21 make.output make install 21 install.output You'll be able to watch things happen by doing: tail -f configure.output (Hit control-C when it's done) and similarly for make.output and install.output When you're all done, search through configure.output and make.output for Error or Warning messages. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: strange error
Brack wrote: if you have structure like html ?php if (isset(...)){ ..; } elseif (isset()){ } else { .. ? /html then you need to insert } before /html or if you use syntax Correct, in part. The last ELSE has a starting {, but no ending }. It should go before the ? not /html, that would place it outside the PHP code block. html ?php if (isset()): ..; elseif (isset()): ..; else: ..; ? /html you have to insert endif; If you think you did it but still have an error, try to count your if statements and endif; maybe something is missing. Youri the correct structure would be: html ?php if ( condition ) { multiple ; statements for condition=true, all ended with ; (semi-colon) ; } elseif ( other_condition) { multiple ; statements for other_condition=true, all ended with ; (semi-colon) ; } else { other block ; of multiple lines ; } ? /html Note that curly braces (expression group) does not need the semicolon after them. If the IF, ELSEIF or ELSE constructs just need to execute one line then html ?php if (condition) echo whatever ; ? /html the constructs themselves don't need an ending semicolon Elias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: strange error
if you have structure like html ?php if (isset(...)){ ...; } elseif (isset()){ } else { ... ? /html then you need to insert } before /html or if you use syntax html ?php if (isset()): ...; elseif (isset()): ...; else: ...; ? /html you have to insert endif; If you think you did it but still have an error, try to count your if statements and endif; maybe something is missing. Youri -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: strange error
if you have structure like html ?php if (isset(...)){ ...; } [...] ? /html you have to insert endif; If you think you did it but still have an error, try to count your if statements and endif; maybe something is missing. This is a matter of personal preference, but use formatting that is helpful to determine where you are in your code... and comment yourself... it will avoid missing } { and other common erors that eat up valuable time tracking down. HTML cares less about the extra spaces and \n's anyway ?PHP while(something){ if(something){ doing something }else{ doing something else } #endif } #endwhile ? While generally restrictive in nature, some good ideas for policing your own code can be found at http://utvikler.start.no/code/php_coding_standard.html (just one copy I came across). take what you need out of there... once you stick to a method, your occasions of tracking down loose ends will drop greatly. Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: strange error
Hi Jeremy, I get an error message which I can't figure out. Its a Parse error: on line 142 which is the last line of the page containing absolutly no code. The last line of code is simply /HTML..Did anyone have a similar experience? Can anyone help me out please? I guess you haven't closed the ?php tag with ?, before your /HTML code. Otherwise, the php parser will think that it's still parsing php code, which results in an parse error. Regards, Gijs. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]