PHP mysqli next_result () फ़ंक्शन
उदाहरण - वस्तु उन्मुख शैली
डेटाबेस के खिलाफ कई प्रश्न करें:
<?php
$mysqli = new mysqli("localhost","my_user","my_password","my_db");
if ($mysqli -> connect_errno) {
echo "Failed to connect to MySQL: " . $mysqli -> connect_error;
exit();
}
$sql = "SELECT Lastname FROM Persons ORDER BY LastName;";
$sql .= "SELECT Country FROM Customers";
// Execute multi query
if ($mysqli
-> multi_query($sql)) {
do {
// Store first result set
if ($result =
$mysqli -> store_result()) {
while ($row =
$result -> fetch_row()) {
printf("%s\n", $row[0]);
}
$result
-> free_result();
}
// if there are more result-sets, the print a
divider
if ($mysqli -> more_results()) {
printf("-------------\n");
}
//Prepare next result set
} while ($mysqli
-> next_result());
}
$mysqli -> close();
?>
नीचे प्रक्रियात्मक शैली का उदाहरण देखें।
परिभाषा और उपयोग
next_result() / mysqli_next_result() फ़ंक्शन multi_query() से अगला परिणाम-सेट तैयार करता है ।
वाक्य - विन्यास
वस्तु उन्मुख शैली:
$mysqli ->
next_result()
प्रक्रियात्मक शैली:
mysqli_next_result(connection);
पैरामीटर मान
Parameter | Description |
---|---|
connection | Required. Specifies the MySQL connection to use |
टेक्निकल डिटेल
प्रतिलाभ की मात्रा: | सफलता पर सच। विफलता पर FALSE |
---|---|
पीएचपी संस्करण: | 5+ |
उदाहरण - प्रक्रियात्मक शैली
डेटाबेस के खिलाफ कई प्रश्न करें:
<?php
$con = mysqli_connect("localhost","my_user","my_password","my_db");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
exit();
}
$sql = "SELECT Lastname FROM Persons ORDER BY LastName;";
$sql .= "SELECT Country FROM Customers";
// Execute multi query
if (mysqli_multi_query($con, $sql)) {
do {
// Store first result set
if ($result = mysqli_store_result($con)) {
while ($row = mysqli_fetch_row($result)) {
printf("%s\n", $row[0]);
}
mysqli_free_result($result);
}
// if there are more result-sets, the print a
divider
if (mysqli_more_results($con)) {
printf("-------------\n");
}
//Prepare next result set
} while (mysqli_next_result($con));
}
mysqli_close($con);
?>
❮ PHP MySQLi संदर्भ