true // )); // END: Local connection /////////////////////////// // BEGIN: Remote connection // 1. Create an SSH tunnel in Git Bash: // ssh -N -L 55432:127.0.0.1:5432 t_weservice@194.149.135.130 // password: 71b1f4ea // 2. Connect: $conn = new PDO('pgsql:host=localhost;port=55432;dbname=db_202122z_va_prj_weservice', 'db_202122z_va_prj_weservice_owner', '821bf9400a4e', array( PDO::ATTR_PERSISTENT => true )); // 3. Set the SQL queries to first search in the schema "weservice", then "public". $stm = $conn->prepare('SET search_path TO weservice,public;'); $stm->execute(); // END: Remote connection } catch (Exception $e) { die("Unable to connect: " . $e->getMessage()); } /** * For a given float number, output the stars (5 SVG elements). * * @param float|null $rating * @return string */ function outputStars($rating, $size = 24) { $rating = $rating ?? 0; $retVal = '
'; for ($j = 1; $j <= 5; $j++) { /** * Determine the star color (yellow or gray). */ if (round($rating) >= $j) { $color = '#ffd700'; } else { $color = '#666'; } // Output the icon. $retVal .= ''; } return $retVal . '
'; }