Search
 
SCRIPT & CODE EXAMPLE
 

PHP

query sql in php

$sql = "SELECT id, firstname, lastname FROM MyGuests";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
        echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";
    }
} else {
    echo "0 results";
}
$conn->close();
Comment

query php

<?php 
// MySqli connection
$mysqli = new mysqli("localhost", "my_username", "my_password", "my_database");

// Errors
if($mysqli->connect_error) {
  echo "<b>Failed to connect to MySQL: </b>" . $mysqli->connect_error;
}

// Query
$selectQuery = $mysqli->prepare("SELECT * FROM my_table");
$selectQuery->execute();
$selectQueryResult = $selectQuery->get_result();

// Loop 
while($selectQueryRow = $selectQueryResult->fetch_array()) {
  echo $selectQueryRow['my_column'];
}

// Example
$selectUsername = $mysqli->prepare("SELECT * FROM users");
$selectUsername->execute();
$selectUsernameResult = $selectUsername->get_result();
while($selectUsernameRow = $selectUsernameResult->fetch_array()) {
  echo $selectUsernameRow['username'];
}
Comment

php query

xPawSourceQueryExceptionInvalidPacketException: Failed to read any data from socket in C:xampphtdocsminecraftvendorxpawphp-source-query-classSourceQueryBaseSocket.php:50
Stack trace:
#0 C:xampphtdocsminecraftvendorxpawphp-source-query-classSourceQuerySocket.php(76): xPawSourceQueryBaseSocket->ReadInternal(Object(xPawSourceQueryBuffer), 1400, Array)
#1 C:xampphtdocsminecraftvendorxpawphp-source-query-classSourceQuerySourceQuery.php(212): xPawSourceQuerySocket->Read()
#2 C:xampphtdocsminecraftView.php(27): xPawSourceQuerySourceQuery->GetInfo()
#3 {main}
Comment

PREVIOUS NEXT
Code Example
Php :: laravel data type 
Php :: wordpress programmatically change slug of media attachment site:wordpress.stackexchange.com 
Php :: wordpress font awesome enque 
Php :: laravel validation 
Php :: php sort 
Php :: how to unhash password_hash in php 
Php :: phpunit/phpunit[6.0.0, ..., 6.5.14] require php ^7.0 - your php version (8.0.0) does not satisfy that requirement. 
Php :: Email "" does not comply with addr-spec of RFC 2822. 
Php :: how to convert youtube video to mp3 in php 
Php :: recorrer un array php 
Php :: php simple server 
Php :: php slow 
Php :: php login system 
Java :: when is the first day of spring 
Java :: how to get current date time in android 
Java :: left fold java 
Java :: jsp import class 
Java :: java pause 1 second 
Java :: main code of java 
Java :: java stream collect to arraylist 
Java :: java selenium new empty window 
Java :: java lerp 
Java :: java convert string to int 
Java :: set height of layout programmatically android 
Java :: java check ipv6 with regex 
Java :: spring boot resource optional request param 
Java :: how to make plugin wait spigot 
Java :: check if string contains numbers 
Java :: java double to fixed decimal 
Java :: leap year program in java 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =