Save
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

PHP - Week 2

WTWD 410 - PHP Vocabulary

TermDefinitionExample
PHP Function A block of code that performs a specific task, can be reused, and may take inputs and return outputs. function add($a, $b) { return $a + $b; } echo add(5, 3); // Output: 8
Error Handling Techniques used to manage errors in PHP, including the use of try, catch, and finally blocks. try { $result = riskyOperation(); } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } finally { echo 'This block executes regardless of an error.'; }
MySQL Basics Fundamental operations and commands used to interact with a MySQL database, such as connecting to the database, querying data, and closing the connection. $cnx = new mysqli("host", "user", "pass", "db"); if ($cnx->connect_error) die("Fail: " . $cnx->connect_error); $sql = "SELECT name FROM users"; $result = $cnx->query($sql); while($row = $result->fetch_assoc()) echo $row["name"]; $cnx->close();
Form Method Attribute Specifies the HTTP method to be used when submitting the form data, typically either GET or POST. <form action="submit.php" method="POST"> <input type="text" name="username"> <input type="submit" value="Submit"> </form>
Form Validation The process of ensuring that the user-provided data in a form is correct, complete, and meets certain criteria before it is submitted. if ($_SERVER["REQUEST_METHOD"] == "POST") { $name = trim($_POST["name"]); if (empty($name)) echo "Name is required"; elseif (!preg_match("/^[a-zA-Z-' ]*$/", $name)) echo "Only letters and spaces"; else echo "Valid name"; }
Regular Expression (RegEx) A sequence of characters that forms a search pattern, often used for string matching and manipulation. $pattern = "/^([a-zA-Z' ]+)$/"; $string = "John Doe"; if (preg_match($pattern, $string)) { echo "Valid name"; } else { echo "Invalid name"; }
Try-Catch Statement A control structure used to handle exceptions in PHP. The try block contains code that might throw an error, and the catch block contains code to handle the error if it occurs. try { $result = riskyOperation(); } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; }
Database Connection The process of establishing a connection between PHP and a database server. $conn = new mysqli("localhost", "username", "password", "database"); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); }
Query Execution Running a SQL query against a database and retrieving the results. $sql = "SELECT id, name FROM users"; $result = $conn->query($sql); while($row = $result->fetch_assoc()) { echo "id: " . $row["id"]. " - Name: " . $row["name"]. "<br>"; }
MySQLi An improved extension of PHP to interact with MySQL databases, offering both procedural and object-oriented interfaces. $conn = new mysqli("localhost", "user", "pass", "db");
PDO (PHP Data Objects) A database access layer providing a uniform method of access to multiple databases, including MySQL, and supporting prepared statements. $conn = new PDO("mysql=localhost;dbname=db", "user", "pass");
Prepared Statement A feature used to execute the same SQL statement repeatedly with high efficiency, and to prevent SQL injection. $stmt = $conn->prepare("SELECT * FROM users WHERE email = ?"); $stmt->bind_param("s", $email); $stmt->execute();
Bind Parameter Associates variables with a prepared statement as parameters, allowing for safer and more efficient execution of SQL queries. $stmt->bind_param("s", $email);
Fetch Retrieves a row from a query result, typically used within a loop to process multiple rows. while ($row = $result->fetch_assoc()) { echo $row['id'] . " " . $row['name']; }
Close Connection Terminates the connection to the MySQL database, freeing up resources. $conn->close();
Escape String A method used to escape special characters in a string for use in an SQL statement, preventing SQL injection. $name = $conn->real_escape_string($name);
MySQLi Query A method used to perform queries against a MySQL database using the MySQLi extension. $result = $conn->query("SELECT * FROM users");
Created by: ProfJordan
Popular Computers sets

 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards