Get data from mysql database using sim808 module in Arduino?

I want to get data from mysql and send to Arduino over URL. But I cannot send to URL. Normally when I want to send data to database, I used AT+HTTPPARA. When I want to get data from database, what can I do? How can I this?

/info.php/

$conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);

if($conn->connect_error) {
die('Could not connect: ' . $conn->connect_error);
}

$sql = 'SELECT id, number FROM gsm_database';

$result = $conn->query( $sql);

if($result->num_rows > 0 ) {
$arr1 = array();
$arr2 = array();

while($row = $result->fetch_assoc()) {

/echo "id: " . $row["id"].
"number: " . $row["number"]. "
";
/
$arr1[] = $row["id"];
$arr2[] = $row["number"];

}
print_r($arr1[0]);

}

echo "
" . "Fetched data successfully\n";

$conn->close();

Arduino code

#include <SoftwareSerial.h>
SoftwareSerial gprsSerial(2,3);

int value=0;

void setup()
{

gprsSerial.begin(9600);
Serial.begin(9600);

Serial.println("Config SIM808...");
delay(2000);
gprsSerial.flush();
Serial.flush();
// attach or detach from GPRS service
gprsSerial.println("AT+CGATT?");
delay(100);
toSerial();
// bearer settings
gprsSerial.println("AT+SAPBR=3,1,"CONTYPE","GPRS"");
delay(2000);
toSerial();

// bearer settings
gprsSerial.println("AT+SAPBR=3,1,"APN","internet"");
delay(2000);
toSerial();

// bearer settings
gprsSerial.println("AT+SAPBR=2,1");
delay(2000);
toSerial();
}

void loop()
{
value=analogRead(A0);
// initialize http service
gprsSerial.println("AT+HTTPINIT");
delay(2000);
toSerial();

// set http param value
gprsSerial.println("AT+HTTPPARA="URL","http://www.mywebsite.com/info.php");

delay(2000);
toSerial();

// set http action type 0 = GET, 1 = POST, 2 = HEAD
Serial.println("\n");
gprsSerial.println("AT+HTTPACTION=0");
delay(6000);
toSerial();

// read server response
gprsSerial.println("AT+HTTPREAD");
delay(1000);
toSerial();

gprsSerial.println("");
gprsSerial.println("AT+HTTPTERM");
toSerial();
delay(300);

gprsSerial.println("");
delay(10000);
}

void toSerial()
{
while(gprsSerial.available()!=0)
{
Serial.write(gprsSerial.read());
}
}

Serial.println("Config SIM808...");
delay(2000);
Serial.println("Done!...");

^This made me laugh.

What was your question?

ScrewLoose:

Serial.println("Config SIM808...");

delay(2000);
Serial.println("Done!...");




^This made me laugh.

What was your question?

I mean yeah, why use an AT command to check at all right?

I'm sorry I added my question. I used AT command. Because I want to control connection like internet.

The normal way to get data from a database over http is to send a GET request to the server, which then reads the requested data from the database and sends it back to you.