<?
$db1 = mysql_connect("localhost","root","root") or dir("can not connect Mysql Server");
mysql_select_db("1",$db1) or dir("Can not connect to the MySQL Server.");
$db2 = mysql_connect("localhost","root","root") or dir("can not connect Mysql Server");
mysql_select_db("2",$db2) or dir("Can not connect to the MySQL Server.");
?>
$result = mysql_query("SELECT * FROM db1.tags WHERE db1.catalog='fresh tag' ");
Run Code Online (Sandbox Code Playgroud)
如果我从多数据库连接,如何从db1进行MySQL查询?
输入按钮位于index.php中
<form method="post" action="1.php,2.php,3.php">
<input type="text" name="search" id="search" class='search'/>
<Input type="image" src="" value="Search" class="search_button" /><br />
</form>
Run Code Online (Sandbox Code Playgroud)
我想设置一个搜索框并将值发布到3页.3个页面获取值并在进程后自行运行,
1.php生成1.jpg,
2.php生成2.jpg,
3.php生成3.jpg.
然后index.php等待3个图像生成,然后做出回声,显示3个图像.
怎么做?谢谢.
我想做到这一点:当鼠标悬停在一张图片上时,显示其标题.我使用下面的代码,当我悬停图片时,显示所有图片的标题.如何更改代码以仅显示一个标题?
<script type="text/javascript">
$(function() {
$('.image').each(function() {
$(this).hover(
function() {
$('.title').animate({ opacity: 1 })
},
function() {
$('.title').stop().animate({ opacity: 0});
})
});
});
</script>
<div class="image"><img src="img1" /><p class="title">text1</p></div>
<div class="image"><img src="img2" /><p class="title">text2</p></div>
<div class="image"><img src="img3" /><p class="title">text3</p></div>
Run Code Online (Sandbox Code Playgroud) 我想制作一个css规则,它会影响除Opera操作系统以外的所有浏览器,所有其他浏览器都会添加一个css规则:
#content{left:1px;},(没有这个规则的歌剧).以下代码不起作用......
<!--[if !OPERA]>
<style type="text/css">
#content{left:1px;}
</style>
<![endif]-->
Run Code Online (Sandbox Code Playgroud) <?php include("news.php"); ?>
Run Code Online (Sandbox Code Playgroud)
您好,我news.php在主页中添加了一个index.php.我想刷新news.php每30秒,但不刷新主页index.php,如何部分刷新包含php页面?谢谢.
我想用use jQuery.load()来加载一些内容.如何在加载过程中添加微调器?

$("#content").load("b.php #abc");
Run Code Online (Sandbox Code Playgroud) 我是学习jquery.ajax的新手.我想将一些数据从a.php粘贴到b.php.这是我的代码:
a.php只会
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script language="javascript">
$(document).ready(function () {
var params = "value=" + $('#send').text();
$.ajax({
url:'b.php',
type:'post',
dataType:'html',
data:params,
success:function(data){ $("#result").html($(data).html('#aa')); }
});
});
</script>
<body>
<div id="result"></div>//sometimes the return data is empty, so this part just return: <div="aa"></div>
<div id="send">apple</div>
Run Code Online (Sandbox Code Playgroud)
b.php
<?php
echo '<div id="aa">';
//'.$_REQUEST['value'].' will put in some process here, but sometimes the return data is empty.
echo '</div>';
?>
Run Code Online (Sandbox Code Playgroud)
如何以及在何处添加判断,如果<div id="aa"></div>为空,则sorry, there is no result在它之间添加
所以a.php,信息将显示:<div id="result"><div …
可能重复:
PHP Curl,提取XML响应
如何用curl php解析器xml?这是我的代码,如何获取xml每个项目的值?谢谢.
<?php
define("EMAIL_ADDRESS", "youlichika@hotmail.com");
$ch = curl_init();
$cv = curl_version();
$user_agent = "curl ${cv['version']} (${cv['host']}) libcurl/${cv['version']} ${cv['ssl_version']} zlib/${cv['libz_version']} <" . EMAIL_ADDRESS . ">";
curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookies.txt");
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookies.txt");
curl_setopt($ch, CURLOPT_ENCODING, "deflate, gzip, identity");
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HTTPGET, TRUE);
curl_setopt($ch, CURLOPT_URL, "http://en.wikipedia.org/w/api.php?action=opensearch&search=tokyo&format=xml&limit=2");
$xml = curl_exec($ch);
curl_close($ch);
var_dump($xml);
?>
Run Code Online (Sandbox Code Playgroud)
XML树
<SearchSuggestion version="2.0">
<Query xml:space="preserve">tokyo</Query>
<Section>
<Item>
<Text xml:space="preserve">Tokyo</Text>
<Description xml:space="preserve">
, officially , is one of the 47 prefectures of …Run Code Online (Sandbox Code Playgroud) 我有一个foreach迭代器,里面有500 group items它.如何删除foreach中的重复值?
foreach ($data as $data) {
if(!empty($data['name'])){ //check if have $data['name']
$name = $data['name'];
$id = $data['id'];
$date = $data['date'];
$link = $data['link'];
if(strpos($link, '.ads.')){
continue; //remove all the link contains `.ads.`
}else{
// if `$link` is not repeat, echo the below data. how to use array_unique, remove all the values which repear in `$link` part?
echo $name;
echo $id;
echo $date;
echo $link;
}
}
Run Code Online (Sandbox Code Playgroud) 我有一些搜索页面链接:www.example.com/search.php?search=search_word,我试图制作一个默认搜索网址.如果人们只www.example.com/search.php通过浏览器输入,请将默认URL设为www.example.com/search.php?search=aaa.我的代码不起作用.
<script src="../jquery.js"></script>
<script>
jQuery(document).ready(function(){
var currneturl = document.URL;
if(!document.URL.indexOf('?')){
document.URL = currneturl + '?search=aaa';
}
});
</script>
Run Code Online (Sandbox Code Playgroud)