I have this code:
if ( $_POST['search_games'] ) {
foreach ( $_POST as $key => $val ) {
if ( eregi ( "opponent", $key ) ) {
$opponent = explode ( "_", $val );
$sql = "INSERT INTO game_search(search_year, search_opponent, search_date, search_ip, search_month, search_sortby) VALUES('" . $_POST['year'] . "','" . $opponent[0] . "',NOW(),'" . $_SERVER['REMOTE_ADDR'] . "','" . $_POST['month'] . "','" . $_POST['order'] . "')";
$add_rating_rs = $conn->Execute($sql) or die ( $conn->ErrorMsg() );
}
}
header ( "Location: ?page=search&view=games&year=" . $_POST['year'] . "&sport=" . $_POST['sport'] . "&month=" . $_POST['month'] . "&opponent=" . $opponent[0] . "&team_id=" . $opponent[1] . "&order=" . $_POST['order'] . "" );
exit;
}
On my site. I just moved servers, the new server has the latest version of MySQL installed, while the last one didn't.
The search query works on the old server, but not on the new server. I get the error:
Warning: Cannot modify header information - headers already sent by (output started at /home/admin/domains/xxx.com/public_html/new_site/index.php:13) in /home/admin/domains/xxx.com/public_html/new_site/page_search.php on line 337
Essentially I have every page off of index.php. So I have this code:
<? $page = (!isset($_GET['page'])) ? 'main' : strtolower($_GET['page']);
switch($page) {
case 'main': include 'page_index.php'; break;
case 'fb'; include 'page_index.php'; break;
case 'news'; include 'page_news.php'; break;
case 'player': include 'page_player.php'; break;
case 'search'; include 'page_search.php'; break;
case 'greatest'; include 'page_greatest.php'; break;
case 'about'; include 'page_extras.php'; break;
case 'links'; include 'page_extras.php'; break;
case 'downloads': include 'page_extras.php'; break;
case 'fun'; include 'page_extras.php'; break;
case 'games'; include 'page_games.php'; break;
case 'history'; include 'page_history.php'; break;
case 'games'; include 'page_games.php'; break;
case 'contact'; include 'page_extras.php'; break;
case 'staff'; include 'page_staff.php'; break;
case 'stats'; include 'page_stats.php'; break;
default: include 'page_index.php';
} ?>
That's my index page. The first bit of code is page_search.php.
I'm just at a loss as to why it does it on the old server, but not the new.