What do you want to save?
Add Code snippet
New code examples
-
Other 2021-09-09 18:36:03
iterate through names of columns in result set pdo
//Connect to MySQL using PDO. $pdo = new PDO("mysql:host=$host;dbname=$database", $user, $password); //Create our SQL query. $sql = "SELECT * FROM my_table_name LIMIT 20"; //Prepare our SQL query. $statement = $pdo->prepare($sql);... Add solution -
PHP 2021-09-08 09:39:01
create a random question generator php
<?php //Connect with mysql $db = new mysqli("host","user","pass","db"); //Perform the query to choose random questions $query = $db->query("SELECT * FROM `table` ORDER BY RAND() LIMIT 2... Add solution -
PHP 2021-09-07 03:12:03
login page php mysql check if user is verified in the database before user can be logged in
// call the login() function if register_btn is clicked if (isset($_POST['login_btn'])) { login(); } // LOGIN USER function login(){ global $db, $username, $errors; // grap form values $username = e($_POST['username']); $password = e($_POST['passwo... Add solution -
PHP 2021-09-06 08:01:02
mysqli_test
<?php $mysqli = mysqli_connect("example.com", "user", "password", "database"); $result = mysqli_query($mysqli, "SELECT 'A world full of '&n... Add solution -
PHP 2021-09-03 23:48:02
pdo fetch
<?php $sth = $dbh->prepare("SELECT name, colour FROM fruit"); $sth->execute(); /* Exercise PDOStatement::fetch styles */ print("PDO::FETCH_ASSOC: "); print("Return&... Add solution -
PHP 2021-09-03 23:16:02
sql select php
<?php $servername = "localhost"; $username = "username"; $password = "password"; $dbname = "myDB"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($co... Add solution -
PHP 2021-08-27 13:32:02
difference between fetch assoc and fetch array or object php
mysql_fetch_assoc The function returns an associative array of strings that corresponds to the fetched row, or FALSE if there are no more rows. The associativity array tells us about the key value pair, whereas the key tells about any column name and ... Add solution