So I have...
var newfavz = 'Array (
[0] => [" 6 "," 1 "," 2 "," 5 "," 3 "," 4 "]
[1] => [" 6 "," 1 "," 2 "," 5 "," 3 "," 4 "]
[2] => [" 6 "," 1 "," 2 "," 5 "," 3 "," 4 "]
)
';
on my console.log, but somehow there is a syntax error: unterminated string literal. I've looked around and tried methods such as str_replace "/" with "//" or a regex like .replace(/^/+/g, ''); because it seems like JavaScript don't allow strings to be broken into multiple lines or something like that.
This all started with an SQL query like so...
$favurl = [];
$favquery = "SELECT * FROM userfavs WHERE users = '$username'";
$favresult = mysqli_query($conn, $favquery);
while($row = mysqli_fetch_assoc($favresult)) {
array_push($favurl, $row['fav_id']);
Afterwards, I did
var newfavz = <?php print_r ($favurl); ?>
which led to the above.
Is there any way I could use to solve the syntax error? Thanks!