Sorry, i wasnt literal enough. The code i was giving was an example. 1. php.ini display_errors = On error_reporting = E_ALL $ ~E_NOTICE 2. more Code ** test.php ** <?PHP include ("./sqlfunctions.php"); // contains user function called sql, for mysql functions $selected_id='1'; $statment = "select * from debtors where Ourref=$selected_id"; $res = sql($statment); $row = mysql_fetch_array($res); . . ?> ** sqlfunctions.php ** <?PHP function sql($statment,$assoc=1) { $dbhost= "host"; $dbuser= "user"; $dbpass= "pass"; $dbname= "dbase"; echo $statment; // displays correct contents of $statment eg: "select * from .... " etc. if(!mysql_connect($dbhost,$dbuser,$dbpass)) { echo Stylesheet() . "\n\n<div class=Error>"; echo $Translation["error:"] . mysql_error(); echo "</div>"; exit; } echo $statment; // display empty (or null?) contents of $statment eg: "". . . . . ?> Summary ======= The first echo displays the correct contents. The second echo shows nothing. The sql statment mysql_connect runs and connects. The if(!mysql_connect(xxx)) { failure code } failure code isnt actioned, therefore no other functions or actions are taken before the second echo $statment; To me (limited expertise excepted), The $statment variable seems to be reset by the mysql_connect function call. I've even used other variable names eg:$statmentxc and get the same result. This is sending me bonkers!! There has to be a simple solution to this. Regards Ian.