Hi All,
I have this quickie test page to try where I pass a sql string to a function that connects and runs the query....it doesn't seem to pass the results back...I can't access the data....
here is the code
<?
//test to dl case info
require("dbconn.php");
$case_id = "CA8008250";
$sql="select * from case_info where case_number='$case_id'";
echo $sql."<br>";
remote_conn($sql);
if ($result)
while ($row = mysql_fetch_array($result)){
$data = implode(",",$row);
$data = str_replace(",","','",$data);
echo "data is: ".$data."<br>";
}
mysql_free_result($result);
mysql_close($result);
?>
and the function
function remote_conn($strsql)
{
$username = "root";
$pwd = "******";
$host = "192.168.100.10";
$dbname = "test_db";
if (!($conn=mysql_connect($host, $username, $pwd))) {
printf("error connecting to DB by user = $username and pwd=$pwd");
exit;
}
$db=mysql_select_db($dbname,$conn) or die("Unable to connect to remote database");
$result=mysql_query($strsql) or die ("Can't complete remote query because ".mysql_error());
return $result;
}
TIA