mysql - PHP Explode Array Issue -


i start off saying new @ php. following code written acquaintance no longer able assist , trying further develop additional things it. running issue cannot wrap head around.

the explode array used break series of commands parts used within mysql statements manipulate database.

the issue having commands seem work , don't. see below:

if(isset ($_post['commandline'])){ //handle cammand $command = $_post['commandline']; $parts = explode(",",$command); //print_r($parts); //we know first part command  //update nature code event number  works //part 1 event id part 2 new call type else if(preg_match("/ute/",$parts[0])){     mysql_query("update runs set calltype='{$parts[2]}' id='{$parts[1]}'");}  //update location event number  works //part 1 event id part 2 new location else if(preg_match("/ule/",$parts[0])){     mysql_query("update runs set location='{$parts[2]}' id='{$parts[1]}'");}  //update description event number  not work //part 1 event id part 2 new description else if(preg_match("/ude/",$parts[0])){     mysql_query("update runs set discrip='{$parts[2]}' id='{$parts[1]}'");}    else { header("location: main.php?message=fail");  die;}  } 

as can see comments ute , ule command works ude command not work. have feeling has "ute" , "ude" part if change "ude" random letter "q" work.

anyone know going on , how "ude" part work? appreciated.

1) sql injection danger

2) /ude has no special meaning, '/ude/' behave same '/ule/' or '/abc/'.

3) if add echo above deffective query, shown?

else if(preg_match("/ude/",$parts[0])){ echo 'do see line here?'; mysql_query("update runs set discrip='{$parts[2]}' id='{$parts[1]}'");} 

4) happens if execute query manually?

the last 2 points ara general procedure tell php , mysql errors apart.

edit: if print_r($parts) , empty array, $party[0] cannot match regex. in case must track down, why explode() fails. shorten part after ?commandline= ?commandline=xxx,yyy ; change bare minimum needed reproduce error.

liekly reason:

does part after ?commandline= in url contain of characters "? & #" ? end parameter.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -