草庐IT

insert-query

全部标签

php - wp_insert_post 带有表单

'$post-title','post_content'=>'$post-content','post_status'=>'publish','post_author'=>$user_ID,);if(isset($submitted)){wp_insert_post($new_post);}?>我在没有表格的情况下对其进行了测试,它运行良好。但出于某种原因,我似乎无法让它与表格一起工作。有什么想法吗?还有什么应该在表单的操作中进行?感谢您的帮助。 最佳答案 这应该有效。'','post_author'=>$user->ID,'pos

php - wp_query 中的分页

这可能很简单,但我无法弄明白。我已经搜索了几个小时,但我的情况没有运气。我需要分页才能使用my_query'4','post_type'=>'portfolio'));$grid_class='grid_3';$desired_width=220;$desired_height=190;$terms=get_terms('portfolio_categories');$count_terms=count($terms);?>//somephpcodehave_posts()):$wp_query->the_post();//querythe"portfolio"custompostty

php - WordPress:如何使用 query_posts 返回元数据?

我正在使用admin-ajax.php执行AJAX请求,据此我根据选中的复选框过滤帖子。它工作得很好,尽管我正在努力寻找一种方法来返回每个帖子的元详细信息。我只是使用query_posts来获取我的数据,如下所示:functionajax_get_latest_posts($tax){$args=array('post_type'=>'course','tax_query'=>array(array('taxonomy'=>'subject','field'=>'slug','terms'=>$tax)));$posts=query_posts($args);return$posts;

php - 如何在 PHP 中使用 mysqli_query()?

我正在用PHP编写代码。我有以下mySQL表:CREATETABLE`students`(`ID`int(10)NOTNULLAUTO_INCREMENT,`Name`varchar(255)DEFAULTNULL,`Start`int(10)DEFAULTNULL,`End`int(10)DEFAULTNULL,PRIMARYKEY(`ID`))ENGINE=InnoDB;我正在尝试使用mysqli_query在PHP中描述表的函数。这是我的代码:$link=mysqli_connect($DB_HOST,$DB_USER,$DB_PASS,$DATABASE);$result=my

php - 调用未定义的方法 Illuminate\Database\Query\Builder

我是laravel4的新手,在尝试了解DB类中的某些方法时不断遇到同样的错误。CalltoundefinedmethodIlluminate\Database\Query\Builder我在尝试使用“->or_where”、“->order_by”时遇到同样的错误。另一个问题是解析动态方法:->where_name("test")变成`users`where`_name`=test)但如果我尝试这样做->wherename("test")那么一切都很好。 最佳答案 您对orWhere和orderBy使用了错误的语法。这是orWher

php - 为什么 $wpdb->insert_id 和 mysql_insert_id() 最后返回一个额外的 '1'?

我需要检索上次查询的AUTO_INCREMENT值的ID。我的查询是这样的:$result=$wpdb->query($wpdb->prepare("INSERTINTO$table_name(name,season,copyright,description,path)VALUES(%s,%s,%s,%s,%s)",$galleryData['name'],$galleryData['season'],$galleryData['copyright'],$galleryData['description'],$galleryData['path']));//Let'soutputth

php - mysql_query() 期望参数 1 为字符串,给定资源

所以我的代码是这样的..$num_rows;if($num_rows){echo"usernamealreadyexist";}else{$query="INSERTINTOtb_funcionario(nome_funcionario,username,password)VALUES('$_POST[nome_funcionario]','$_POST[username]','$_POST[password]')";;$result=mysql_query($query)ordie(mysql_error());}mysql_query($query);mysql_close($bd

php - 如何删除 https ://from URL and insert http://instead of it in string in PHP?

首先,我需要检查URL字符串,如果URL的协议(protocol)是https,那么我需要替换PHP中的http。所以这个php函数的输入和输出必须是这样的:Input->https://example.com/example/https.phpOutput->http://example.com/example/https.phpInput->http://example.com/example/https.phpOutput->http://example.com/example/https.php 最佳答案 这将确保它位于字符

php - mysqli 和 multi_query 不工作

multi_query($query)){do{if($result=$mysqli->store_result()){while($row=$result->fetch_row()){printf("%s\n",$row[0]);}$result->free();}if($mysqli->more_results()){print("-------------------------------");}}while($mysql->next_result());}$mysqli->close();?>它不起作用..它不会转到第一个if条件来标识它是否是多查询..我还有其他问题,..为

php - 跟踪点 : insert or update?

关闭。这个问题是off-topic.它目前不接受答案。想改进这个问题吗?Updatethequestion所以它是on-topic用于堆栈溢出。关闭11年前。Improvethisquestion我正在为我的应用程序添加一个积分系统,用户执行的每项操作(注册、投票、评论等)都会获得积分。由于这是一个相当普遍的功能,我想了解一下其他人是如何实现他们的积分系统的。更具体地说,在跟踪点时,无论您是在点表中进行新插入,然后在需要总数时只进行SUM,还是在为每个用户更新单个条目。哪些关键因素会以某种方式影响决策,权衡取舍是什么?凭直觉,由于插入通常比更新便宜,我认为插入是假设每个用户的平均点数不