我有一个包含大量单词的数据库,但我想只选择那些字符长度等于给定数字的记录(在例3中):
$query = ("SELECT * FROM $db WHERE conditions AND length = 3");
Run Code Online (Sandbox Code Playgroud)
但这不起作用...有人能告诉我正确的查询吗?
$string = "<tag>i dont know what is here</tag>"
$string = str_replace("???", "<tag></tag>", $string);
echo $string; // <tag></tag>
Run Code Online (Sandbox Code Playgroud)
那么我在寻找什么代码?
我有一个大型数据库,其中包含有<a>标签的记录,我想删除它们.当然有一种方法,我创建一个PHP脚本,选择所有,使用strip_tags和更新数据库,但这需要很长时间.那么如何使用简单(或复杂)的MySQL查询来完成这项工作呢?
<form name='qform'>
<textarea name='q' rows='3' cols='60' wrap='hard' id='q' onkeydown="if (event.keyCode == 13) document.getElementById('clickit').click()"></textarea>
<input type='button' value='search' id='clickit' onclick="get();">
</form>
Run Code Online (Sandbox Code Playgroud)
我有这个表单...它没有提交按钮,因为我使用的是jquery,在这个表单下面是一个显示结果的div区域.它是一个搜索引擎,没有输入框,而是有一个textarea.这是因为它将是一个多字搜索者.
问题是,如果我按回车键,查询就会被提交,一切正常......但是对textarea的关注会下降一行,这对我来说是一个问题.
基本上我希望输入只有一个函数(提交)结束其他任何东西.
这个想法很简单:你在textarea中输入一个文本按"发送"并返回重复短语的列表.短语我的意思是两个或更多的单词重复.我的问题是我不知道如何检测这些(我可以单个单词).
$(function() {
$("#but").click(function() {
var get = $("#inc").val();
$("#res").html(get);
return false;
});
});
Run Code Online (Sandbox Code Playgroud)
和HTML:
<form action="" method="POST">
<textarea name="inc" id="inc" spellcheck="false"></textarea> <br>
<input type="submit" id="but" value="Send">
</form>
<div id="res"></div>
Run Code Online (Sandbox Code Playgroud)
问题当然是我甚至不知道从哪里开始.任何想法?
例:
巴黎是法国首都和人口最多的城市.巴黎和巴黎地区占法国国内生产总值的30%以上,是世界上最大的城市GDP之一.
如果字符串以大写字母开头,如果第一个字母可能不在AZ范围内,而且来自其他语言,如果第一个字符不是数字,那么如何检查字符串是否以大写字母开头?
例子:
"This is string" - match
"this is string" - not match
"5 not good" - not match
"??????? starts capital" - match
"?????????? no capital" - not match
Run Code Online (Sandbox Code Playgroud)
在PHP中:
if (preg_math('/??/i', $str) ) {
echo 'yeeee haaa';
}
Run Code Online (Sandbox Code Playgroud) 你在下面看到的是我脚本的一部分.
问题是我只需要重新调整大小的拇指图像而不是原始文件.如果未上传图像,则图像不会重新调整大小,因此该过程应如下所示:
现在这最后一部分(删除)不起作用.我收到此错误:
PHP警告:unlink($ target_file)[function.unlink]:在X行的/path/file.php中没有这样的文件或目录
它找不到它!
if (isset($_REQUEST['Submit'])) {
mkdir($dirloc, 0755, true);
$i1=$_FILES['image']['name'];
$nw1="$dirloc/".$i1;
if ($i1) {
$copy1 = copy($_FILES['image']['tmp_name'], $nw1);
}
$fileName = $_FILES["image"]["name"];
$kaboom = explode(".", $fileName);
$fileExt = end($kaboom);
function ak_img_resize($target, $newcopy, $w, $h, $ext) {
list($w_orig, $h_orig) = getimagesize($target);
$scale_ratio = $w_orig / $h_orig;
if (($w / $h) > $scale_ratio) {
$w = $h * $scale_ratio;
} else {
$h = $w / $scale_ratio;
}
$img = ""; …Run Code Online (Sandbox Code Playgroud) 我想删除所有不在两个字母之间的空格:
$string = " bah bah bah bah ";
$string = str_replace("/w /w", "+", $string);
// what goes here? to get this:
$string = "bah+bah+bah+bah";
Run Code Online (Sandbox Code Playgroud)
我的想法是,我想摆脱所有不必要的空间(不仅在开头和结尾).这不是一个链接,但对于一个搜索框,提交时会爆炸,所以+甚至可以是=或任何基本的东西
$textone = "pate"; //$_GET
$texttwo = "tape";
$texttre = "tapp";
if ($textone ??? $texttwo) {
echo "The two strings contain the same letters";
}
if ($textone ??? $texttre) {
echo "The two strings NOT contain the same letters";
}
Run Code Online (Sandbox Code Playgroud)
if我在寻找什么样的陈述?
好的,这是一个调查,其中div就像你在Facebook上看到的那样是图表.
基本上:
<div style='border:1px solid black;width:300px;'>
<div style='width:100px;???'>This text is longer than the inner div tag.</div>
</div>
Run Code Online (Sandbox Code Playgroud)
...但我希望文本不要破坏并直接通过div.有人可以帮我这个吗?