PHP Mad Libs with OOP and SQLHow to properly use OOP in PHP with formsProperly storing error messages and displaying them with OOPHow is OOP achieved with configuration files in PHP?Adventure game player using public fields instead of getters and settersCity and District class examples for teaching OOP in PHPGetting and posting data use PHP OOP and MySQLiFirst Memory Game with PyQt and OOPPHP OOP registration with User class and singleton Database classusing $_POST array to prepare PDO statement with variablesPhp how to properly connect functions with pagination
Copenhagen passport control - US citizen
If Manufacturer spice model and Datasheet give different values which should I use?
Do airline pilots ever risk not hearing communication directed to them specifically, from traffic controllers?
Japan - Plan around max visa duration
Why has Russell's definition of numbers using equivalence classes been finally abandoned? ( If it has actually been abandoned).
A function which translates a sentence to title-case
Set-theoretical foundations of Mathematics with only bounded quantifiers
Can a German sentence have two subjects?
Is it possible to do 50 km distance without any previous training?
Download, install and reboot computer at night if needed
How to report a triplet of septets in NMR tabulation?
Chess with symmetric move-square
What is the command to reset a PC without deleting any files
What do you call a Matrix-like slowdown and camera movement effect?
Motorized valve interfering with button?
When blogging recipes, how can I support both readers who want the narrative/journey and ones who want the printer-friendly recipe?
How to make payment on the internet without leaving a money trail?
What are these boxed doors outside store fronts in New York?
Is Social Media Science Fiction?
Why is "Reports" in sentence down without "The"
TGV timetables / schedules?
I see my dog run
Patience, young "Padovan"
Why are only specific transaction types accepted into the mempool?
PHP Mad Libs with OOP and SQL
How to properly use OOP in PHP with formsProperly storing error messages and displaying them with OOPHow is OOP achieved with configuration files in PHP?Adventure game player using public fields instead of getters and settersCity and District class examples for teaching OOP in PHPGetting and posting data use PHP OOP and MySQLiFirst Memory Game with PyQt and OOPPHP OOP registration with User class and singleton Database classusing $_POST array to prepare PDO statement with variablesPhp how to properly connect functions with pagination
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
I've been learning PHP and I've just gotten into using OOP. Classes/objects/methods etc. My end goal is to take an old Mad libs program I did with PHP, and convert it to OOP. The gist of the project was allowing the user to enter a verb, adverb, adjective, and noun and storing it in the DB, then displaying it on the page as a Mad lib (along with the rest of the DB).
I was hoping someone could review my source and let me know how to properly use the setters and getters, right now I think my code is just using POST to pass the user entered data to the method?? But if I take it out, it doesn't work anymore.
Basically I'm pretty lost right now and would appreciate any and all advice on how I can improve/fix this code. Right now it does work (including insertion and query of DB), but i'm not sure if I did It properly.
General guidelines Im following to covert to OOP (Inside Madlibs Class):
Create instance vars for holding a noun, verb, adjective, adverb, and story
Create getters and setters for all instance vars
Create method for inserting the new instance vars into DB
Create method for querying the stories that returns a results set newest to oldest
Create a method that takes the results set (from the query) as an argument, and returns the results onto page
Madlibs Class Code:
<?php
class MadLibs
private $noun; // String
private $verb; // String
private $adjective; // String
private $adverb; // String
private $story; // String - entire madlib story
// Getters
public function getNoun()
return $this->noun;
public function getVerb()
return $this->verb;
public function getAdjective()
return $this->adjective;
public function getAdverb()
return $this->adverb;
public function getStory()
return $this->story;
// Setters
public function setNoun($noun)
$this->noun = $noun;
public function setVerb($verb)
$this->verb = $verb;
public function setAdjective($adjective)
$this->adjective = $adjective;
public function setAdverb($adverb)
$this->adverb = $adverb;
public function setStory($story)
$this->story = $story;
// method for inserting the new properties into mad libs database table
public function insertMadLibs($noun, $verb, $adjective, $adverb, $story)
$story = "Have you seen the $adjective $noun? They got up and started to $verb $adverb!";
$dbc = mysqli_connect('localhost', 'root', '', 'project1')
or die('Error connecting to DB');
$query = "INSERT INTO Madlibs (id, noun, verb, adjective, adverb, story, dateAdded)" .
"VALUES (0, '$noun', '$verb', '$adjective', '$adverb', '$story', NOW())";
$result = mysqli_query($dbc, $query)
or die('Error querying DB');
mysqli_close($dbc);
echo '<span id="success">Success!</span>';
// method for querying the stories that return results set newest to oldest
public function fetchStory()
$dbc = mysqli_connect('localhost', 'root', '', 'project1')
or die('Error connecting to DB.');
$query = "SELECT * FROM Madlibs ORDER BY dateAdded DESC";
$result = mysqli_query($dbc, $query)
or die('Error querying DB.');
mysqli_close($dbc);
return $result;
// method that takes the results set (from the query) as an argument, and returns the results in a formatted HTML table
public function displayStory($result)
$dbc = mysqli_connect('localhost', 'root', '', 'project1')
or die('Error connecting to DB.');
while ($row = mysqli_fetch_array($result))
echo '<div id="comments"><p>Have you seen the <b>' . $row['adjective'] . ' ' . $row['noun'] . '</b>? <br />';
echo 'They got up and started to <b>' . $row['verb'] . ' ' . $row['adverb'] . '</b>! </p>';
echo '<span id="footer">Date: ' . $row['dateAdded'] . '</span></div>';
mysqli_close($dbc);
?>
index file where calls are made:
<!DOCTYPE html>
<html>
<head>
<title>Mad libs</title>
<link rel="stylesheet" href="styles.css" type="text/css" />
</head>
<body>
<?php
require_once('MadLibs.php');
$mad_libs = new MadLibs();
$mad_libs->setNoun($_POST['noun']);
$mad_libs->setVerb($_POST['verb']);
$mad_libs->setAdjective($_POST['adjective']);
$mad_libs->setAdverb($_POST['adverb']);
// How do I remove these and still have the program function??
// Get entered info form form
$noun = $_POST['noun'];
$verb = $_POST['verb'];
$adjective = $_POST['adjective'];
$adverb = $_POST['adverb'];
if (isset($_POST['submit']))
if ( (!empty($noun)) && (!empty($verb)) && (!empty($adjective)) && (!empty($adverb)) )
$mad_libs->insertMadLibs($noun, $verb, $adjective, $adverb, $story);
else
echo '<span id="error">Please fill out all fields!</span>';
?>
<div id="wrapper">
<h1>Mad Libs</h1>
<hr>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<label for="noun">Enter a <b>Noun</b>: </label>
<input type="text" name="noun" id="noun" class="input" value="<?php echo $noun; ?>"/>
<br />
<label for="verb">Enter a <b>Verb</b> (Present Tense): </label>
<input type="text" name="verb" id="verb" class="input" value="<?php echo $verb; ?>"/>
<br />
<label for="adjective">Enter an <b>Adjective</b>: </label>
<input type="text" name="adjective" id="adjective" class="input" value="<?php echo $adjective; ?>"/>
<br />
<label for="adverb">Enter an <b>Adverb</b>: </label>
<input type="text" name="adverb" id="adverb" class="input" value="<?php echo $adverb; ?>"/>
<br />
<input name="submit" id="submit" type="submit" value="Submit"/>
</form>
</div>
<?php
$result = $mad_libs->fetchStory();
$mad_libs->displayStory($result);
?>
</body>
</html>
beginner php object-oriented mysql
New contributor
$endgroup$
add a comment |
$begingroup$
I've been learning PHP and I've just gotten into using OOP. Classes/objects/methods etc. My end goal is to take an old Mad libs program I did with PHP, and convert it to OOP. The gist of the project was allowing the user to enter a verb, adverb, adjective, and noun and storing it in the DB, then displaying it on the page as a Mad lib (along with the rest of the DB).
I was hoping someone could review my source and let me know how to properly use the setters and getters, right now I think my code is just using POST to pass the user entered data to the method?? But if I take it out, it doesn't work anymore.
Basically I'm pretty lost right now and would appreciate any and all advice on how I can improve/fix this code. Right now it does work (including insertion and query of DB), but i'm not sure if I did It properly.
General guidelines Im following to covert to OOP (Inside Madlibs Class):
Create instance vars for holding a noun, verb, adjective, adverb, and story
Create getters and setters for all instance vars
Create method for inserting the new instance vars into DB
Create method for querying the stories that returns a results set newest to oldest
Create a method that takes the results set (from the query) as an argument, and returns the results onto page
Madlibs Class Code:
<?php
class MadLibs
private $noun; // String
private $verb; // String
private $adjective; // String
private $adverb; // String
private $story; // String - entire madlib story
// Getters
public function getNoun()
return $this->noun;
public function getVerb()
return $this->verb;
public function getAdjective()
return $this->adjective;
public function getAdverb()
return $this->adverb;
public function getStory()
return $this->story;
// Setters
public function setNoun($noun)
$this->noun = $noun;
public function setVerb($verb)
$this->verb = $verb;
public function setAdjective($adjective)
$this->adjective = $adjective;
public function setAdverb($adverb)
$this->adverb = $adverb;
public function setStory($story)
$this->story = $story;
// method for inserting the new properties into mad libs database table
public function insertMadLibs($noun, $verb, $adjective, $adverb, $story)
$story = "Have you seen the $adjective $noun? They got up and started to $verb $adverb!";
$dbc = mysqli_connect('localhost', 'root', '', 'project1')
or die('Error connecting to DB');
$query = "INSERT INTO Madlibs (id, noun, verb, adjective, adverb, story, dateAdded)" .
"VALUES (0, '$noun', '$verb', '$adjective', '$adverb', '$story', NOW())";
$result = mysqli_query($dbc, $query)
or die('Error querying DB');
mysqli_close($dbc);
echo '<span id="success">Success!</span>';
// method for querying the stories that return results set newest to oldest
public function fetchStory()
$dbc = mysqli_connect('localhost', 'root', '', 'project1')
or die('Error connecting to DB.');
$query = "SELECT * FROM Madlibs ORDER BY dateAdded DESC";
$result = mysqli_query($dbc, $query)
or die('Error querying DB.');
mysqli_close($dbc);
return $result;
// method that takes the results set (from the query) as an argument, and returns the results in a formatted HTML table
public function displayStory($result)
$dbc = mysqli_connect('localhost', 'root', '', 'project1')
or die('Error connecting to DB.');
while ($row = mysqli_fetch_array($result))
echo '<div id="comments"><p>Have you seen the <b>' . $row['adjective'] . ' ' . $row['noun'] . '</b>? <br />';
echo 'They got up and started to <b>' . $row['verb'] . ' ' . $row['adverb'] . '</b>! </p>';
echo '<span id="footer">Date: ' . $row['dateAdded'] . '</span></div>';
mysqli_close($dbc);
?>
index file where calls are made:
<!DOCTYPE html>
<html>
<head>
<title>Mad libs</title>
<link rel="stylesheet" href="styles.css" type="text/css" />
</head>
<body>
<?php
require_once('MadLibs.php');
$mad_libs = new MadLibs();
$mad_libs->setNoun($_POST['noun']);
$mad_libs->setVerb($_POST['verb']);
$mad_libs->setAdjective($_POST['adjective']);
$mad_libs->setAdverb($_POST['adverb']);
// How do I remove these and still have the program function??
// Get entered info form form
$noun = $_POST['noun'];
$verb = $_POST['verb'];
$adjective = $_POST['adjective'];
$adverb = $_POST['adverb'];
if (isset($_POST['submit']))
if ( (!empty($noun)) && (!empty($verb)) && (!empty($adjective)) && (!empty($adverb)) )
$mad_libs->insertMadLibs($noun, $verb, $adjective, $adverb, $story);
else
echo '<span id="error">Please fill out all fields!</span>';
?>
<div id="wrapper">
<h1>Mad Libs</h1>
<hr>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<label for="noun">Enter a <b>Noun</b>: </label>
<input type="text" name="noun" id="noun" class="input" value="<?php echo $noun; ?>"/>
<br />
<label for="verb">Enter a <b>Verb</b> (Present Tense): </label>
<input type="text" name="verb" id="verb" class="input" value="<?php echo $verb; ?>"/>
<br />
<label for="adjective">Enter an <b>Adjective</b>: </label>
<input type="text" name="adjective" id="adjective" class="input" value="<?php echo $adjective; ?>"/>
<br />
<label for="adverb">Enter an <b>Adverb</b>: </label>
<input type="text" name="adverb" id="adverb" class="input" value="<?php echo $adverb; ?>"/>
<br />
<input name="submit" id="submit" type="submit" value="Submit"/>
</form>
</div>
<?php
$result = $mad_libs->fetchStory();
$mad_libs->displayStory($result);
?>
</body>
</html>
beginner php object-oriented mysql
New contributor
$endgroup$
add a comment |
$begingroup$
I've been learning PHP and I've just gotten into using OOP. Classes/objects/methods etc. My end goal is to take an old Mad libs program I did with PHP, and convert it to OOP. The gist of the project was allowing the user to enter a verb, adverb, adjective, and noun and storing it in the DB, then displaying it on the page as a Mad lib (along with the rest of the DB).
I was hoping someone could review my source and let me know how to properly use the setters and getters, right now I think my code is just using POST to pass the user entered data to the method?? But if I take it out, it doesn't work anymore.
Basically I'm pretty lost right now and would appreciate any and all advice on how I can improve/fix this code. Right now it does work (including insertion and query of DB), but i'm not sure if I did It properly.
General guidelines Im following to covert to OOP (Inside Madlibs Class):
Create instance vars for holding a noun, verb, adjective, adverb, and story
Create getters and setters for all instance vars
Create method for inserting the new instance vars into DB
Create method for querying the stories that returns a results set newest to oldest
Create a method that takes the results set (from the query) as an argument, and returns the results onto page
Madlibs Class Code:
<?php
class MadLibs
private $noun; // String
private $verb; // String
private $adjective; // String
private $adverb; // String
private $story; // String - entire madlib story
// Getters
public function getNoun()
return $this->noun;
public function getVerb()
return $this->verb;
public function getAdjective()
return $this->adjective;
public function getAdverb()
return $this->adverb;
public function getStory()
return $this->story;
// Setters
public function setNoun($noun)
$this->noun = $noun;
public function setVerb($verb)
$this->verb = $verb;
public function setAdjective($adjective)
$this->adjective = $adjective;
public function setAdverb($adverb)
$this->adverb = $adverb;
public function setStory($story)
$this->story = $story;
// method for inserting the new properties into mad libs database table
public function insertMadLibs($noun, $verb, $adjective, $adverb, $story)
$story = "Have you seen the $adjective $noun? They got up and started to $verb $adverb!";
$dbc = mysqli_connect('localhost', 'root', '', 'project1')
or die('Error connecting to DB');
$query = "INSERT INTO Madlibs (id, noun, verb, adjective, adverb, story, dateAdded)" .
"VALUES (0, '$noun', '$verb', '$adjective', '$adverb', '$story', NOW())";
$result = mysqli_query($dbc, $query)
or die('Error querying DB');
mysqli_close($dbc);
echo '<span id="success">Success!</span>';
// method for querying the stories that return results set newest to oldest
public function fetchStory()
$dbc = mysqli_connect('localhost', 'root', '', 'project1')
or die('Error connecting to DB.');
$query = "SELECT * FROM Madlibs ORDER BY dateAdded DESC";
$result = mysqli_query($dbc, $query)
or die('Error querying DB.');
mysqli_close($dbc);
return $result;
// method that takes the results set (from the query) as an argument, and returns the results in a formatted HTML table
public function displayStory($result)
$dbc = mysqli_connect('localhost', 'root', '', 'project1')
or die('Error connecting to DB.');
while ($row = mysqli_fetch_array($result))
echo '<div id="comments"><p>Have you seen the <b>' . $row['adjective'] . ' ' . $row['noun'] . '</b>? <br />';
echo 'They got up and started to <b>' . $row['verb'] . ' ' . $row['adverb'] . '</b>! </p>';
echo '<span id="footer">Date: ' . $row['dateAdded'] . '</span></div>';
mysqli_close($dbc);
?>
index file where calls are made:
<!DOCTYPE html>
<html>
<head>
<title>Mad libs</title>
<link rel="stylesheet" href="styles.css" type="text/css" />
</head>
<body>
<?php
require_once('MadLibs.php');
$mad_libs = new MadLibs();
$mad_libs->setNoun($_POST['noun']);
$mad_libs->setVerb($_POST['verb']);
$mad_libs->setAdjective($_POST['adjective']);
$mad_libs->setAdverb($_POST['adverb']);
// How do I remove these and still have the program function??
// Get entered info form form
$noun = $_POST['noun'];
$verb = $_POST['verb'];
$adjective = $_POST['adjective'];
$adverb = $_POST['adverb'];
if (isset($_POST['submit']))
if ( (!empty($noun)) && (!empty($verb)) && (!empty($adjective)) && (!empty($adverb)) )
$mad_libs->insertMadLibs($noun, $verb, $adjective, $adverb, $story);
else
echo '<span id="error">Please fill out all fields!</span>';
?>
<div id="wrapper">
<h1>Mad Libs</h1>
<hr>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<label for="noun">Enter a <b>Noun</b>: </label>
<input type="text" name="noun" id="noun" class="input" value="<?php echo $noun; ?>"/>
<br />
<label for="verb">Enter a <b>Verb</b> (Present Tense): </label>
<input type="text" name="verb" id="verb" class="input" value="<?php echo $verb; ?>"/>
<br />
<label for="adjective">Enter an <b>Adjective</b>: </label>
<input type="text" name="adjective" id="adjective" class="input" value="<?php echo $adjective; ?>"/>
<br />
<label for="adverb">Enter an <b>Adverb</b>: </label>
<input type="text" name="adverb" id="adverb" class="input" value="<?php echo $adverb; ?>"/>
<br />
<input name="submit" id="submit" type="submit" value="Submit"/>
</form>
</div>
<?php
$result = $mad_libs->fetchStory();
$mad_libs->displayStory($result);
?>
</body>
</html>
beginner php object-oriented mysql
New contributor
$endgroup$
I've been learning PHP and I've just gotten into using OOP. Classes/objects/methods etc. My end goal is to take an old Mad libs program I did with PHP, and convert it to OOP. The gist of the project was allowing the user to enter a verb, adverb, adjective, and noun and storing it in the DB, then displaying it on the page as a Mad lib (along with the rest of the DB).
I was hoping someone could review my source and let me know how to properly use the setters and getters, right now I think my code is just using POST to pass the user entered data to the method?? But if I take it out, it doesn't work anymore.
Basically I'm pretty lost right now and would appreciate any and all advice on how I can improve/fix this code. Right now it does work (including insertion and query of DB), but i'm not sure if I did It properly.
General guidelines Im following to covert to OOP (Inside Madlibs Class):
Create instance vars for holding a noun, verb, adjective, adverb, and story
Create getters and setters for all instance vars
Create method for inserting the new instance vars into DB
Create method for querying the stories that returns a results set newest to oldest
Create a method that takes the results set (from the query) as an argument, and returns the results onto page
Madlibs Class Code:
<?php
class MadLibs
private $noun; // String
private $verb; // String
private $adjective; // String
private $adverb; // String
private $story; // String - entire madlib story
// Getters
public function getNoun()
return $this->noun;
public function getVerb()
return $this->verb;
public function getAdjective()
return $this->adjective;
public function getAdverb()
return $this->adverb;
public function getStory()
return $this->story;
// Setters
public function setNoun($noun)
$this->noun = $noun;
public function setVerb($verb)
$this->verb = $verb;
public function setAdjective($adjective)
$this->adjective = $adjective;
public function setAdverb($adverb)
$this->adverb = $adverb;
public function setStory($story)
$this->story = $story;
// method for inserting the new properties into mad libs database table
public function insertMadLibs($noun, $verb, $adjective, $adverb, $story)
$story = "Have you seen the $adjective $noun? They got up and started to $verb $adverb!";
$dbc = mysqli_connect('localhost', 'root', '', 'project1')
or die('Error connecting to DB');
$query = "INSERT INTO Madlibs (id, noun, verb, adjective, adverb, story, dateAdded)" .
"VALUES (0, '$noun', '$verb', '$adjective', '$adverb', '$story', NOW())";
$result = mysqli_query($dbc, $query)
or die('Error querying DB');
mysqli_close($dbc);
echo '<span id="success">Success!</span>';
// method for querying the stories that return results set newest to oldest
public function fetchStory()
$dbc = mysqli_connect('localhost', 'root', '', 'project1')
or die('Error connecting to DB.');
$query = "SELECT * FROM Madlibs ORDER BY dateAdded DESC";
$result = mysqli_query($dbc, $query)
or die('Error querying DB.');
mysqli_close($dbc);
return $result;
// method that takes the results set (from the query) as an argument, and returns the results in a formatted HTML table
public function displayStory($result)
$dbc = mysqli_connect('localhost', 'root', '', 'project1')
or die('Error connecting to DB.');
while ($row = mysqli_fetch_array($result))
echo '<div id="comments"><p>Have you seen the <b>' . $row['adjective'] . ' ' . $row['noun'] . '</b>? <br />';
echo 'They got up and started to <b>' . $row['verb'] . ' ' . $row['adverb'] . '</b>! </p>';
echo '<span id="footer">Date: ' . $row['dateAdded'] . '</span></div>';
mysqli_close($dbc);
?>
index file where calls are made:
<!DOCTYPE html>
<html>
<head>
<title>Mad libs</title>
<link rel="stylesheet" href="styles.css" type="text/css" />
</head>
<body>
<?php
require_once('MadLibs.php');
$mad_libs = new MadLibs();
$mad_libs->setNoun($_POST['noun']);
$mad_libs->setVerb($_POST['verb']);
$mad_libs->setAdjective($_POST['adjective']);
$mad_libs->setAdverb($_POST['adverb']);
// How do I remove these and still have the program function??
// Get entered info form form
$noun = $_POST['noun'];
$verb = $_POST['verb'];
$adjective = $_POST['adjective'];
$adverb = $_POST['adverb'];
if (isset($_POST['submit']))
if ( (!empty($noun)) && (!empty($verb)) && (!empty($adjective)) && (!empty($adverb)) )
$mad_libs->insertMadLibs($noun, $verb, $adjective, $adverb, $story);
else
echo '<span id="error">Please fill out all fields!</span>';
?>
<div id="wrapper">
<h1>Mad Libs</h1>
<hr>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<label for="noun">Enter a <b>Noun</b>: </label>
<input type="text" name="noun" id="noun" class="input" value="<?php echo $noun; ?>"/>
<br />
<label for="verb">Enter a <b>Verb</b> (Present Tense): </label>
<input type="text" name="verb" id="verb" class="input" value="<?php echo $verb; ?>"/>
<br />
<label for="adjective">Enter an <b>Adjective</b>: </label>
<input type="text" name="adjective" id="adjective" class="input" value="<?php echo $adjective; ?>"/>
<br />
<label for="adverb">Enter an <b>Adverb</b>: </label>
<input type="text" name="adverb" id="adverb" class="input" value="<?php echo $adverb; ?>"/>
<br />
<input name="submit" id="submit" type="submit" value="Submit"/>
</form>
</div>
<?php
$result = $mad_libs->fetchStory();
$mad_libs->displayStory($result);
?>
</body>
</html>
beginner php object-oriented mysql
beginner php object-oriented mysql
New contributor
New contributor
edited 1 min ago
200_success
131k17157422
131k17157422
New contributor
asked 2 hours ago
jpsweeney94jpsweeney94
61
61
New contributor
New contributor
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
);
);
, "mathjax-editing");
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "196"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
jpsweeney94 is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f217043%2fphp-mad-libs-with-oop-and-sql%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
jpsweeney94 is a new contributor. Be nice, and check out our Code of Conduct.
jpsweeney94 is a new contributor. Be nice, and check out our Code of Conduct.
jpsweeney94 is a new contributor. Be nice, and check out our Code of Conduct.
jpsweeney94 is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f217043%2fphp-mad-libs-with-oop-and-sql%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown