MySQL reads a data loop from a table in a database writes data to a table in another library
MySQL reads a data loop from a table in a database writes data to a table in another library
Code does not error, read code test can pass, write data cannot write.
Read data from table content in test library
$conn =mysql_connect (' localhost ', ' root ', ');
mysql_select_db (' Test ');
mysql_query ("Set names UTF8");
$duqu = "SELECT * from ' content ' ORDER by RAND () LIMIT 0, 10";
$result =mysql_query ($duqu, $conn);
Start loop writing to the database in the Gzw_arctiny table
for ($count =0; $count <10; $count + +)
{
mysql_select_db (' Dedecmsv57utf8sp1 ');
$xieru = "INSERT INTO Gzw_arctiny (' id ', ' typeid ', ' channel ', ' senddate ', ' Sortrank ', ' mid ', ' Addurl ') VALUES (' ', ' 3 ', ' 1 ', ' 1359092641 ', ' 1359094741 ', ' 1 ', ' 1111 ') ";
mysql_query ($xieru, $conn); MySQL Database Insert
------Solution--------------------
Insert INTO gzw_arctiny (' id ', ' typeid ', ' channel ', ' senddate ', ' Sortrank ', ' mid ', ' addurl ') values ...
You enclose the field names in single quotation marks, how can they be executed correctly?
------Solution--------------------
If it is a table of another library, it is connected with a different connection string when writing