I have this PHP code to insert into mysql.
require_once("../form/corefile/functions.php");
$fn = new Functions();
$offers = $_REQUEST;
$offer=$_REQUEST['offer'];
$website =$_REQUEST['website'];
$keyword =$_REQUEST['keyword'];
$count_offer = count($_REQUEST['offer']);
var_dump($offer);exit;
for($i=0;$i<$count_offer ;$i++){
$_offer = ($offer[$i]);
$_website = ($website[$i]);
$_keyword = ($offer[$i]);
$query = $fn->InsertQuery("INSERT INTO offers (offer, website, keyword) VALUES ('$_offer','$_website','$_keyword')");
//var_dump($query);exit;
if($query)
{
$msg="Data Successfully Saved";
}
}
The array with var_dump($offer)
looks like this;
array (size=2)
0 =>
array (size=1)
'name' => string 'offer1' (length=6)
1 =>
array (size=1)
'name' => string 'offer2' (length=6)
I am getting the error:
Notice: Array to string conversion in repeat.php on line 19
where line 19 is the $query = $fn->insertQuery
Looks like I am making some mistake in pulling the correct data from the array.