Answers for "php mysql_query"

PHP
3

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'];
}
Posted by: Guest on October-06-2020
0

php query

xPaw\SourceQuery\Exception\InvalidPacketException: Failed to read any data from socket in C:\xampp\htdocs\minecraft\vendor\xpaw\php-source-query-class\SourceQuery\BaseSocket.php:50
Stack trace:
#0 C:\xampp\htdocs\minecraft\vendor\xpaw\php-source-query-class\SourceQuery\Socket.php(76): xPaw\SourceQuery\BaseSocket->ReadInternal(Object(xPaw\SourceQuery\Buffer), 1400, Array)
#1 C:\xampp\htdocs\minecraft\vendor\xpaw\php-source-query-class\SourceQuery\SourceQuery.php(212): xPaw\SourceQuery\Socket->Read()
#2 C:\xampp\htdocs\minecraft\View.php(27): xPaw\SourceQuery\SourceQuery->GetInfo()
#3 {main}
Posted by: Guest on August-19-2021

Browse Popular Code Answers by Language