Vivid Lust Posted December 23, 2007 Share Posted December 23, 2007 Heres my code. It says theres an error on line 11 (the header bit). ??? Please help <?php #connect to MySQL $conn = mysql_connect( "===", "===", "===" ) or die( "Could not connect" ); #select the specified database $rs = mysql_select_db( "votick_banner", $conn ) or die( "Could not select database" ); $query = mysql_query( "SELECT id, url FROM banner WHERE id = '{$_GET['id']}'" ) or die(mysql_error()); $row = mysql_fetch_assoc($query); header('Location:' $row['url']); ?> Thanks lots in advanced. Quote Link to comment https://forums.phpfreaks.com/topic/82914-solved-php-get-code-with-header-not-working/ Share on other sites More sharing options...
papaface Posted December 23, 2007 Share Posted December 23, 2007 Change it to: $query = mysql_query( "SELECT id, url FROM banner WHERE id = '".$_GET['id']."'" ) P.S You should mysql_real_escape_string that. Quote Link to comment https://forums.phpfreaks.com/topic/82914-solved-php-get-code-with-header-not-working/#findComment-421658 Share on other sites More sharing options...
Vivid Lust Posted December 23, 2007 Author Share Posted December 23, 2007 The error is on line 11 which is the header bit :-\ Quote Link to comment https://forums.phpfreaks.com/topic/82914-solved-php-get-code-with-header-not-working/#findComment-421661 Share on other sites More sharing options...
papaface Posted December 23, 2007 Share Posted December 23, 2007 Whats the exact error. Quote Link to comment https://forums.phpfreaks.com/topic/82914-solved-php-get-code-with-header-not-working/#findComment-421675 Share on other sites More sharing options...
kenrbnsn Posted December 23, 2007 Share Posted December 23, 2007 You forgot the concatenation operator " . ", change it to <?php header('Location:' . $row['url']); ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/82914-solved-php-get-code-with-header-not-working/#findComment-421676 Share on other sites More sharing options...
Vivid Lust Posted December 23, 2007 Author Share Posted December 23, 2007 Thanks, its not that i forgot it, its i didnt know it existed Quote Link to comment https://forums.phpfreaks.com/topic/82914-solved-php-get-code-with-header-not-working/#findComment-421686 Share on other sites More sharing options...
kenrbnsn Posted December 23, 2007 Share Posted December 23, 2007 Why are you putting in the strings? Remove them. Ken Quote Link to comment https://forums.phpfreaks.com/topic/82914-solved-php-get-code-with-header-not-working/#findComment-421687 Share on other sites More sharing options...
PHP_PhREEEk Posted December 23, 2007 Share Posted December 23, 2007 You need double quotes around location... <?php header("location: http://someurl.com"); PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/82914-solved-php-get-code-with-header-not-working/#findComment-421690 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.