That warning definitely is due to you sending output to browser before setting the cookie.
You can set the cookie after db connection, but be SURE that all of that comes before any output.
SO you want:
<?php
// do the database stuff
setcookie("thecookie", "whatever", $expire);
// of course set it to what you want
?>
<BODY>
etc. . .
REMEMBER the cookie is set before the tag is set, before headers sent, etc.
Warning: Oops, php3_SetCookie called after header has been sent in /home/avenuesw/avenuesworldwide-www/abc/tabish/editpages.php3 on line 45