yangkai9999 Posted November 30, 2009 Share Posted November 30, 2009 Hello,I wrote a code like this:<?phpif (!isset($_POST['getid'])) ( $chk=$_POST["getid"] ) ;$chk=$_POST["getid"];$hostname='localhost';$user='root';$pass='Openit4me';$dbase='mytest';$connection = mysql_connect("$hostname" , "$user" , "$pass") or die ("Can't connect to MySQL");$db = mysql_select_db($dbase , $connection) or die ("Can't select database.");//delete all records from p1_select table;$_del = mysql_query("delete from p1_select;");//insert the selected recorcd into p1_select table;$_ins = mysql_query("insert into p1_select from p1 where CHR=$chk;");?>the goal are:1. clean the data which existing in the table p1_select2. insert new data into the table p1_selectbut it seems doesn't work for me. Can anyone can tell me how to perform the script?Thank you, Link to comment Share on other sites More sharing options...
yangkai9999 Posted November 30, 2009 Author Share Posted November 30, 2009 Hello,I wrote a code like this:<?phpif (!isset($_POST['getid'])) ( $chk=$_POST["getid"] ) ;$chk=$_POST["getid"];$hostname='localhost';$user='root';$pass='Openit4me';$dbase='mytest';$connection = mysql_connect("$hostname" , "$user" , "$pass") or die ("Can't connect to MySQL");$db = mysql_select_db($dbase , $connection) or die ("Can't select database.");//delete all records from p1_select table;$_del = mysql_query("delete from p1_select;");//insert the selected recorcd into p1_select table;$_ins = mysql_query("insert into p1_select from p1 where CHR=$chk;");?>the goal are:1. clean the data which existing in the table p1_select2. insert new data into the table p1_selectbut it seems doesn't work for me. Can anyone can tell me how to perform the script?Thank you,I solved the problem.Thanks, Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.