
November 2nd, 2002, 09:09 PM
|
|
Registered User
|
|
Join Date: Apr 2007
Posts: 22,309
Time spent in forums: < 1 sec
Reputation Power: 24
|
|
|
help with a news posting script
ok..here's the script i'm using..
php Code:
Original
- php Code |
|
|
|
<?PHP ///////////////////////////////////////////////////////////// // ... rNews made by RyZeR ... // ... xcelsius@hotmail.com for bugs and/or questions ... // ... PLZ LEAVE THE COPYRIGHT ALONE ... /////////////////////////////////////////////////////////// //################################################## ####### // ####### // INCLUDE // ####### require("config.php"); include_once ("functions.php"); // ##### // LOGIN // ##### if ($password != $passx){ include("login.php"); }else{ // ############# // CONNECT TO DB // ############# $link = mysql_connect($db_hostname, $db_username, $db_password) or die("Could not connect"); // ####################################### if ($id == "add"){ if ($action == "do"){ // Check Fields if (!($ntext && $nsubject && $nemail && $nuser)){ echo "Please go back and fill all fields..."; } // Convert Vars $ntext = strip_tags($ntext, '<br><font><img><object><marquee><hr><sub><tt><sup><s><b><i><u><li><ul><a><blockquote><span><hr><pre>'); $ntext = InsertBBCode($ntext); // Query: Get last ID... $query = "SELECT * FROM news ORDER BY id DESC"; $lid = "$record->id"; // Query: Put in DataBase $nid = $lid + 1; $query = "INSERT INTO news (id, subject, user, email, text, datum) VALUES ('$nid', '$nsubject', '$nuser', '$nemail', '$ntext', '$ndatum');"; }else{ ?> <script language="JavaScript" type="text/JavaScript"> function MM_goToURL() { var i, args=MM_goToURL.arguments; document.MM_returnValue = false; for (i= 0; i< (args.length- 1); i+= 2) eval(args [i ]+ ".location='"+args [i+ 1]+ "'"); } </script> <body onLoad="MM_goToURL('parent','admin.php');return document.MM_returnValue"> <?PHP } }else{ ?>
When I try to post news with the word "you're" or anything really with a ' in it, it gives me this error..
Error Adding: You have an error in your SQL syntax near 're', '11/02/02')' at line 1
Not sure how to fix this. Any help would be great.
|