Hrm.... Looks like pg_escape_bytea is designed for PostgreSQL :)
Ohh.. hmm.. so which should I use? I tried to work this code out but failed. I patterned it over the example with a few minor changes :(
<?php
$data = file_get_contents($_FILES['form_data']['tmp_name']);
$escaped = pg_escape_bytea($data);
$result = pg_prepare($connection, "ins_pic",'INSERT INTO tbl_photo (id,data) VALUES ($1,$2)');
$result = pg_execute ($connection,"ins_pic",array('1','$escaped'));
?>
This is the page where I was trying to load the file from:
<form method="post" action="process.php" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
File to upload/store in database:<br>
<input type="file" name="form_data" size="40">
<input type="hidden" name="task" value ="uplImg"/>
<input type="hidden" name="task" value ="fileUpload"/>
<p><input type="submit" name="submit" value="submit">
</form>
Many thanks for your replies