mysql_num_rows()期望参数1是资源,给定[duplicate]的数组

Hi I have been struggling with this query for a while now

I need to get the number of rows inserted into my database table, but I keep getting this error I can't seem to get rid of.

$result3=mysql_query("INSERT INTO dest_table.create_info SELECT * from 
Profusion.source_cdr");
$num_rows = array($result3);
$progress=mysql_num_rows($num_rows);
echo $progress;

The error I get is

mysql_num_rows() expects parameter 1 to be resource, array given

It will be highly appreciated if I get this resolved

</div>

You have to pass the resource not the array.

$result3=mysql_query("INSERT INTO dest_table.create_info SELECT * from 
Profusion.source_cdr");
$progress=mysql_num_rows($result3);
echo $progress;

But since you are using INSERT you should read the manual and use mysql_affected_rows() because mysql_num_rows() only works with SELECT and SHOW.

http://www.php.net/manual/de/function.mysql-affected-rows.php

$result3=mysql_query("INSERT INTO dest_table.create_info SELECT * from 
Profusion.source_cdr");
$progress=mysql_affected_rows();
echo $progress;

When using an INSERT statement, mysql_query() doesn't return an array. It returns true on success or false on failure. Use mysql_affected_rows().

For example:

mysql_query("INSERT INTO table (field1,field2) VALUES ('foo', 'bar')");
$num_affected_rows = mysql_affected_rows();

echo $num_affected_rows;

//output: 1