bugging error:S

Discussion in 'PHP' started by anthonyr, Nov 20, 2008.

  1. #1
    hey all... each time i try my article script, i get this erro:S please can anyone help? 10x in advance...


    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 '2008f' 2008 09:14:09 PM')' at line 1
     
    anthonyr, Nov 20, 2008 IP
  2. Tarkan

    Tarkan Peon

    Messages:
    491
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It seems like you have too many quotes, why dont you post your code and SQL statements?
     
    Tarkan, Nov 21, 2008 IP
  3. eric90

    eric90 Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Maybe you used a symbol that's supposed to be escaped but you didn't escape it?

    If you don't post the code, it's really hard to debug...
     
    eric90, Nov 21, 2008 IP
  4. anthonyr

    anthonyr Peon

    Messages:
    15
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    well here's my whole code:



    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <!--
    Design by Free CSS Templates
    http://www.freecsstemplates.org
    Released for free under a Creative Commons Attribution 2.5 License
    -->
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>LebPb.com - Anything You need to know about Lebanese Paintball...</title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <link href="default.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    <!--
    .style1 {color: #FF0000}
    -->
    </style>
    </head>
    <body><a href="../index.php" ><img src="images/img01.gif" id="img2"/></a><div align="right">
    <a href="../register">Join LebPB.com</a> | <a href="../signin">Sign In</a></div>
    <div id="header">

    <div id="logo"> </div>
    <a name="top"></a>


    <div id="menu">
    <ul>
    <li class="active"><a href="../index.php" title="">Homepage</a></li>
    <li><a href="index.php" title="Articles">Articles</a></li>
    <li><a href="../pbvid/" title="Paintball Vids">Paintball Videos</a></li>
    <li><a href="../pbgear/" title="Paintball Gear">Paintball Gear</a></li>
    <li><a href="../pbfields/" title="Paintball Fields">Paintball Fields</a></li>
    <li><a href="../pbforums/" title="Paintball Forums">Paintball Forums</a></li>
    <li><a href="../chat/" title="Chat">Chat</a></li>
    </ul>
    </div>
    </div>
    <div id="wrapper">
    <div id="content">
    <div id="sidebar">
    <div id="support">
    <h5>Anything You need to know about Lebanese Paintball...</h5>
    </div>
    <div id="login" class="boxed">
    <h2 class="title">Client Account</h2>
    <div class="content">
    <form id="form1" method="post" action="#">
    <fieldset>
    <legend>Sign-In</legend>
    <label for="inputtext1">Client ID:</label>
    <input id="inputtext1" type="text" name="inputtext1" value="" />
    <label for="inputtext2">Password:</label>
    <input id="inputtext2" type="password" name="inputtext2" value="" />
    <input id="inputsubmit1" type="submit" name="inputsubmit1" value="Sign In" />
    <p><a href="#">Forgot your password?</a></p>
    </fieldset>
    </form>
    </div>
    </div>
    <div id="updates" class="boxed">
    <h2 class="title">Recent Additions:</h2>
    <div class="content">
    <ul>
    <li>
    <h3>March 5, 2007</h3>
    <p><a href="#">In posuere eleifend odio quisque semper augue mattis wisi maecenas ligula&#8230;</a></p>
    </li>
    <li>
    <h3>March 3, 2007</h3>
    <p><a href="#">Quisque dictum integer nisl risus, sagittis convallis, rutrum id, congue, and nibh&#8230;</a></p>
    </li>
    <li>
    <h3>February 28, 2007</h3>
    <p><a href="#">Donec leo, vivamus fermentum nibh in augue praesent a lacus at urna congue rutrum&#8230;</a></p>
    </li>
    <li>
    <h3>February 25, 2007</h3>
    <p><a href="#">Nam pede erat, porta eu, lobortis eget, tempus et, tellus. Etiam nequea&#8230;</a></p>
    </li>
    <li>
    <h3>February 20, 2007</h3>
    <p><a href="#">Vivamus fermentum nibh in augue. Praesent a lacus at urna congue rutrum. Nulla enim eros&#8230;</a></p>
    </li>
    </ul>
    </div>
    </div>
    </div>
    <div id="main">
    <div id="welcome" class="post">
    <h2 class="title">Add an Article:</h2>

    <div class="story">
    <div>
    <style type="text/css">
    <!--
    .style3 {font-size: x-large}
    -->
    </style>
    <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
    <script src="SpryAssets/SpryValidationTextarea.js" type="text/javascript"></script>
    <script src="SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
    <link href="SpryAssets/SpryValidationTextarea.css" rel="stylesheet" type="text/css" />
    <link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    <!--
    .style4 {font-size: large}
    .style5 {
    font-size: medium;
    font-weight: bold;
    }
    -->
    </style>
    <span class="style1">All Fields are Required</span>
    <form method="post" action="<? $_SERVER['REMOTE_ADDR']?>">
    <table border="0" width="89%" align="center">
    <tr>

    <td width="99%" height="44"><div align="center"><span class="style3 style4">Title:</span><span id="sprytextfield1">
    <input name="title" type="text" size="40" />
    <span class="textfieldRequiredMsg">Please select a title.</span></span>
    </div></td></tr>
    <tr>

    <td><p align="center"><span class="style5">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Topic:</span><span id="spryselect1">
    <select name="degree">
    <option name="5" value="5" id="5" disabled="disabled" selected="selected">Select a Topic.</option>
    <option name="5" value="5" id="5">Paintball Markers and Barrels.</option>
    <option name="2" value="2" id="2">Paintballs.</option>
    <option name="3" value="3" id="3">Pods, Tanks, Goggles, Paintball Clothes...</option>
    <option name="4" value="4" id="4">General Knowledge.</option>
    </select>
    <span class="selectRequiredMsg">Please select a topic.</span></span></p>
    </div></td>
    </tr>
    <tr>
    <td><span id="sprytextarea1">
    <textarea name="text" cols="60" rows="10" ></textarea>
    <span class="textareaRequiredMsg">Please type your article...</span></span></td>
    <td width="1%">&nbsp;</td>
    </tr>
    <tr>
    <td align="center"><input type="submit" action="<? $_SERVER['REMOTE_ADDR']?> " value="Add Article" name="submit"/></td>
    <td>&nbsp;</td>
    </tr>
    </table>

    <?PHP
    $title = $_REQUEST['title'];
    $text = $_REQUEST['text'];
    $date = date("l dS F 'of' Y h:i:s A");
    include("../db_connect.php") ;
    if(isset($_POST['submit'])){
    $sql= 'INSERT INTO `lebpb`.`articles` (
    `id` ,
    `title` ,
    `text` ,
    `date`,
    )
    VALUES (
    NULL , \'' .$title. '\', \'' .$text. '\', \'' .$date. '\'
    );';
    $query = mysql_query($sql) ;

    if($query ) {echo " Your Article was successfully submitted... thank you";}
    else{echo "Your Article was not submitted... Please try to <a href='../contact' target='blank'>Contact Us</a> Or just try again at a later time... Thank You..." .mysql_error(). "\n" ;}
    }
    ?>
    <script type="text/javascript">
    <!--
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var sprytextarea1 = new Spry.Widget.ValidationTextarea("sprytextarea1");
    var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1");
    //-->
    </script></td></div>
    </div></div></div>
    </div>



    </div>
    <div id="example" class="post">
    <h2 class="title">&nbsp;</h2>
    <h3 class="date">&nbsp;</h3>

    </body>
    <div style="clear: both;">&nbsp;</div>
    </div>
    <div id="footer">
    <p id="legal">Copyright &copy; 2007 LebPB. All Rights Reserved. <a href="../help">Help/FAQ</a> | <a href="../contact">contact</a> | <a href="../about">About</a> | <a href="../advertise">Advertising info</a> | <a href="../link">LinkToUs</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="images/toparrow.gif" style="border: none;"><a align="right" href="#top">Top</a></p>
    <p id="links"><a href="../privacy_policy">PrivacyPolicy</a>| <a href="../termsofuse">Terms of Use</a></p>
    </div>
    </body>
    </html>
     
    anthonyr, Nov 21, 2008 IP
  5. eric90

    eric90 Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Change this line: $date = date("l dS F 'of' Y h:i:s A");

    to $date = date('l dS F \of Y h:i:s A');
     
    eric90, Nov 21, 2008 IP
  6. AdultProfiles

    AdultProfiles Peon

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    WHere's your SQL query?
     
    AdultProfiles, Nov 21, 2008 IP
  7. anthonyr

    anthonyr Peon

    Messages:
    15
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    the $date thing didnt really work:S btw what do u mean about the query thing:S??
     
    anthonyr, Nov 21, 2008 IP
  8. iDemonix

    iDemonix Peon

    Messages:
    37
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Just a note, I think it should be \o\f instead of \of in the date argument.
     
    iDemonix, Nov 22, 2008 IP