求代码,微信公众平台读取sae的数据库的内容? 20
类似于:$link=mysql_connect(SAE_MYSQL_HOST_M.':'.SAE_MYSQL_PORT,SAE_MYSQL_USER,SAE_MYSQL_...
类似于:
$link=mysql_connect(SAE_MYSQL_HOST_M.':'.SAE_MYSQL_PORT,SAE_MYSQL_USER,SAE_MYSQL_PASS);
if($link)
{
mysql_select_db(“app_wejax”,$link);
$sql="SELECT * FROM '13shuju' WHERE 'id' LIKE '%{$keyword}%'";
$query=mysql_query($sql);
$rs=mysql_fetch_array($query);
$contentStr=$rs['Content'];
mysql_close($link);
$resultStr=sprintf($textTp1,$fromUsername,$toUsername,$time,$contentStr);
echo $resultStr;
}
但是我测试这个代码却不成功,无论微信发什么都没反应!!!而下面发送“?”显示时间的代码却可以,
在下小白一个求大神赐教!
if($keyword == "1")
{
$msgType = "text";
$contentStr = date("Y-m-d H:i:s",time());
$resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
echo $resultStr;
}
}else{
echo "";
exit;
} 展开
$link=mysql_connect(SAE_MYSQL_HOST_M.':'.SAE_MYSQL_PORT,SAE_MYSQL_USER,SAE_MYSQL_PASS);
if($link)
{
mysql_select_db(“app_wejax”,$link);
$sql="SELECT * FROM '13shuju' WHERE 'id' LIKE '%{$keyword}%'";
$query=mysql_query($sql);
$rs=mysql_fetch_array($query);
$contentStr=$rs['Content'];
mysql_close($link);
$resultStr=sprintf($textTp1,$fromUsername,$toUsername,$time,$contentStr);
echo $resultStr;
}
但是我测试这个代码却不成功,无论微信发什么都没反应!!!而下面发送“?”显示时间的代码却可以,
在下小白一个求大神赐教!
if($keyword == "1")
{
$msgType = "text";
$contentStr = date("Y-m-d H:i:s",time());
$resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
echo $resultStr;
}
}else{
echo "";
exit;
} 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏20(财富值+成长值)
展开全部
之前写的php的,你看看。好久没玩了
function mysqlConnection(){
$mysql = new SaeMysql();
$sql = "SELECT * FROM `news` LIMIT 10";
$data = $mysql->getData( $sql );
echo $data[0]['title'];
/*
echo "<pre>";
print_r($data);
echo "</pre>";
*/
$mysql->closeDb();
$count = count($data);
$record=array();
for ($i=0;$i<$count;$i++){
$item[$i]=array(
'title' =>$data[$i][title],
// echo $data[$i][title];
'description' =>$data[$i][description],
'picUrl' => $data[$i][picUrl],
'url' =>$data[$i][url]
);
}
$record = $item;
return $record;
}
function mysqlConnection(){
$mysql = new SaeMysql();
$sql = "SELECT * FROM `news` LIMIT 10";
$data = $mysql->getData( $sql );
echo $data[0]['title'];
/*
echo "<pre>";
print_r($data);
echo "</pre>";
*/
$mysql->closeDb();
$count = count($data);
$record=array();
for ($i=0;$i<$count;$i++){
$item[$i]=array(
'title' =>$data[$i][title],
// echo $data[$i][title];
'description' =>$data[$i][description],
'picUrl' => $data[$i][picUrl],
'url' =>$data[$i][url]
);
}
$record = $item;
return $record;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询