RE: What's wrong with this query?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Been kind of following this thread off and on...

If the syntax is acceptable by MySQL, which it appears to be, is it possible
that the variables you are using within the query string are not set to
anything? Or is it possible that there is something broken immediately
before the query string is fired?

Most times, when I run into query problems, immediately before I send the
query to the database, I'll echo the statement out to the browser so I can
see the exact string that's being sent to the db.

So can you do this:

$sql = "INSERT INTO log SET term='$search', returns='$arrayword',
time=CURTIME(), date=CURDATE(), ip='$ip'";

echo $sql;

$logit = mysql_query($sql) or
	die(mysql_error());


And check out what gets spit out to the browser when $sql is echoed? Maybe
that'll point out something that's going wrong. If nothing is apparent, post
the results of echo $sql back to the list and maybe one of us will find
something.

HTH.

Rich

> -----Original Message-----
> From: Axel IS Main [mailto:nfzgrld@xxxxxxxxxx]
> Sent: Thursday, February 26, 2004 2:37 PM
> To: PHP DB
> Subject: Re:  What's wrong with this query?
> 
> 
> Ok, ok. I get the message about the syntax. Since I've used 
> this syntax 
> for a long time and so far there hasn't been a problem I'll assume 
> that's not the problem. I will, however, review this and 
> probably make 
> some changes for the sake of compliance if nothing else. In 
> any event, 
> the syntax is NOT why it is failing, smart ass comments by people who 
> think two years is a long time not withstanding.
> 
> As to the useful questions that where asked. There is no 
> error reported. 
> Error reporting is set to E_ALL & ~E_NOTICE. I removed the 
> notice part 
> so I would get everything and still nothing showed up. I'm 
> also logging 
> errors and nothing is showing up in the log either. Not all PHP/MySQL 
> errors are reported. Sometimes what happens is not considered 
> an error, 
> even though it does not do what you would expect it to do. If 
> the query 
> syntax was wrong, I would get a syntax error. There is no 
> error, it just 
> doesn't write to the table. I can go into phpMyAdmin and with 
> the same 
> syntax insert into the table all day long.
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux