我使用 css 创建了一个下拉列表。下拉列表工作完美,打开菜单向下。如何修改以向上(相反方向)打开菜单?制作类似下拉列表的东西。这是我的 html 代码。
<div id="menu">
<ul>
<li><a href="#"> <?php echo $user_data['name']; ?> </a>
<ul>
<li><a href="logout.php">Logout</a></li>
<li><a href="changepassword.php">Change Password</a><li>
<li><a href="settings.php">Settings</a><li>
</ul>
</li>
<li><a href="#"> Profile </a>
<ul>
<li><a href="profile_menu.php">Edit Profile</a></li>
<li><a href="<?php echo $user_data['email']; ?>">View Profile</a></li>
</ul>
</li>
<li><a href="wall.php"> Home </a></li>
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
这是我的 css。
#menu ul{
padding:0px;
margin:0px;
list-style:none;
}
#menu ul li {
float:left;
}
#menu ul li a:hover{
background:#fff;
color:#333;
}
#menu ul li ul{
position:absolute;
height:0px;
overflow:hidden;
}
#menu ul li ul …Run Code Online (Sandbox Code Playgroud) 我试图创建一个像使用Facebook的评论系统.我使用php和jquery.我的代码很完美.用户在textarea,comment_1中写入内容并发布.Comment_1直接出现在textarea下面.如果我刷新页面,我可以在开头看到comment_1.如果我尝试发布新评论(comment_2),则comment_2会在comment_1下显示,而comment_1会在comment_2下显示.例如:
在开始时: comment_1
刷新并发布新评论后:comment_1 / comment_2 comment_1 因此,您可以看到,在刷新页面后,它会将comment_2放在comment_1下面,但也会将comment_1放在它们之上(例如将comment_1保留在"内存"中).如果我刷新页面,我会收到comment_2 comment_1,这是我最终想要的,但是如何在不刷新的情况下执行此操作?这是我的代码:
wall.php
<?php
<script>
$(document).ready(function(){
$("#comment_process").click(function(){
if($("#comment_text").val() != ""){
$.post("comments.php?action=post", { comment: $("#comment_text").val() }, function(data) {
$(".comments").html(data);
$("#comment_text").val("");
});
}
});
});
</script>
<div class="comment_container">
<div class="comment_form">
<textarea id="comment_text" ></textarea>
<input type="button" id="comment_process" value="Post"/>
</div>
</div>
<?php include_once("comments.php");?>
<div class="comments"> </div>
?>
Run Code Online (Sandbox Code Playgroud)
这是comments.php
<?php
function getComments(){
$comments = "";
// use desc order by date in order to display comments by date
$sql = mysql_query("SELECT * FROM comments ORDER …Run Code Online (Sandbox Code Playgroud) 我的PHP脚本中有一个sql语法,给我一个错误.我想要的只是获得2 sql statemet的结果.
$sql1 = " SELECT `name`, `surname`, `email`, `user_id` FROM users WHERE (surname LIKE '$name%' AND name LIKE '$surname%') OR (surname LIKE '$surname%' AND name LIKE '$name%') ";
Run Code Online (Sandbox Code Playgroud)
和
$sql2 = " SELECT profile_id from profile WHERE `country`='uk' ";
Run Code Online (Sandbox Code Playgroud)
我想从我的数据库中获取$ sql1和$ sql2的值.我像这样使用UNION语句,但它没有用.任何想法如何解决它:
$sql = " (SELECT `name`, `surname`, `email`, `user_id` FROM users WHERE (surname LIKE '$name%' AND name LIKE '$surname%') OR (surname LIKE '$surname%' AND name LIKE '$name%')) UNION (SELECT profile_id from profile WHERE `country`='uk' ) ";
Run Code Online (Sandbox Code Playgroud) 我在php中创建了一个应用程序.文件夹"myapp-test-1"有一个名为index.php的文件和一个文件夹CSS,其中包含文件main.css,它是index.php的css文件.我正在尝试创建我的应用程序yaml文件以便上传我的项目在谷歌的应用程序引擎.这是我的app.yaml文件:
application: myapp-test-1
version: 1
runtime: php
api_version: 1
handlers:
- url: /.*
script: index.php
- url: /css
static_dir: css
- url: /css/
script: main.css
Run Code Online (Sandbox Code Playgroud)
在浏览器中测试时,似乎index.php文件未满载.此外,index.php的css不起作用.