Jump to content

zxiny_chin

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

zxiny_chin's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. actually my code go like this... <?php include("check_session.php"); include_once("connectDB.php"); extract( $_POST ); $query = "SELECT * FROM employee WHERE E_NAME = '$user' and E_PASSWORD = '$pword'"; $result = mysql_query( $query ) or die( 'Could not execute SQL query!' ); $row = mysql_fetch_array( $result ); if ( $row ) { session_start(); global $_SESSION; $_SESSION[ 'AUTH_USER' ] = $user; $setnow = date( "Y-m-d H:i:s" ); $updateQuery = "UPDATE employee SET last_login = '$setnow' WHERE E_NAME = '$user'"; mysql_query( $updateQuery ); print ("Hi, $user <br> "); print("<html><head><meta http-equiv=\"REFRESH\" content=\"1; url=member_main.php\"</head> <body>Directing...</body></html>"); sleep(2); } else { print("<html><head><meta http-equiv=\"REFRESH\" content=\"1; url=login.html\"</head> <body> <p>Invalid User Name and Password!</p> <p>Please try again!!!</p> <p>Redirecting to Login Page...</p> </body> </html>"); sleep(3);} ?> [b] the main page[/b] <body> <?php session_start(); $username=$_SESSION[ 'AUTH_USER' ]; //include_once("secure_page.php"); /*if (isset($_SESSION)) echo("session oled started"); else session_start(); */ // Connect to MySQL include_once("connectDB.php"); //$username=$_REQUEST['$user']; echo ("Hi,". $username." <br>"); $dateInfo = date("d-m-Y"); print("$dateInfo"); print("<table width=\"100%\" border=\"0\" align=\"left\" cellpadding=\"1\" cellspacing=\"0\">\n"); print("<tr>&nbsp;</tr>\n"); print("<tr>\n"); print("<th scope=\"row\"><div align=\"left\"><b>Today Delivery Schedule : </b></div></th>"); print("</tr>\n"); print("<tr>\n"); print("<th scope=\"row\"><div align=\"left\">Under Construction</div></th>"); print("</tr></table>\n"); /*$result = mysql_query("select E_IC from EMPLOYEE where E_NAME='chai'", $database); for ( $counter = 0; $row = mysql_fetch_row($result); $counter++ ){ // build table to display results print( "<tr>" ); foreach ( $row as $key => $value ) print( "<td>$value</td>" ); print( "</tr>" ); } } */ ?> </body> </html>
  2. you mean put session start before <?php ?
  3. [b]login.php[/b] include("check_session.php"); include_once("connectDB.php"); global $aut_user; [b]mainpage.php[/b] session_start(); $username=$_SESSION[ 'AUTH_USER' ]; [b]a warning msg shown:[/b] Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Program Files\xampp\htdocs\FYP06\member_main.php:5) in C:\Program Files\xampp\htdocs\FYP06\member_main.php on line 15 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Program Files\xampp\htdocs\FYP06\member_main.php:5) in C:\Program Files\xampp\htdocs\FYP06\member_main.php on line 15 can somebody help me out...i m in an urgent stage...thx ya u can add mine yahoo messenger... ID : inger_wong thx
  4. yeah! thanks a lot.. it works :-D btw... how to know whether the superglobals is on? and how to turn it on??
  5. hi, im having problem with insert data to MySQL db thru the php form. everytime i try to insert thru the php form, what i get is all NULL value in my databse table... im using XAMPP window version 1.5.1(php 5.1.1 + Apache 2.2.0 + MySQL 5.0.18) , Window XP -SP2(i turn off the firewall)... the following is my code for insert part: $sqlquery = "INSERT INTO Customer (CUS_NAME, CUS_IC, CUS_COMPANY, CUS_COMPANY_ADDRESS, CUS_COMPANY_PHONE, CUS_HOME_ADDRESS, CUS_HOUSE_PHONE, CUS_HP,CUS_EMAIL) VALUES ('$name','$ic','$company','$caddress','$cphone','$haddress','$hphone','$hp','$email')"; $result = mysql_query($sqlquery); i had tried many way like: using $_POST, '".$VARIABLE."' and other way that i found online/book.. but i still cannot solve the problem. once i press submit, the data wont reach the database and become NULL. it return no error..and my table index is auto increament, so i know there is new data insert but all is NULL value beside the index. anyone knows the reason or having similar problem?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.