affordit Posted February 16, 2009 Share Posted February 16, 2009 Can someone tell me what I am missing here? I have confirmed the access to the DB but can not get the header part to work. <?php // this starts the session session_start(); $client_name=$_POST['client_name']; $psword=$_POST['psword']; echo $client_name; echo $psword; include("teao_1_dbinfo2.inc"); $dbh=mysql_connect ("localhost","$name", "$password") or die('Cannot connect to the database because:'.mysql_error()); mysql_select_db ("$database"); $query = "Select * from projects Where client_name = '$client_name' and psword = '$psword'"; $results = mysql_query($query) or die(mysql_error()."<br /><br />".$query); $num=mysql_numrows($results); if ($num >0) { $result = mysql_fetch_array($results); $_SESSION['client_name'] = $client_name; $_SESSION['psword'] = $psword; $_SESSION['project_id'] = $result['project_id']; $_SESSION['start_date'] = $result['start_date']; $_SESSION['project_duration'] = $result['project_duration']; $_SESSION['finish_date'] = $result['finish_date']; $_SESSION['temp_url'] = $result['temp_url']; (header("location: http://mysite.com/1_projects/". $_SESSION['project_id'] . ".php")); } else { echo "<table align='center' width='300'><tr><td align='center'><b>The Username and Password you entered do not match any of our records. Thank You</b></td></tr></table>"; } ?> Link to comment https://forums.phpfreaks.com/topic/145364-solved-help-pleasecannot-get-header-to-work/ Share on other sites More sharing options...
genericnumber1 Posted February 16, 2009 Share Posted February 16, 2009 It's giving you an error because you're echoing $client_name and $psword. Remove those two echos and it should work out fine if everything else is in order. You can't send text to the browser before using functions that send special headers. Link to comment https://forums.phpfreaks.com/topic/145364-solved-help-pleasecannot-get-header-to-work/#findComment-763102 Share on other sites More sharing options...
affordit Posted February 16, 2009 Author Share Posted February 16, 2009 Thank You I put those in to check why it was not working for another reason, DUH Thanks again Link to comment https://forums.phpfreaks.com/topic/145364-solved-help-pleasecannot-get-header-to-work/#findComment-763103 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.