我在facebook的postgres数据库中存储用户喜欢的页面,其中一个是Sinead O'Connor的页面.看起来当它到达撇号时,它会终止查询,因为撇号匹配,因此会导致错误:
$json_likes=json_encode($likes);
echo $json_likes;
$query = "UPDATE public.account_recover_users SET user_likes='$json_likes' WHERE user_mail='$email'";
$result = pg_query($query);
if(!$result)
exit('{ "status": false }');
else exit('{ "status": true }');
Run Code Online (Sandbox Code Playgroud)
现在我得到的是:
Warning: pg_query() [<a href='function.pg-query'>function.pg-query</a>]: Query failed: ERROR: syntax error at or near "Connor" LINE 1: ...l","page_id":"243440865683470"},{"name":"Sinead O'Connor","p...
Run Code Online (Sandbox Code Playgroud)
知道我应该怎么处理这个?我的应用程序的用户可能在他们喜欢的页面中有各种各样的字符.
我一直$.getJSON在使用exit("{'status':true}")(或false)来验证脚本是否正确完成了工作,但是现在我需要脚本来返回值(或数组)。我知道我不能使用 exit('{ "status": $myarray}');。我该怎么用呢?我是php的新手,有可能做类似的return '{ "status": $myarray}';事情吗?提前致谢
我有以下代码:
if ($difference)
{
$.post("recover_functions/upload_photos.php",
{upload:$difference},
function(response)
{
alert($difference);
if (response.status)
alert("Successfully uploaded photos");
else
alert(response);
});
}
Run Code Online (Sandbox Code Playgroud)
警报将显示:
{"difference":"[{\"aid\":\"100000543443572_1073741825\",\"backdated_time\":null,\"caption\":\"\",\"link\":\"http:\\\/\\\/www.facebook.com\\\/photo.php?fbid=614604095234366&set=a.614604001901042.1073741825.100000543443572&type=1\",\"pid\":\"100000543443572_2384218\",\"place_id\":null}]"}
Run Code Online (Sandbox Code Playgroud)
我得到这样的'POST请求:
$string_diff = $_POST['upload'];
$array_diff = json_decode($string_diff);
echo $array_diff;
Run Code Online (Sandbox Code Playgroud)
不是回应Object of class stdClass could not be converted to string.请帮助,我有一个截止日期(1小时),我不能让这个工作.
我的老板要我修改菜单 - 它是用图像制作的,现在他要我用CSS做按钮.我创建了按钮,但现在我需要在鼠标悬停时更改它们,就像在图像中一样:

现在,我真的不是设计师,我更喜欢服务器端的东西,但我需要这样做..我创建的按钮的代码是:
a {
text-transform:none;
color:#F1EFED;
padding:10px;
background-color: #84c225;
}
Run Code Online (Sandbox Code Playgroud)
我怎么能得到这个效果?
我在使用Windows Xp的计算机上安装了git,我正在尝试从heroku上托管的远程存储库进行克隆.问题是,当我第一次登录heroku时,不会出现生成ssh密钥选项.使用ssh-keygen -t rsa -C "your_email@example.com"我创建了一个ssh密钥(git bash说的是这样),但是如果我转到该文件夹,它只包含该known_hosts文件.系统和隐藏文件可见.由于生成的ssh选项没有显示,我想已经有一个存在的ssh,但它不适合 - 因为我在尝试克隆repo时收到权限被拒绝错误.
知道我该怎么解决这个问题?
我的HTML看起来像这样:
<div id="whatever">
<div>
<p></p>
<p></p>
</div>
<div>
<p></p>
<p></p>
<p></p>
</div>
<div>
<p></p>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
现在,我需要选择所有p元素,除了div"any" 中的最后一个元素.我试过了#whatever>:not(:last-child)div>p,但似乎没有用.任何帮助,将不胜感激.
我array_unique在数组上使用后,当我var_dump在数组中时,它仍然具有相同的内容,并带有重复项:
array(21) {
[0]=> string(10) "tricou_CRS"
[1]=> string(10) "tricou_CRM"
[2]=> string(11) "tricou_CRXL"
[3]=> string(10) "tricou_CBM"
[4]=> string(10) "tricou_CBL"
[5]=> string(10) "tricou_CWS"
[6]=> string(11) "tricou_CWXL"
[7]=> string(10) "tricou_CRS"
[8]=> string(10) "tricou_CRM"
[9]=> string(11) "tricou_CRXL"
[10]=> string(10) "tricou_CBM"
[11]=> string(10) "tricou_CBL"
[12]=> string(10) "tricou_CWS"
[13]=> string(11) "tricou_CWXL"
[14]=> string(10) "tricou_CRS"
[15]=> string(10) "tricou_CRM"
[16]=> string(11) "tricou_CRXL"
[17]=> string(10) "tricou_CBM"
[18]=> string(10) "tricou_CBL"
[19]=> string(10) "tricou_CWS"
[20]=> string(11) "tricou_CWXL" }
Run Code Online (Sandbox Code Playgroud)
这显然有一些重复.现在,没有太多的代码可以帮助,真的,因为它只是array_unique($myarr);var_dump($myarr);.那么,我在那里错过了什么?array_unique不应该删除重复项吗?类型和内容在许多阵列的位置都是相同的.
我有以下代码:
<script type="text/javascript">
$( "#form_div" ).dialog({
autoOpen: false,
height: 300,
width: 350,
modal: true
});
</script>
<div id="form_div" title="Trimite-ne un mesaj!">
<form name="htmlform" method="post" action="html_form_send.php">
<table width="450px">
</tr>
<tr>
<td valign="top">
<label for="first_name">Nume*</label>
</td>
<td valign="top">
<input type="text" id="first_name" maxlength="50" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="email">Email *</label>
</td>
<td valign="top">
<input type="text" id="email" maxlength="80" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="message">Mesaj: *</label>
</td>
<td valign="top">
<textarea id="message" maxlength="1000" cols="25" rows="6"></textarea>
</td>
</tr>
</table>
</form>
</div>
Run Code Online (Sandbox Code Playgroud)
问题是,在单击按钮并显示为模式对话框之前,页面加载时仍会显示表单而不是隐藏.我在页面中加载了最新的JQuery和JQuery-UI.知道问题可能是什么?
我试图检查DOM中是否存在div:
$("#mydiv") //returns []
$.isEmptyObject($("#mydiv")) //returns false
$.isEmptyObject([]) //returns true
Run Code Online (Sandbox Code Playgroud)
知道我可能做错了什么吗?
另外,检查DOM中元素是否存在的最佳方法是什么?
我试图enum在Java中第一次声明一个,如下所示:
public enum Atom_const{
public final float HIDROGEN_RADIUS=.1f;
public final float CARBON_RADIUS=.28f;
}
Run Code Online (Sandbox Code Playgroud)
Eclipse给了我一个错误"Syntax error on token "{", ; expected",但我从未见过像"{;"这样的语法 之前,我没有在enum例子中看到这一点.那么宣布一个正确的方法是enum什么?
我确实看过http://docs.oracle.com/javase/tutorial/java/javaOO/enum.html但没有; 在{.之后.我怀疑这是因为我做了作业,但我不确定.