我不是第一个在这里问这个问题的人,但说真的,我在问之前尝试了可能的重复。
这是我的代码:已更新
foreach ($pieces as $v) {
$get_user ="SELECT * from demo_user WHERE user_name ='$v'";
$result = mysql_query($get_user);
if (!$result) {
die(mysql_error());
}
while($row = mysql_fetch_array($result))
{
$GLOBAL_REST_URL = "http://192.168.0.100:9000/meeting/";
$part_name = $row['user_name'];
$participant = array("email"=>$row['primary_email'],
"contact_no"=>$row['primary_mobile'],
"password"=>$attendee_password,
);
$LOCAL_REST_URL = $GLOBAL_REST_URL .$mtngid.'/participant/'.$row['user_name'] ;
$json_part = array2json($participant);
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,$LOCAL_REST_URL);
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,20);
curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl_handle, CURLOPT_POSTFIELDS,$json_part);
curl_setopt($curl_handle, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
$getit_part = json_decode($buffer, true);
if ($getit_part['code'] == 200){
$key = $getit_part['data'];
$join_url = "http://192.168.0.100/UI/user/joinuser.php?meetingid=".$mtngid."&key=".$getit_part['data'];
$pr_mobile = $row['primary_mobile'];
$pr_email = $row['primary_email'];
$sql = "INSERT INTO demo_participant(name,
meeting_id_id,
password,
user_view__url,
`key`,
contact_no,
email)
SELECT '$part_name',
id,
'$attendee_password',
'$join_url',
{$getit_part['data']},
'$pr_mobile',
'$pr_email'
FROM demo_meeting
WHERE meetingID = '$mtngid'";
$result = mysql_query($sql) or die (mysql_error());
}
// $message = 'Hi '.$_GET['meeting_name'].',and associated participant Updated successfully ';
}
}
当我执行上面的代码时,我收到以下警告:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in
print_r($pieces)
输出:
Array
(
[0] => Digvijay
[1] => philip
[2] => fake
)
请让我知道,我可能做错了什么。