这是一个学习者.这必须是安逸的,但我无法弄清楚.
我有这样一张桌子:
ID -- NAME -- CHOICE
1 -- John -- book
2 -- Matt -- pen
3 -- Linda -- bag
.
.
Run Code Online (Sandbox Code Playgroud)
将CHOICE列中的所有数据转换为null的脚本是什么?
万分感谢
我怎样才能做到这一点
select * from theuser where userid=1233 and active != 1
Run Code Online (Sandbox Code Playgroud)
用正确的MySQL语法?
active可以是NULL,0或者1我需要的是active等于NULL或0永远不等于1.
我正在做:
$fb = "http://www.facebook.com/sharer.php?t=".$title."&u=".$url;
Run Code Online (Sandbox Code Playgroud)
该行在while循环中获取数据库的结果.$ url始终是相同的,但$ title会根据行而更改.
现在我构建链接,当我点击它们时,它们总是显示在我的墙上
<meta name="title" content=''>
Run Code Online (Sandbox Code Playgroud)
我的主页上的文字而不是$ title文字.
我该怎么做才能解决这个问题并分享$ title中包含的文字?
这里的代码我正在尝试og.点击链接后,我的Wall中的共享文本是"Google",而不是我的变量中的内容:
<?php
$tt = "Some text in the meta";
$url_p = "http://www.google.com";
$url = urlencode($url_p);
$text = "Text I want to show";
$title = urlencode($text);
$fb = "http://www.facebook.com/sharer.php?t=".$title."&u=".$url;
?>
<meta property="og:title" content="<?php echo $tt; ?>"/>
<a href="<?php echo $fb; ?>">share link</a>
Run Code Online (Sandbox Code Playgroud) 我有以下Mysql'test'表:
id -- number
1 -- 2
2 -- 33
3 -- 32
4 -- 162
5 -- 42
6 -- 142
7 -- 113
8 -- 12
Run Code Online (Sandbox Code Playgroud)
将字段'number'中的所有值都变为0的查询是什么?
我正在尝试一种重置.
万分感谢!
我在函数内部有这个结构:
INSERT INTO @TheTable
SELECT DISTINCT
@Number AS Number,
@Name AS Name
FROM MYTABLE
WHERE id = @id
Run Code Online (Sandbox Code Playgroud)
我需要在这个结构中添加执行另一个函数的结果,我需要你的帮助才能这样做.
在@Name AS Name下面,我应该添加这样的东西
IF (dbo.anotherFunction(@id)==1)
@NewVisitor AS NewVisitor
ELSE
@NewVisitor AS NoNewVisitor
Run Code Online (Sandbox Code Playgroud)
我怎样才能将其翻译成TSQL?
太感谢了!
这是一个php新手.下面是我用来构建登录系统以输入mypage.php的代码
它工作得很好但很天真,任何人都可以在网址中键入mypage.php并避开登录页面.我怎样才能使它更安全?
非常感谢!
if(isset($_POST['submit'])) {
$user = $_REQUEST['user'];
$pass = $_REQUEST['pass'];
$sql = "SELECT * FROM login WHERE user='".$user."'";
$res = $this->new_db->select($sql);
$row = $this->new_db->get_row($res);
if (isset($row)) { //user exists?
if($row["pass"] == $pass){
$_SESSION['userId'] = $row['user'];// TRYING WITH SESSIONS
header("Location: mypage.php");
} else {
echo "wrong pass";
}
} else {
echo "user does not exist";
}
}
Run Code Online (Sandbox Code Playgroud)
然后在mypage.php中
if(isset($_SESSION['userId'])) {
//contents
} else {
echo "there's an error";
}
Run Code Online (Sandbox Code Playgroud)
它打印"有一个错误"为什么?非常感谢
在处理MySQL表时第一次遇到这个问题.
我在表格中插入条形码.如果该栏被称为"Tim's Bar"并且我立即将其插入,则会收到错误并且未插入数据.
你怎么正确地在桌子上?
我有:
echo"<br>";echo"<br><pre>";print_r($array2);echo"</pre>";
echo"<br>";echo"<br><pre>";print_r($array3);echo"</pre>";
echo"<br>";echo"<br><pre>";print_r($array4);echo"</pre>";
Run Code Online (Sandbox Code Playgroud)
我需要将所有这些print_r打印保存到文件中(不会在页面中出现任何内容).
我知道我需要做那样的事情:
$f = fopen("file.txt", "w");
fwrite($f, "TEXT TO WRITE");
fclose($f);
Run Code Online (Sandbox Code Playgroud)
但我不知道如何将内容放在其中.
Thansk一百万
PHP由于数组循环,我陷入了自我学习的困境.
假设我有两个arrays相同数量的元素:
$description
: array =
0: string = Name
1: string = LastName
2: string = Address
3: string = City
4: string = Country
$value
: array =
0: string = Dan
1: string = Smith
2: string = 4, Burlington St
3: string = London
4: string = England
Run Code Online (Sandbox Code Playgroud)
我该怎么做才能打印以下内容?:
姓名:Dan
姓氏:Smith
地址:4,Burlington St
城市:伦敦
国家:England