Re: strange problem of mysql_query

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

 



On Wed, 2010-06-02 at 17:36 +0800, I am on the top of the world!
Borlange University wrote:

> hey, i have a sql string like below:
> select szs_content from szs_gy_ca where szs_shengchanhao='09-s525' and
> szs_guige='48B32/14-1 1/8"' and szs_tuhao='48B32 1 1/8'
> 
> the problem is that using mysql_query to run this sql string returns
> nothing,however, i can get one record through mysql query tool.
> 
> i was wondering whether the double quote 48B32/14-1 1/8" makes this trouble.


The double quotes inside of that query won't cause any trouble, but you
haven't shown us how you're executing the query with PHP. The usual is
to do something like this:

$query = "select szs_content from szs_gy_ca where
szs_shengchanhao='09-s525' and szs_guige='48B32/14-1 1/8\"' and
szs_tuhao='48B32 1 1/8'";
$result = mysql_query($query);

Note that the double quote there is escaped because you're already using
double quotes as the string identifier in PHP.

If that still doesn't give you the results you expect, it's more likely
a logic problem than a syntax issue.

Thanks,
Ash
http://www.ashleysheridan.co.uk



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux