Jump to content

Php Differences Between Ie And Ff?


norNerd

Recommended Posts

Hi guys, today i woke up with a script not working in IE and working in FF..Code of Query:

		mysql_query("INSERT INTO `$mysql_data`.`patient_temp_Table` (			`id`,			`username`,			`patient_name`,			`patient_dag`,			`patient_natt`,			`patient_kladd`			)VALUES(			'',			'$userName',			'$patient_name',			'$patient_dag',			'$patient_natt',			'$patient_kladd')") or die("Error: <br />" .mysql_error());

On patient dag/natt i'm inserting images as in images code <img src="" height="" width="" alt="" />.This works in FireFox, and not IE...What a wird world we live in lol :)

Link to comment
Share on other sites

That query has nothing to do with (1) the browser you're printing to, or (2) the browser that sent you the data. I believe you when you say there's a difference, but we won't discover it in that piece of code.You should probably post enough code so we can see the complete chain of data, including form input, any javascript handling before it gets posted, and the way the data gets processed before you try to insert it into your table. (If it's not outrageously long, post all your code.)It would also help if you were more specific about "not working." Does nothing happen? Do you get a blank screen? Do any warnings or errors get printed? Does weird or empty data get written to your database?A simple suggestion: have you cleared the cache on the browser that doesn't work?

Link to comment
Share on other sites

Guys now its working.Since you asked for code i'll post, so you might be able to say what my error was.

<?phpinclude "matrixConnect.php";include "matrixTime.php";include "matrixI.php";include "matrixIU.php";$userName = $_COOKIE['user'];if(isset($_POST['save_patient_row'])){		$patient_dag	= stripslashes($_POST['contentmargin1']);	$patient_natt	= stripslashes($_POST['contentmargin2']);	$patient_name	= matrixStrip($_POST['contentmargin0']);	$patient_kladd	= matrixStrip($_POST['contentmargin3']);		trim($patient_name);	trim($patient_kladd);		function matrixTextOnly($var){		if(!preg_match("/^[a-z]$/", $var)){			echo "<script>alert('Kladd og Kommentar skal bare inneholde tekst.');</script>";			echo "<script>history.back();</script>";		}	}	//	matrixTextOnly($patient_name);//	matrixTextOnly($patient_kladd);//	$patient_name	= matrixStripImg($patient_name);//	$patient_kladd	= matrixStripImg($patient_kladd);		if($patient_name == "" || $patient_dag == "" || $patient_natt == "" || $patient_kladd == ""){		echo"<script>alert('Navn, Dag, Natt og Kladd/Kommentar skal fylles ut.');</script>";		echo"<script>history.back();</script>";	} else {		mysql_query("INSERT INTO `$mysql_data`.`patient_temp_Table` (			`id`,			`username`,			`patient_name`,			`patient_dag`,			`patient_natt`,			`patient_kladd`			)VALUES(			'',			'$userName',			'$patient_name',			'$patient_dag',			'$patient_natt',			'$patient_kladd')") or die("Error: <br />" .mysql_error());				echo"<script>alert('Pasient lagt til.');</script>";		echo"<script>java script:location.href='index.php';</script>";	}	}?>

Some functions is in code, but not in use.Tried to add some security, but since its a drag/drop script included to, and WYSIWYG editor, i had to remove those functions.Since it's working now, im not able to post my error.

Link to comment
Share on other sites

It doesn't look like you're escaping quotes in the values going into the database. If you enter some text in the form that includes a single quote or apostrophe the query will fail unless you escape everything using something like mysql_real_escape_string.Code doesn't just stop or start working, the computer always executes the code exactly the same way. For a certain set of inputs, you should always see the exact same outputs. If you're seeing a problem you just found a scenario that triggers a bug, but it doesn't mean you'll always see the bug unless the conditions are right.

Link to comment
Share on other sites

Ohh, totally forgot that.. Had mysql_real_escape_string in matrixI(); but together with htmlspecialchars wich ruind the image posting, so removed it again.Will it remove anything from etc <img src="" height="" width="" alt="" />? Or will it be output'ed as it was/or functionally?Kris

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...