Sql Flashcards
How to start a PHP session
session.start();
How to stop a PHP session
session.destroy();
How do you create a SQL connection
$con = mysqli_connect($server,$username,$password,$database);
How do you stop a PHP script
die();
How do you display text
echo
How do you terminate a SQL connection
Mysqli_close($con);
How do you get the results from an SQL query
$result = mysqli_query($con,$sql);
How do you get the number of rows in the result
$row = mysqli_num_rows($results);
How do you get the results as an array
$row = mysqli_fetch_array($results);
How is an if statement written
If (condition) { code to be executed}
How is a if elif else statement written
if(condition) {code} else if(condition) {code} else {code}
While loops
while(condition){code}
For loop
for($x = 0, $x<=10, $x++){code}
Return X then increment
$x++
Increment then return x
++$x