<?php
//connecting to the local database
$con=mysql_pconnect('localhost','user','pass');//servername,username,password
if(!$con)
{
die("couldn't connect");
}
echo "database connected";
mysql_select_db("dtestfor_IPAB_db",$con);//databasename
$rs2=mysql_query("select sms_index as 'ma' from tab3", $con);
$max=mysql_fetch_assoc($rs2);
print_r($max['ma']);
//connecting to the local database ends
//connecting to the remote database
$dblink2 = mysql_pconnect('test1.deftlogic.com', 'user','pass'); // connect server 2
mysql_select_db('dtestone_db_2025', $dblink2); // select database 2
//echo $dblink2;
if(!$dblink2)
{
echo "not connected";
}
else echo "db2 connected";
$rs=mysql_query("select Message from sms where sms_index>=".$max['ma'],$dblink2);
$msgs=mysql_fetch_assoc($rs);
$msgs2=array();
//connecting to the remot database ends
//connecting to the local database
do
{
array_push($msgs2,$msgs['Message']);
}
while($msgs=mysql_fetch_assoc($rs));
foreach($msgs2 as $m)
{
$m2=explode(",",$m);
mysql_query("insert into bd_paidabribe(city,dept,amount) values('".$m2[0]."','".$m2[1]."','".$m2[2]."')", $con);
}
//connecting to the local database ends
//connecting to the remot database
$rs4=mysql_query("select max(sms_index) as 'ma' from sms");
$max2=mysql_fetch_assoc($rs4);
//connecting to the remot database ends
//connecting to the local database
mysql_query("UPDATE tab3 SET sms_index = ".$max2['ma']);
//connecting to the local database ends
?>
so this is the thing what u r suggesting me...i tried even like this the error is
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/dtestfor/public_html/ipabex1.php on line 37
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/dtestfor/public_html/ipabex1.php on line 45
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/dtestfor/public_html/ipabex1.php on line 67