PHP表单/Mysql插入不工作
嘿,我正试图通过表单在表中添加一些数据。PHP表单/Mysql插入不工作,php,mysql,insert,Php,Mysql,Insert,嘿,我正试图通过表单在表中添加一些数据。 但是表单不工作或者我的PHP代码有问题 这是HTML <form action="upload.php" method="post" enctype="multipart/form-data" name="subform" id="subform" class="forms" role="form" > <label> <input name="title" id="
但是表单不工作或者我的PHP代码有问题 这是HTML
<form action="upload.php" method="post" enctype="multipart/form-data" name="subform" id="subform" class="forms" role="form" >
<label>
<input name="title" id="title" type="text" class="form-control" placeholder="put the title here">
</label>
<label>
<input name="singer" id="singer" type="text" class="form-control" placeholder="Artist / Band">
</label>
<label>
<input name="songname" id="songname" type="text" class="form-control" placeholder="Song Name">
</label>
<label>
<input name="lyrics" id="lyrics" type="text" class="form-control" placeholder="Lyrics">
</label>
<label>
<input name="arrange" id="arrange" type="text" class="form-control" placeholder="Arrangement By ?">
</label>
<label>
<input name="channel" id="channel" type="text" class="form-control" placeholder="Channel">
</label>
<label>
<input name="dllink" id="dllink" type="text" class="form-control" placeholder="Download Link">
</label>
<label>
<select name="category" id="category" class="form-control">
<option>Pop</option>
<option>Rock</option>
<option>Rap</option>
<option>Classic</option>
</select>
</label>
<label><input name="cover" id="cover" type="file" class="form-control"
placeholder="Cover"></label>
<div class="submit-btn">
<input type="submit" class="Btn_submit" id="submit" name="button" />
</div>
</form>
你知道我做错了什么吗?
我以前做过,没有任何问题。但是这次我好像忘记了什么。您的SQL查询中有一个语法错误:
',$arrange'
缺少一个”
您可以通过运行echo mysql_error()检查SQL错误代码>在查询之后
旁注:您正在使用的mysql.*
函数已被弃用,将从未来的PHP版本中删除。您的代码将停止工作。如果编写新代码,请使用mysqli\uu*
函数或PDO。您尚未将连接变量传递给mysql\u查询函数
如果您通过其他方式获得连接,请执行以下操作并查看:
只需打印整个post数组,就可以看到缺少的任何内容。
还可以打印文件数组,查看是否存在文件和错误。显示的错误是什么?mysql\u query()的连接参数是可选的。
。
',$arrange'