Jump to content


PHP /mySQL query problem


2 replies to this topic

#1 mycqual

    Newbie

  • Members
  • Pip
  • 0 posts

Posted 26 February 2008 - 12:59 PM

I am having a problem running a query in in php.  When I execute the
query directly against the mysql server it works perfectly but when
executed in PHP it returns no results.
The query is:
SELECT * FROM db1 JOIN db2.field ON db1.table1.custid =
db2.table1.custid  WHERE db1.table1.field2 != "$var";

PHP code:
$query = "SELECT * FROM db1 JOIN db2.field ON db1.table1.custid =
db2.table1.custid  WHERE db1.table1.field2 != '$var' ";
$result = mysql_db_query ("db1", $query);

I don't understand why this query won't return the same result set
when executed in php as when executed directly on the mysql server.

#2 Temple

    Newbie

  • Members
  • Pip
  • 0 posts

Posted 08 April 2008 - 05:47 AM

It might be because mysql_db_query is deprecated as of PHP 4.0.6.

Try using mysql_query instead.

#3 lampchaitanya

    Advanced Member

  • Members
  • PipPipPip
  • 88 posts

Posted 14 July 2009 - 09:25 AM

use mysql_query()





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users