Scropion Posted December 30, 2008 Share Posted December 30, 2008 I have been trying to do a profile searching and trying to redirect the user to the profile they want to search. The redirect function isn't allowing me to use any mysql_query. Can someone help me? Here is the code if ($num_rows == 1) { $extra = 'mypage.php?id=$r_info[id]'; $is=$r_info[id]; $to = 'profile.php?id=$is'; header('Location: '. $to); exit; } ?> (edited to remove the small font tags) Link to comment https://forums.phpfreaks.com/topic/138893-solved-php-redirect/ Share on other sites More sharing options...
Scropion Posted December 30, 2008 Author Share Posted December 30, 2008 I solved it. changed $to = 'profile.php?id=$is' to: $to = "profile.php?id=".$is; Link to comment https://forums.phpfreaks.com/topic/138893-solved-php-redirect/#findComment-726294 Share on other sites More sharing options...
kenrbnsn Posted December 30, 2008 Share Posted December 30, 2008 Use double quotes or concatenation instead of single quotes. Variables enclosed in single quotes are not evaluated: <?php if ($num_rows == 1) { $extra = 'mypage.php?id=' . $r_info['id']; $is=$r_info['id']; $to = 'profile.php?id=' . $is; header('Location: '. $to); exit(); } ?> Ken Link to comment https://forums.phpfreaks.com/topic/138893-solved-php-redirect/#findComment-726295 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.