0

Array to string conversion error, cant find the problem, new to php. Any help would be appreciated.

<?php

$row = array(
    'username' => 'Username',
    'count' => 5
);

echo '<table><tr><td>'
    . $rowtwo . '</td><td><a href="profile.php?user='
    . $row['username'] . '">'
    . $row['username'] . '</a></td><td>'
    . $row['count'] . '</td></tr></table>';

?>
Halvor Holsten Strand
  • 19,829
  • 17
  • 83
  • 99
r33drum
  • 151
  • 1
  • 7

1 Answers1

1

you can't concatenate array with string. Define index of array which you want to concatenate. Like this

<?php

    $row = array(
        'username' => 'Username',
        'count' => 5
    );

    echo '<table><tr><td>'
        . $rowtwo['index'] . '</td><td><a href="profile.php?user='
        . $row['username'] . '">'
        . $row['username'] . '</a></td><td>'
        . $row['count'] . '</td></tr></table>';

    ?>

Hope this will work

Aman Rawat
  • 2,625
  • 1
  • 25
  • 40