MyBB Hacks

Full Version: Can I combine the values in the database with an comma (,) instead of next line?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Can I combine the values in the database with an comma (,) instead of next line?

Cause I am using the following code to check in PHP if one thread match with another thread:

PHP Code:
<?php

$id1 = '1,2,3,4,5,6,7,8,9,10'; // the values from thread_field_data where tid=1
$id2 = '10,11,12,13,14,15,16'; // the values from thread_field_data where tid=2

// splitting them up into an array
$one = explode(',', $id1);
$two = explode(',', $id2);

// making the check
$result = count(array_intersect($one, $two));
if($result > 0) {
    echo 'Something matched!';
}

?>


I don't know how to do that with newlines?

Use \n in double-quotes to represent a newline in PHP, eg

PHP Code:
$one = explode("\n", $id1);

Reference URL's