NameSilo

Mysql error

Spaceship Spaceship
Watch

Albino

Munky DesignsEstablished Member
Impact
17
ok, in making ym site, i get this error :

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Sxx', 'Satans', '7:00', '£4', 'Over 18s only!')' at line 2

The code for my page is :

PHP:
<?php include("incfiles/config.php") ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php include "title.php" ?>
<table border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="200" rowspan="101"> 
      <?php include "incfiles/leftmenubar.php" ?>
    </td>
    <td width="59" height="50"><img src="menubar/topleft.gif" ></td>
    <td width="480" colspan="2" background="menubar/topmid.gif"> </td>
    <td width="59" height="50"><img src="menubar/topright.gif"></td>
    <td width="200" rowspan="101"> 
      <?php include "incfiles/rightmenubar.php" ?>
    </td>
  </tr>
  <tr> 
    <td background="menubar/midleftlight.gif" width="59"> </td>
    <td width="240" bgcolor="#69ABFF">Add News</td>
    <td width="240" bgcolor="#69ABFF"> </td>
    <td background="menubar/midrightlight.gif" width="59"> </td>
  </tr>
  <tr> 
    <td background="menubar/midleft.gif" width="59"> </td>
    <td width="480" colspan="2" bgcolor="#0078C7">
<?php
	 if(isset($_POST['submit']))
  {//begin of if($submit).
      // Set global variables to easier names
      $headliner = $_POST['headliner'];
	  $bands = $_POST['bands'];
      $venue = $_POST['venue'];
      $time = $_POST['time'];
	  $price = $_POST['price'];
	  $other = $_POST['other'];
              //check if (title) field is empty then print error message.
              if(!$headliner){  //this means If the title is really empty.
                     echo "Error: Headliner is a required field. Please fill it.";
                     exit(); //exit the script and don't do anything else.
              }// end of if

         //run the query which adds the data gathered from the form into the database
		 $result = mysql_query("INSERT INTO upgigs (headliner, bands, venue, time, price, other)
		 				VALUES ('$headliner', $bands', '$venue', '$time', '$price', '$other')",$connect) or die(mysql_error());
        // $result = mysql_query("INSERT INTO up (title, author, dtime, text1, text2)
                       // VALUES ('$title', '$author', NOW() , '$text1','$text2')",$connect) or die("Error Adding Gig");
          //print success message.
          echo "<b>Thank you! Gig added Successfully!<br>You'll be redirected to Home Page after (4) Seconds";
          echo "<meta http-equiv=Refresh content=4;url=index.php>";
  }//end of if($submit).


  // If the form has not been submitted, display it!
else
  {//begin of else

      ?>
      <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">

      Headliner: <input name="headliner" size="40" maxlength="255">
      <br>
	  Other Bands: <textarea name = "bands" rows="7"  cols="30"></textarea>
	  <br>
      Venue: <input name="venue"   size="30">
      <br>
      Time: <input name="time"  size="30">
      <br>
	  Price: <input name="price" size="20">
	  <br>
	  Other: <textarea name="other" rows="7" cols="40"></textarea>
	  <br>
      <input type="submit" name="submit" value="Add Gig">
      </form>
      <?
  }//end of else
?>
  </td>
    <td background="menubar/midright.gif" width="59"> </td>
  </tr>
  <tr> 
    <td width="59" height="50"><img src="menubar/bottomleft.gif"></td>
    <td width="479" colspan="2" background="menubar/bottommid.gif"> </td>
    <td width="59" height="50"><img src="menubar/bottomright.gif"></td>
  </tr>
  <tr> 
    <td colspan="4"> </td>
  </tr>
  <tr> 
    <td colspan="4">
      <?php include "incfiles/footer.php" ?>
    </td>
  </tr>
</table>

</body>
</html>

i have no idea about this error, none of my other mysql bits like this make it, and ive checked and rechecked the syntax, but i stil cant see any difference.

cheers if anyone can help!
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
.US domains.US domains
Replace
Code:
                       VALUES ('$headliner', $bands', '$venue', '$time', '$price', '$other')",$connect) or die(mysql_error());

With
Code:
                      VALUES ('$headliner', '$bands', '$venue', '$time', '$price', '$other')",$connect) or die(mysql_error());

Shouldn't $bands' be '$bands' ?
 
0
•••
no way!

haha, i spent over an hour looking at that, and i i changed that once as well, must have forgot to save it

cheers legend, 5$ on way to you
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back