이 스레드에서 다음에 나오는 대부분의 사람들이 알고 있듯이 for 루프와 if 문을 사용하여 대량 SMS를 보내는 데 문제가있었습니다. 그러나 나는 나의 쿼리를 다음과 같이 줄였다. 난 단지 사용과 그리고 각 예방 접종 날짜PHP가 모든 주어진 문장을 실행하지 않습니다
$getnumbers="SELECT
guardian_records.First_Name,
guardian_records.ID,
guardian_records.Cellphone_Number,
children_records.Child_First_Name,
children_records.Guardian_ID,
children_records.ID,
immunization_records.child_ID,
immunization_records.First_Immunization_Date,
FROM
guardian_records,
children_records,
immunization_records
WHERE
guardian_records.ID = children_records.Guardian_ID
AND children_records.ID = immunization_records.child_ID
AND immunization_records.First_Immunization_Date = CURDATE()";
$check = mysql_query($getnumbers);
$found = mysql_num_rows($check);
$details=mysql_fetch_assoc ($check);
$date1=$details['First_Immunization_Date'];
$todays_date = date("Y-m-d");
$today = strtotime($todays_date);
$immunization_date1 = strtotime($date1);
if($immunization_date1 == $today)
for($counter=0;$counter<$found;$counter++)
{
$date = $date1;
$shots = "Polio and Diptheria";
$cellphonenumber=$details['Cellphone_Number'];
$childname=$details['Child_First_Name'];
$parentname=$details['First_Name'];
$msg="Dear $parentname, your child $childname is due for $shots shots on $date which is today. Message sent by Maisha Reminder System";
$encmsg=urlencode($msg);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://localhost:13013/cgi-bin/sendsms?username=Maisha&password=m123456&to=$cellphonenumber&text=$encmsg");
curl_exec ($ch);
curl_close ($ch);
}
}
나는 그것이 내가 같은 페이지에서 위의 코드는 가능한 각 예방 접종에 대한 네 번 반복이 있습니다 짓을하는 방법에 대한 쿼리를 반복하고있다. 그러나 PHP는 전체 구문을 실행하지 않습니다. 그러면 첫 번째 스택 만 중지됩니다. 예를 들어 위의 예제 코드를 사용하면이 비트 만 실행하고 위의 코드와 정확히 같은 코드를 남겨 둡니다.
PHP가 모든 지정된 문장을 실행하는지 확인하는 방법이 있습니까? FOR 루프 또는 IF 문은 조건이 충족 될 경우 모든 명령문의 실행을 차단합니까? 모든 도움을 주셨습니다.
하나의 보호자가 여러 개의 예방 접종 ID를 가질 수 있다고 가정하고 모든 가능한 예방 접종 ID를 포함하는 보호자 당 하나의 메시지 만 보내고 싶습니다. – dmcnelis