duanchendu69495 2017-03-16 23:20
浏览 287


I'm new here and have recently started studying various forms of code to create simple solutions to my various projects. I've used many of the helpful tips a lot of you have posted on this website but I think I have finally reached a point where I can't figure out for the life of me how to fix. So I decided to turn to you all for help. It seems like it should be a simple solution to me but I cannot find it so maybe fresh eyes will help. So here it is I hope someone may be able to assist me. I help run an event here in my city that uses the video game Rock Band for karaoke purposes. I have a table setup called rbn_setlist_small that has two columns of 'Artist' and 'Song Title'. I have to periodically insert more songs into the table to account for newly purchased songs. So I created a form to insert the data into the table. It's a Simple form that has two fields Artist and Song Title. Whenever I enter test information (say Artist: 123, Song Title: test) it says the data has been entered but when I go and check the table the new data that has been entered just has a blank spot under Artist and Title under Song Title. So I'm sure I'm missing a comma or something somewhere but I cannot find it.

This is the php for the form:

/* Attempt MySQL server connection.*/
$link = mysqli_connect("host", "user", "pass", "db");

/*Check connection*/
if (mysqli_connect_errno()) {
    printf("Connect failed: %s
", mysqli_connect_error());

/*attempt insert query execution*/
$query = "INSERT INTO `rbn_setlist_small`(`Artist`, `Song Title`) 

VALUES ('$Artist', '$Song Title')";
if ($result = mysqli_query($link, $query)) {
    echo "Records added successfully.";
} else{
    echo "ERROR: Could not execute $sql. " . mysqli_error($link);

/*close connection*/

and this the HTML for the form:

<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Add Music to Database</title>
<form action="insert.php" method="post">
        <label for="Artist">Artist:</label>
        <input type="text" name="Artist" id="Artist">
        <label for="Song Title">Song Title:</label>
        <input type="text" name="Song Title" id="Song Title">
    <input type="submit" value="Submit">

Also any assistance in my coding is appreciated I'm a super novice. Thank you all for any assistance.

  • 写回答



      相关推荐 更多相似问题


      • ¥40 这下真学不懂了,Java没学到这里弄不懂了
      • ¥15 Python不使用Selenium怎么实现网页输入和点击
      • ¥50 vue百度地图导致浏览器崩溃
      • ¥15 请问这段C语言代码应该如何修改呢
      • ¥20 Latex 转入带数式的曲线图后数式部分报错
      • ¥15 Arcgis基于一幅栅格提取另一幅栅格单元值
      • ¥15 Verilog数据产生器代码疑点
      • ¥15 电脑部分网页无法访问是为什么?
      • ¥15 如何在vscode导出pdf失败了,拓展也安装了?
      • ¥15 使用python-kivy如何点击按钮选择手机相册中的图片?