Skip to content

Instantly share code, notes, and snippets.

@masom
Created October 4, 2011 17:44
Show Gist options
  • Save masom/1262281 to your computer and use it in GitHub Desktop.
Save masom/1262281 to your computer and use it in GitHub Desktop.
Best Peer Review
<?php
public function pin(Array $params=array())
{
$pin="";
$options = array();
$ip = $_SERVER['REMOTE_ADDR'];
$q = "SELECT grv.ip_address,grs.printing_pin FROM guest_room_view grv INNER JOIN guest_room_settings grs on grv.room_id=grs.guest_room_id";
$dbo = Dbo::getInstance();
$result = $dbo->query($this->connectionName,$q,$options);
$arr = pg_fetch_all($result);
foreach ($arr as $a){
if ($a['ip_address']==$ip){
$pin=$a['printing_pin'];
}
}
echo $pin;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment