I have set up a slave server for my master and i want to know if i need to connect to both servers via php or is the load balanced just connecting to the master?
//slave
$c2 = mysql_connect("10.100.27.10","<user>","<pass>")or die(mysql_error());
//master
$c =mysql_connect("10.100.27.99","<user>","<pass>")or die(mysql_error());
mysql_select_db("piksearch", $c2);
mysql_select_db("piksearch");
You just need to do your INSERTs on a master. Otherwise, set up multi-master replication and then you can do whatever to either database.
Be cautious though that a particular session always uses the same DB server. Otherwise, you may have inconsistent data if replication breaks, or is backed up.