Reputation: 39
My code is as follows:
foreach ($row_result as $results)
{
$f = fopen("jigsaw.csv", "a+");
$new_array = array();
$content = $results->findElement(WebDriverBy::className('seo-company'))->geTtext();
$test = array();
if ($i == 1)
{
$Orgnisation_name = $content;
$concate = array_push($test,$Orgnisation_name);
echo "\n";
}
if ($i == 2)
{
echo $Website = $content;
echo "\n";
}
if ($i == 3)
{
echo $HeadQuarters = $content;
echo "\n";
}
if ($i == 4)
{
echo $Phone = $content;
echo "\n";
}
if ($i == 5)
{
echo $Industries = $content;
echo "\n";
}
if ($i == 6)
{
echo $Employees = $content;
echo "\n";
}
if ($i == 7)
{
echo $Revenue = $content;
echo "\n";
}
if ($i == 8)
{
echo $Ownership = $content;
echo "\n";
}
$i++;
}
Here I want to push one by one element into concate array and finally save it into mysql php database.
When I try to push it into concate array its printing me 1 which is wrong.
What should I do?
Upvotes: 0
Views: 96
Reputation: 2014
Do you need to use array_push? $concate = array_push($test,$Orgnisation_name);
$test is blank at this point. If you just want to add an item to the $concate array, $concate[] = $Orgnisation_name;
is enough.
Upvotes: 1
Reputation: 8889
array_push return value is:
Returns the new number of elements in the array.
So 1 is the number of elements in array.
Seems that you will always have 1, because you call $i++
and according to your code, block with array_push
will be executed once.
Upvotes: 2