query excuting problem

Posted by srini-r85 on Stack Overflow See other posts from Stack Overflow or by srini-r85
Published on 2010-05-25T11:11:31Z Indexed on 2010/05/25 11:41 UTC
Read the original article Hit count: 244

Filed under:
|

hi,

i tried to execute following query in php script.

$db_selected = mysql_select_db("lumiinc1_sndemo1", $con);

if ($db_selected) {    
  echo "database connected";
}
else
{
  die ("Can\'t use db : " . mysql_error());
}

$sql = "INSERT INTO `markers` ( `name`, `address`, `lat`, `lng`, `id` ) SELECT `name`, `street`, `latitude`, `longitude`, `lid` FROM `location` WHERE NOT EXISTS ( SELECT * FROM `markers` WHERE `location`.`lid` = `markers`.`id` )";

$result = mysql_query($sql);

if ($result) {
    echo "Query executed OK";
} else {
    die("Invalid query: " . mysql_error());
}

script does not show any error.also query executed.but i didn't get my expected result.at the same i try this query in phpmyAdmin i got my expected result. i dont know the cause of this problem. plz any one find the problem . thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql-query