基本上,正在使用php和MySQL.我是初学者.
我要做的是将用户注册到我的数据库,因此将表单输入存储到我的users_tb.
尝试将值插入表单时出现此错误:
"列数与第1行的值计数不匹配"
我以为是因为我没有插入user_id值(这是自动增量),所以我尝试在我的查询中插入''用于user_id,但仍然没有运气.
这是查询:
$query = "INSERT INTO users_tb (user_id, user_status, user_gender, user_firstname, user_surname, student_number,
user_email, user_dob, user_name, user_pass)
VALUES('','$status','$gender','$firstname','$surname','$hnumber','$dob','$username','$password')";
mysql_query($query) or die(mysql_error());
mysql_close();
Run Code Online (Sandbox Code Playgroud)
这是否有帮助.如果您需要任何其他代码,请说.
只是为了确保,插入不必是表中字段的顺序相同吗?
非常感谢,
我试图在我的 Spring Boot 应用程序中使用 Tomcat 的重写阀,但是无法确定将 rewrite.conf 放在哪里才能成功加载。
我将 Spring Boot 2.0.3.RELEASE 与 Tomcat 8.5.31 一起使用,并将应用程序打包为一个胖 jar。
我已经像这样配置了重写阀:
@Bean
public TomcatServletWebServerFactory containerFactory() {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
factory.addContextValves(new RewriteValve());
return factory;
}
Run Code Online (Sandbox Code Playgroud)
但是,它似乎依赖 /WEB-INF 的目录结构来加载 rewrite.conf,这是一个胖 jar,我目前没有。
有没有人找到一个解决方案来配置这个,而无需将应用程序打包结构更改为带有 WEB-INF 目录的 WAR?
基本上,我的目标是允许我的用户指定用于访问测试的ip范围.所以我们假设这些值存储在我的数据库中:
来自:148.197.34.112
致:148.197.34.255
是否有任何功能可用于将这些IP地址转换为数字进行比较?
很明显,如果用户试图加载页面......如果他的IP不在ip范围内,请重新指导它们.
提前致谢 :)
我目前构建一个id数组并使用implode查询此数组,如下所示:
$sql = "SELECT * FROM item_bank_tb WHERE item_id IN(" . implode(',', $ids) . ")";
数组$ids
的构造方式使得id按特定顺序排列.但是,此查询的结果不是按此顺序.我猜测它们都在一个查询中,结果按照它们所在的顺序(升序)出现.
有办法解决这个问题吗?(除了包括我可以ORDER BY的字段)
非常感谢.
编辑:我已经编辑了帖子以澄清我的问题,现在我自己,有更多的理解.
实际上,正如标题所说,我JTextArea
在我的GUI中尝试输出控制台,同时执行应用程序的任务.
这是我目前正在做的事情:
public class TextAreaOutputStream extends OutputStream
{
private final JTextArea textArea;
private final StringBuilder sb = new StringBuilder();
public TextAreaOutputStream(final JTextArea textArea)
{
this.textArea = textArea;
}
@Override
public void flush()
{
}
@Override
public void close()
{
}
@Override
public void write(int b) throws IOException
{
if (b == '\r')
return;
if (b == '\n')
{
final String text = sb.toString() + "\n";
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
textArea.append(text);
}
});
sb.setLength(0); …
Run Code Online (Sandbox Code Playgroud) 基本上这段时间的东西让我感到沮丧,我是编程的新手,所以如果我问一个愚蠢的问题我会道歉.
我有一个MySQL时间()存储在我的数据库中.我想将此时间添加到当前时间以建立目标时间.
$ duration是06:00:00.(MySQL时间)
$length = strtotime($duration);
$timestart = time();
$target = $length + time();
// merely to check if im getting correct values.
echo "</br>duration: ".date('G:i:s', $length)."<br/>";
echo "current time:".date('G:i:s', $timestart)."<br/>";
echo "target time:".date('G:i:s', $target)."<br/>";
Run Code Online (Sandbox Code Playgroud)
目前我得到了这个(不是6小时增加):
持续时间:6:00:00
当前时间:15:51:44
目标时间:19:51:44
有人可以帮我解释一下.
非常感谢,
所以目前使用带有JQuery .post的ajax来返回一个填充了一些值的表单.我想要做的是基本确定内容是否包含使用的复选框:
var count = $('#form').find('checkbox').length;
alert(count);
Run Code Online (Sandbox Code Playgroud)
但是,即使它确实包含复选框,输出也是0.所以我的语法是错误的还是与复选框不在原始DOM中的事实有关?
非常感谢,
对于任何熟悉Activiti的开发人员,基本上我正在寻找的东西,目前我在他们的产品用户指南中找不到,是否存在事件,就像其他启动任务事件监听器或结束任务事件监听器一样,是一个监听器,在更新过程变量时触发?所以任务正在进行中,我想对其中一个过程变量的状态发生变化做出反应.
有人知道OOTB产品是否可行吗?
所以我想:
上传一个csv文件,其中包含一个学生编号列表,每行一个(每行392232).
用学生编号填充一个数组(因为我已经有一个进程代替从一组学生数字中查找id并存储等等,如果他们要手动添加学生)
我一直在寻找这里的教程.
但是我对此有点困惑:
if(isset($_FILES['csv_file']) && is_uploaded_file($_FILES['csv_file']['tmp_name'])){...
他'tmp_name'
从哪里建立?
无论如何,如果有人能解释我应该怎么做,我会很感激帮助.
非常感谢,
编辑:增加了它不工作的进度.
if(isset($_POST['csv_submit'])){
if(isset($_FILES['csv_file']) && is_uploaded_file($_FILES['csv_file']['tmp_name'])){
//upload directory
$upload_dir = "/ece70141/csv_files/";
//create file name
$file_path = $upload_dir . $_FILES['csv_file']['name'];
//move uploaded file to upload dir
// GETTING THE ERROR BELOW.
if (!move_uploaded_file($_FILES['csv_file']['tmp_name'], $file_path)) {
//error moving upload file
echo "Error moving file upload";
}
print_r($_FILES['csv_file']);
//delete csv file
unlink($file_path);
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个格式为String的字符串hh:mm:ss
.这是一个电话通话的持续时间.
我希望在几秒钟内得到该通话的持续时间.
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("hh:mm:ss");
LocalDateTime time = LocalDateTime.parse(timeStr, formatter);
Run Code Online (Sandbox Code Playgroud)
如何从LocalDateTime获取持续时间(以秒为单位)?
php ×6
mysql ×5
java ×3
activiti ×1
ajax ×1
file-upload ×1
ip-address ×1
jquery ×1
jtextarea ×1
spring ×1
spring-boot ×1
subnet ×1
swing ×1
time ×1
tomcat8 ×1