3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getGoals(){ $link = mysql_connect('localhost','root','root'); mysql_select_db("goal_database",$link); if (isset($_GET["pid"]) && isset($_GET["week"])) { $pid = intval($_GET["pid"]); $week = intval($_GET["week"]); $response = array(); $response["goals"] = array(); // Mysql select query to retrieve nutrition goal $nutrition_result = mysql_query("SELECT Description FROM Goals WHERE ParticipantID=$pid AND WeekNumber=$week AND Type='NUTRITION';"); $row = mysql_fetch_array($nutrition_result); $nutrition_goal = $row[0]; $tmp = array(); $tmp["nutrition"] = $nutrition_goal; array_push($response["goals"], $tmp); // Mysql query to retrieve exervise goal $exercise_result = mysql_query("SELECT Description FROM Goals WHERE ParticipantID=$pid AND WeekNumber=$week AND Type='EXERCISE';"); $row = mysql_fetch_array($exercise_result); $exercise_goal = $row[0]; $tmp["exercise"] = $exercise_goal; array_push($response["goals"], $tmp); // keeping response header to json header('Content-Type: application/json'); // echnoing json result echo json_encode($response); if (mysql_errno()) { $error = "MySQL error ".mysql_errno().": ".mysql_error()."\n<br>When executing:<br>\n$query\n<br>"; echo $error; } } } getGoals(); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /in/XGTMs:3 Stack trace: #0 /in/XGTMs(37): getGoals() #1 {main} thrown in /in/XGTMs on line 3
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
62.29 ms | 401 KiB | 8 Q