I wrote a very simple code that connects to a database in my local machine and fetches 5 records as below
<?php
$servername = "127.0.0.1";
$username = "root";
$password = "";
$dbname = "myDB";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
$sql = "SELECT * FROM myDB.accounts limit 5";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
print_r($row);
}
} else {
echo "0 results";
}
$conn->close();
?>
I would like to be able to capture the MySQL query SELECT * FROM myDB.accounts limit 5
that I sent to the server in a text file so I can perform some verification on them. I also need to capture Insert/Update/Delete queries.
I run code in Chrome on a Win 8.1 machine featuring XAMPP server. The code works but I am unable to see/capture the query in Fiddler, WireShark, or even Google Developer tools. When I see request in Google developer, I see below:
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8,fa;q=0.6
Cache-Control:max-age=0
Cookie:ci_session=a%3A4%3A%7Bs%3A10%3A%22session_id%22%3Bs%3A32%3A%22f3bf7b34d76196d3fc0902960e4dbf1a%22%3Bs%3A10%3A%22ip_address%22%3Bs%3A9%3A%22127.0.0.1%22%3Bs%3A10%3A%22user_agent%22%3Bs%3A109%3A%22Mozilla%2F5.0+%28Windows+NT+6.3%3B+WOW64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F44.0.2403.107+Safari%2F537.36%22%3Bs%3A13%3A%22last_activity%22%3Bi%3A1438461576%3B%7Dff60e2b505c1d256c41a21f670827a12401b9667
Host:127.0.0.1
Proxy-Connection:keep-alive
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36
Also, I would like to know what does CI-Session do down there? I Googled it and found lots of Q&A about user session management with CodeIgniter, but my code has nothing to do with CodeIgniter.
Any help is highly appreciated. Thanks