Jump to content

[SOLVED] mozilla can but IE cant , why?


zgkhoo

Recommended Posts

<?php
include 'config.php';
include 'opendb.php';

  function LoginF($username,$password){
  	//echo $username.$password;
  	$result=mysql_query("SELECT * from person");
  	
  	while($row = mysql_fetch_array($result,MYSQL_ASSOC)){

  		
  		if(($username==$row['Username'])&&($password==$row['Password'])){
  			//echo "username success";
  			if($row['Level']=='Boss'){
  			header('Location: bossmenu.php');
  			}
  			
  			if($row['Level']=='Agent'){
  			header('Location: agentmenu.php');
  			}  	
  			
  			if($row['Level']=='Customer'){
  			header('Location: customermenu.php');
  			}		
  			
  			if($row['Level']=='Typist'){
  			header('Location: typistmenu.php');
  			}	 		
  		}
  		else {
  		//	echo "invalid login";
  		}

  		
  	}// end of while loop
  	
  	
  	
  }//end of function LoginF
  



if(isset($_POST['createDB'])){ 
include 'createdb.php';
echo "testing";
}



if(isset($_POST['cPerson'])){ 

echo "cperson";



$sql = "CREATE TABLE person
(
    UserID varchar(10),
	Username varchar(13), 
	Password varchar(13),
	Level varchar(13),
	IC integer(12)

)";
mysql_query($sql, $con) or die("Can't execute sql" . mysql_error());



$sql="INSERT INTO person (Username,Password,Level)VALUES ('testing1','testing1','Boss')"; mysql_query($sql, $con);
$sql="INSERT INTO person (Username,Password,Level)VALUES ('testing2','testing2','Agent')"; mysql_query($sql, $con);
$sql="INSERT INTO person (Username,Password,Level)VALUES ('testing3','testing3','Customer')"; mysql_query($sql, $con);
$sql="INSERT INTO person (Username,Password,Level)VALUES ('testing4','testing4','Typist')"; mysql_query($sql, $con);

}

  if(isset($_POST['cTrans'])){ 
  	



$sql = "CREATE TABLE transaction
(
	TransactionID varchar(6),
	PurchaseNo integer(4),
	UserID varchar(10),
	Category varchar(6),
	BetMode varchar(9),
	DrawDate Date,		
	DrawNumber varchar(25),
	DrawStatus varchar(6),
	Amount     integer(10)


)";
mysql_query($sql, $con) or die("Can't execute sql" . mysql_error());


}

   if(isset($_POST['cResult'])){ 


$sql = "CREATE TABLE Result
(
	DrawNumber Integer(4),
	DrawDate Date,	
	Category Varchar(10),
	Status Varchar(10),
	First Integer(4),
	Second Integer(4),
	Third Integer(4),
	S1 Integer(4),
	S2 Integer(4),
	S3 Integer(4),
	S4 Integer(4),
	S5 Integer(4),
	S6 Integer(4),
	S7 Integer(4),
	S8 Integer(4),
	S9 Integer(4),
	S10 Integer(4),
	c1 Integer(4),
	c2 Integer(4),
	c3 Integer(4),
	c4 Integer(4),
	c5 Integer(4),
	c6 Integer(4),
	c7 Integer(4),
	c8 Integer(4),
	c9 Integer(4),
	c10 Integer(4)


)";
mysql_query($sql, $con) or die("Can't execute sql" . mysql_error());

//$sql="INSERT INTO Result (Username)
// 	VALUES ('testing')";


//	mysql_query($sql, $con);

}

  if(isset($_POST['Login'])){
  	//echo "sign in";
  	
  	LoginF($_POST[username],$_POST[password]);

  	
  	
  }

  
?>


<html>
<body>
</br>
</br>
</br>

<center>
<h1>
Sports Toto

</h1>
<img src="toto.gif">
<form action="index.php" method="POST">
<h2>Username

<input type="text" name="username"/>
<br/>
Password
<input type="password" name="password"/>
</h2>
<input type="submit" name="Login" value="Log In"></br></br>
<button name="createDB" value="createDB"> create db </button>
<button name="cPerson">Create person table</button>
<button name="cTrans">Create transaction table</button>
<button name="cResult">Create result table</button>


</form>
</center>

</body>
</html>

<?php
include 'db.php'
?>


 

when i type the correct user name and password in IE then it occur error msg and cant login at all

testingcpersonCan't execute sqlTable 'person' already exists

but i use mozilla for test, no problem at all, succesful login.

Link to comment
Share on other sites

it will be something that mozilla supports that ie doesnt i have noticed things like this before ie needs the code to be spot on for it to work where as firefox can handle minor errors in certain codes e.g. forms, i noticed this when i was building a website in firefox but the person it was for used IE

 

chances are you will never get it to work perfectly in both browsers

Link to comment
Share on other sites

when you have run this script once it creates the database correct?

 

so this would then mean that ie cannot create the database as it is already there so it will just fail like it has done there, firefox may just be skipping the step.

 

i would sugest deleting the table and then trying it in IE unless you have already done that.

 

also it could maybe be caused by the fact you have 2 different $sql variables this may be causing a clash maybe change one to $sql1

Link to comment
Share on other sites

Holy crap!

 

this stuff is server side!

 

all the browsers does is pass the info over. I suggest that you print out the contents of the $_POST array in the script that is called and see what the differences are in name/value pairs.

 

one of the issues you will have is the <button> tag which is not universally supported (perhaps you might want to go away and create some decent html first!) I would wager that the infomation that these elements pass is very differnt in each browser hence the processing script does NOT recieve consisten data to process.

Link to comment
Share on other sites

when you have run this script once it creates the database correct?

 

so this would then mean that ie cannot create the database as it is already there so it will just fail like it has done there, firefox may just be skipping the step.

 

i would sugest deleting the table and then trying it in IE unless you have already done that.

 

also it could maybe be caused by the fact you have 2 different $sql variables this may be causing a clash maybe change one to $sql1

 

nope , i only set, create the db when the button is pressed, and also for those tables as well, i already delete the table for several times.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.