无法从php表单插入

时间:2017-03-25 07:49:40

标签: php mysql forms

我试图在这个小组中创建小组和主题,但我不知道为什么我不能插入表单。

我使用2个会话 - 第一个从类别到组,第二个从组到组,1个会话用于用户

我的代码:

Traceback (most recent call last):
  File "./run_training.py", line 87, in <module>
    config=experiment_meta)
  File "/home/moose/GitHub/msthesis-experiments/train/train_keras.py", line 74, in main
    model = model_module.create_model(nb_classes, input_shape)
  File "/home/moose/GitHub/msthesis-experiments/models/densenet.py", line 173, in create_model
    densenet = Model(inputs=model_input, outputs=x, name="create_dense_net")
  File "/usr/local/lib/python2.7/dist-packages/keras/legacy/interfaces.py", line 87, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 1700, in __init__
    str(layers_with_complete_input))
RuntimeError: Graph disconnected: cannot obtain value for tensor Tensor("conv2d_2/convolution:0", shape=(?, 32, 32, 12), dtype=float32) at layer "concatenate_1". The following previous layers were accessed without issue: ['input_1', 'initial_conv2D', 'batch_normalization_1', 'activation_1', 'conv2d_1']

<?php session_start(); include '../_database/database.php'; if(isset( $_POST['topic_button'] )){ $top_name = $_POST['top_name']; $top_about = $_POST['top_about']; $top_pic= $_POST['top_pic']; $groid =$_GET['gro']; $insert = mysql_query("INSERT INTO topics (top_name, top_about, top_pic, top_date, Groups_gro_id, users_user_id, categories_cat_id) VALUES ('$top_name', '$top_about', '$top_pic', 'NOW())','$groid', '".$_SESSION['username']."','".$row['categories_cat_id']."')"); header("Location: ../home.php"); } ?> <form class="form col-md-12 center-block" action="components/ins_topic.php" method="post" autocomplete="off"> <div class="col-lg-6"> <div class="form-group"> <input class="form-control" placeholder="title " name="top_name"> </div> <div class="form-group"> <textarea class="form-control" rows="5" placeholder="post here" name="top_about"></textarea> </div> </div> <div class="col-lg-6"> <div class="form-group"> <input name="top_pic" class="btn btn-primary ladda-button" data-style="zoom-in" type="file"/> </div> <br /><br /><br /><br /> <button type="submit" class="btn btn-default" name="topic_button" data-style="zoom-in" >post</button> </div> </form> 就像链接gro

中的会话一样

有谁知道我为什么不能从表单中插入?

2 个答案:

答案 0 :(得分:0)

您的查询有些错误,因为右括号)。试试这个:

$insert = mysql_query("INSERT INTO topics (top_name, top_about, top_pic, top_date, Groups_gro_id, users_user_id, categories_cat_id) VALUES ('$top_name', '$top_about', '$top_pic', 'NOW()','$groid', '".$_SESSION['username']."','".$row['categories_cat_id']."')");

尝试使用Mysqli

答案 1 :(得分:0)

你应该评论这一行:

extern int optind;
....
optind= 1;

然后它应该告诉你提交表单时出现的错误。此外,打开错误模式:

//header("Location: ../home.php");