I want to assign the value of "$numbers" based on the respective "contact_number" of the selected student in the database. I have tried:
$numbers = "SELECT contact_number from students where idnumber='$idnumber'";
But it just selects the idnumber of the selected student.
Pic of my table: students table
The code:
<?php
$username = "******@****";
$hash = "*******";
// Config variables. Consult http://api.txtlocal.com/docs for more info.
$test = "0";
// Data for text message. This is the text message data.
$sender = "CCA Update"; // This is who the message appears to be from.
$numbers = "SELECT contact_number from students where idnumber='$idnumber'";
// A single number or a comma-seperated list of numbers
$message = "Your grade has been updated!";
// 612 chars or less
// A single number or a comma-seperated list of numbers
$message = urlencode($message);
$data = "username=".$username."&hash=".$hash."&message="
.$message."&sender=".$sender."&numbers=".$numbers."&test=".$test;
$ch = curl_init('https://api.txtlocal.com/send/?');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch); // This is the result from the API
curl_close($ch);
print_r($result);
?>
I can provide more info if needed.