小编ian*_*ian的帖子

使用mysql_real_escape_string来清除我的查询

这是最好的方法吗?

我应该对每个查询中的每个值执行此操作吗?GET和POST?

是否有addslashes(mysql_real_escape_string())过度杀伤?

php mysql

1
推荐指数
1
解决办法
464
查看次数

简单的jquery图像更改onclick失败

我有一个失败的简单jQuery图像开关.

$('.heart_img').click(function()
    {
        var heart_type = $(this).attr('src');

        //alert( heart_type );

        if ( heart_type == 'images/unheart.png')
        {
            //alert('uheart');
            $(this).attr('src','images/heart.png');
        }
        else if ( heart_type == 'images/heart.png');
        {
            $(this).attr('src','images/unheart.png');
        }

    });
Run Code Online (Sandbox Code Playgroud)

未注释时警报会正确触发,并且图像位于正确的位置,因此我不确定问题是什么.

jquery

1
推荐指数
1
解决办法
689
查看次数

代码前置url链接

由于某种原因,我的PHP正在将页面URL添加到我的链接中.

应该具有值的链接#出来mysite.com/url_the_page/page.php#并想出会导致这种情况的原因是什么?

echo'<a href="#" id="bb">click me</a></span>';
echo '<a href="#" id="song_'. $row[id].'">';
echo $artist_title;
echo '</a></span>';`
Run Code Online (Sandbox Code Playgroud)

完整代码:

while ($row = mysql_fetch_array($query))
    {

        if ($row[sourcefile] !== NULL )
        {


            echo '';


            if ( $row[artist] !== NULL && $row[title] !== NULL)
            {
                $artist_title = $row[artist] . ' - ' . $row[title];
            }
            else
            {
                $artist_title = $row[originalfilename];
            }



            echo "<a href=http://".$row[link].' target="_blank">LINK</a> - ';

            if ( $row[listened] == 0)
            {
                $link_class = "unlistened";
            }
            else
            {
                $link_class = "listened"; …
Run Code Online (Sandbox Code Playgroud)

url anchor

1
推荐指数
1
解决办法
182
查看次数

为什么我的图像会以这种方式滚动?

我的图像翻转工作...但只有一种方式.

function heartOver(id)
{

    if(document.getElementById('heart' + id).src == 'images/heart.png');
    {
        parent.document.getElementById('heart' + id).src = 'images/unheart.png';
    }

    if(document.getElementById('heart' + id).src == 'images/unheart.png');
    {
        parent.document.getElementById('heart' + id).src = 'images/heart.png';
    }   

}


<img src="images/heart.png" id="heart'.$row['id'].'" alt="Love! width="16" height="16" border="0" onmouseover="heartOver'."('$row[id]')".'; return true;" onmouseout="heartOver'."('$row[id]')".'; return true;">
Run Code Online (Sandbox Code Playgroud)

如果我注释掉任何一个IF语句,那么另一个会工作,但他们不会一起工作......

注意:试一试else if没有运气.

想出来...... Duh:我有if(); 不 如果......

javascript php

0
推荐指数
1
解决办法
99
查看次数

使用jquery获取单击的元素id

我有一系列删除图标显示如下:

echo '<img id="'.$items['id'].'" src="images/delete.png" />'; 
Run Code Online (Sandbox Code Playgroud)

哪个$items['id']是对DB项目的id的引用,我想要删除该图标.

当单击该项时,如何在jquery中访问此id,以便我可以调用:

$.get('ajax/delete.php', { id: $('#id').val() },      
function(data) {}
Run Code Online (Sandbox Code Playgroud)

或类似的东西.

javascript jquery

0
推荐指数
1
解决办法
3007
查看次数

twitter api帖子被切断了

我使用以下代码将更新发布到twitter:

// Set username and password for twitter API
        $username = '***';
        $password = '***';

        // The twitter API address
        $url = 'http://twitter.com/statuses/update.xml';

        // Alternative JSON version
        // $url = 'http://twitter.com/statuses/update.json';

        // Set up and execute the curl process
        $curl_handle = curl_init();

        curl_setopt($curl_handle, CURLOPT_URL, "$url");
        curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10);
        curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl_handle, CURLOPT_POST, 1);
        curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "status=$update");
        curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password");

        $buffer = curl_exec($curl_handle);

        curl_close($curl_handle);

        // check for success or failure

        if (empty($buffer)) 
        {
            echo 'error?!';
        } 
        else 
        {
            // mark …
Run Code Online (Sandbox Code Playgroud)

php api twitter curl

0
推荐指数
1
解决办法
951
查看次数

yiic命令行工具输出代码而不是打开shell

当我运行命令时: users-MacBook-Air:trackstar user$ ../yii/framework/yiic shell

哪个应该为Yii启动yiic shell工具.我只是得到这样的输出:

<!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>
PHP Error</title>

<style type="text/css">
/*<![CDATA[*/
body {font-family:"Verdana";font-weight:normal;color:black;background-color:white;}
h1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
h2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
h3 {font-family:"Verdana";font-weight:bold;font-size:11pt}
p {font-family:"Verdana";font-size:9pt;}
pre {font-family:"Lucida Console";font-size:10pt;}
.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
.message {color: maroon;}
.source {font-family:"Lucida Console";font-weight:normal;background-color:#ffffee;}
.error {background-color: #ffeeee;}
/*]]>*/
</style>
</head>

<body>
Run Code Online (Sandbox Code Playgroud)

等等,任何想法为什么会这样?

php terminal command-line frameworks yii

0
推荐指数
1
解决办法
1544
查看次数

非常简单的javascript失败

工作实例:

这几乎与我在我的页面上的其他位置使用的代码相同,但由于某种原因在这里失败.

<?php
//$p = "test";
?>

<script>
alert('posts are firing? ');
parent.document.getElementById('posts').innerHTML = "test";
</script>
Run Code Online (Sandbox Code Playgroud)

失败的例子:(警报仍然有效)

<?php
$p = "test of the var";
?>

<script>
alert('posts are firing? ');
parent.document.getElementById('posts').innerHTML = '<?php $p; ?>';
</script>
Run Code Online (Sandbox Code Playgroud)

javascript php

-1
推荐指数
1
解决办法
155
查看次数

标签 统计

php ×5

javascript ×3

jquery ×2

anchor ×1

api ×1

command-line ×1

curl ×1

frameworks ×1

mysql ×1

terminal ×1

twitter ×1

url ×1

yii ×1