NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page SQL error

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 11-16-2005, 02:43 AM THREAD STARTER               #1 (permalink)
Munky Designs
Join Date: May 2005
Posts: 996
Albino is a jewel in the roughAlbino is a jewel in the roughAlbino is a jewel in the rough
 



SQL error


ok hey

im usually ok at finding these, but this one has got me baffled!

Code:
<?php 	include "config.php";
 if(isset($_POST['submit']))
  {//begin of if($submit).
      // Set global variables to easier names
      $type = $_POST['type'];
	  $team = $_POST['team'];
	  $lineup1 = $_POST['lineup1'];
	  $lineup2 = $_POST['lineup2'];
	  $date = $_POST['date'];
	  $time = $_POST['time'];
	  $map = $_POST['map'];
	  $mom = $_POST['mom'];
	  $desc = $_POST['desc'];
	  $score = $_POST['score'];
	  $score_indiv = $_POST['score_indiv'];
	  $outcome = $_POST['outcome'];
	  
              //check if (title) field is empty then print error message.
              if(!$team){  //this means If the title is really empty.
                     echo "Error: Matches Need to be played against someone!";
                     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 matches (match_type, team, lineup1, lineup2, date, time, map, mom, desc, score, score_indiv, outcome)
		 VALUES ('$type', '$team', '$lineup1', '$lineup2', '$date', '$time', '$map', '$mom', '$desc', '$score', '$score_indiv', '$outcome')",$connect) or die(mysql_error());
          //print success message.
          echo "<b>Thank you! Match added Successfully!<br>You'll be redirected to Home Page after (4) Seconds";
          echo "<meta http-equiv=Refresh content=4;url=matches_edit.php>";
  }//end of if($submit).


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

      ?>
<html>
<head>
<title>B.O.M.|Barrel Of Munkys</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" style="text/css"
href="../bomstyle.css" />
</head>

<body leftmargin="20" topmargin="20" marginwidth="20" marginheight="20">
<table width="700" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td class="title" colspan="2"><p><img src="../table/Banner2.jpg" width="700" height="150"></p>
      </td>
  </tr>
  <tr> 
    <td align="right" valign="top" class="menu"> 
      <? include("http://localhost/BOM/admin/adminlinks.htm") ?>
    </td>
	<td valign="top">
	
<table width="100%" cellpadding="0" cellspacing="0">
	    <tr> 
          <td height="66" valign="top" class="contenttop"><img src="../table/admin.gif" width="510" height="50"></td>
	</tr>
	    <tr> 
          <td height="33" valign="top" background="../table/main_mid.gif" class="mid">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
              <table width="357" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr> 
                  <td width="95" height="31">Team: </td>
                  <td width="262"><input name="team" size="40" maxlength="255"></td>
                </tr>
                <tr> 
                  <td height="34">Type of Match: </td>
                  <td><select name="type">
                      <option value="ED">Enemy Down</option>
                      <option value="PCW">PCW</option>
                    </select></td>
                </tr>
				<tr> 
                  <td width="95" height="31">Date: </td>
                  <td width="262"><input name="date" size="40" maxlength="255"></td>
                </tr><tr> 
                  <td width="95" height="31">Time: </td>
                  <td width="262"><input name="time" size="40" maxlength="255"></td>
                </tr><tr> 
                  <td width="95" height="31">Map: </td>
                  <td width="262"><input name="map" size="40" maxlength="255"></td>
                </tr><tr> 
                  <td width="95" height="31">Man Of The Match: </td>
                  <td width="262"><input name="mom" size="40" maxlength="255"></td>
                </tr>
                <tr> 
                  <td valign="top">Description: </td>
                  <td><textarea name="desc" rows="7" cols="30"></textarea></td>
                </tr>
				<tr> 
                  <td width="95" height="31">Score: </td>
                  <td width="262"><input name="score" size="40" maxlength="255"></td>
                </tr>
				<tr> 
                  <td width="95" height="31">Idividual round scores: </td>
                  <td width="262"><input name="score_indiv" size="40" maxlength="255"></td>
                </tr>
				<tr> 
                  <td width="95" height="31">Outcome: </td>
                  <td width="262"><input name="outcome" size="40" maxlength="255"></td>
                </tr>
                <tr> 
                  <td colspan="2"><div align="center"> 
                      <input type="submit" name="submit" value="Add Match">
                    </div></td>
                </tr>
              </table>
</form>
          </td>
	</tr>
	<tr>
	    <td class="contentbottom"  valign="top"><img src="../table/main_bottom.gif" width="510" height="50"></td>
	</tr>
</table>
	
	</td>
  </tr>
</table>
</body>
</html>
<?
}
?>
Error:
????: NamePros.com http://www.namepros.com/programming/140429-sql-error.html

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 'desc, score, score_indiv, outcome) VALUES ('PCW', '{UK}', ''


if anyone can help fix the error, 30NP$ is available
????: NamePros.com http://www.namepros.com/showthread.php?t=140429

cheers
Albino is offline  
Old 11-16-2005, 05:27 AM   #2 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
your best bet would be to exho out the SQL so that you can see exactly what it looks like.
Peter is offline  
Old 11-16-2005, 08:47 AM THREAD STARTER               #3 (permalink)
Munky Designs
Join Date: May 2005
Posts: 996
Albino is a jewel in the roughAlbino is a jewel in the roughAlbino is a jewel in the rough
 



im not sure what that means sorry, lol

in simpler terms, im still pretty new to php and mysql
Albino is offline  
Old 11-16-2005, 01:34 PM   #4 (permalink)
NamePros Regular
 
moondog's Avatar
Join Date: Jun 2004
Posts: 587
moondog is a name known to allmoondog is a name known to allmoondog is a name known to allmoondog is a name known to allmoondog is a name known to allmoondog is a name known to allmoondog is a name known to allmoondog is a name known to all
 



You have 'desc' as a field name. This is a no-no as it is a reserved word in SQL.

Try renaming the field to 'descrip' and alter your SQL accordingly.

-Bob
__________________
Can't wait to be out of this forsaken business. Getting close! :)
moondog is offline  
Old 11-16-2005, 02:27 PM THREAD STARTER               #5 (permalink)
Munky Designs
Join Date: May 2005
Posts: 996
Albino is a jewel in the roughAlbino is a jewel in the roughAlbino is a jewel in the rough
 



once again you have come to my rescue moondog

Legend
Albino is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
DB Error: Bad SQL Query: DELETE FROM 4images_sessionvars WHERE session_id NOT IN ... none1983 Programming 8 06-02-2005 12:41 PM
Connecting to your SQL Database using Enterprise Manager priyanka[imported] Web Hosting Discussion 1 12-07-2004 04:21 PM
Connecting to your SQL Database using Enterprise Manager priyanka[imported] Webmaster Tutorials 0 12-06-2004 09:58 PM
HELP!!!!!! DB Error? Bad SQL Query? logos The Break Room 5 08-25-2004 08:48 PM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 11:30 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger