shujjah Posted March 29, 2009 Share Posted March 29, 2009 Alright with this code... //===============================================================// ADD FILE//--------------------------------------------------------------------------------- if ($_REQUEST[action] == "Add") { if (!$_POST[sUBMIT]) { } else { $pform = $_POST[platform]; $timestamp = time(); $time = date("Ymd"); $title = str_replace("'", "’", $_POST[title]); $description = str_replace("'", "’", $_POST[description]); if (!$_POST[gametyped] || $_POST[gametyped] == "Type in title") { $game = "$_POST[game]"; } else { $game = "$_POST[gametyped]"; } if (!$_FILES[ss_url][name] || $_FILES[ss_url][name] == "http://") { $add1_url = $_POST[ss_url_input]; } else { $filenamea = str_replace("?", "", $_FILES[ss_url][name]); $filenameb = str_replace(":", "", $filenamea); $filenamec = str_replace(" ", "", $filenameb); $add1 = "../images/uploads/$time" . "_" . "$filenamec"; copy($_FILES[ss_url][tmp_name], $add1); chmod("$add1",0777); $add1_url = str_replace("../", "", $add1); } if (!$_FILES[ss2_url][name] || $_FILES[ss2_url][name] == "http://") { $add2_url = $_POST[ss2_url_input]; } else { $filenamea = str_replace("?", "", $_FILES[ss2_url][name]); $filenameb = str_replace(":", "", $filenamea); $filenamec = str_replace(" ", "", $filenameb); $add2 = "../images/uploads/$time" . "_" . "$filenamec"; copy($_FILES[ss2_url][tmp_name], $add2); chmod("$add2",0777); $add2_url = str_replace("../", "", $add2); } if (!$_POST[dl_url_input] || $_POST[dl_url_input] == "http://") { $filenamea = str_replace("?", "", $_FILES[dl_url][name]); $filenameb = str_replace(":", "", $filenamea); $filenamec = str_replace(" ", "", $filenameb); $add = "../files/$time" . "_" . "$filenamec"; copy($_FILES[dl_url][tmp_name], $add); chmod("$add",0777); $add3_url = str_replace("../", "", $add); $get_file_size = filesize($add); } else { $add3_url = $_POST[dl_url_input]; $get_file_size = filesize($_POST[dl_url_input]); } $filess = mysql_query("INSERT INTO ccms_file SET cat_id='$_POST[cat_id]', allow_rating='$_POST[ratings]', allow_comments='$_POST[comments]', title='$title', description='$description', date='$_POST[date_inp]', creator='$_POST[creator]', size='$get_file_size', dl_url='$add3_url', game=\"$game\", platform='$pform', ss_url='$add1_url', ss2_url='$add2_url', video='$_POST', vwidth='$_POST[vwidth]', vheight='$_POST[vheight]', timestamp='$timestamp', mirror1='$_POST[mirror1]', mirror2='$_POST[mirror2]', mirror3='$_POST[mirror3]', mirror4='$_POST[mirror4]', mirror5='$_POST[mirror5]'");if (!$filess) { die('Could not connect: ' . mysql_error()); }echo " <SPAN class=\"reg_text\"><strong>$lang_a_done</strong></SPAN><br /> <meta http-equiv=\"refresh\" content=\"1; url=index.php?page=Files&op=Files\">\n"; } if (!$_POST[sUBMIT]) { $date = date("$time_an"); // Static date $month = date("F Y"); // Archive monthecho " <table align=\"center\" width=\"100%\" $tablereg> <form action=\"index.php?page=Files&op=Files&action=Add\" method=\"post\" enctype=\"multipart/form-data\"> <input type=\"hidden\" name=\"date_inp\" value=\"$date\"> <input type=\"hidden\" name=\"archive_month\" value=\"$month\"> <tr> <td width=\"100%\" colspan=\"3\" $tdreg3><SPAN class=\"head_text\"><strong> $lang_a_addfile</td> </tr> <tr> <td width=\"1%\" valign=\"center\" $tdreg2><img hspace=\"5\" align=\"absmiddle\" src=\"images/a.jpg\"></td> <td width=\"54%\" $tdreg2><SPAN class=\"reg_text\"><strong>$lang_a_title</strong></td> <td width=\"45%\" $tdreg><input name=\"title\" size=\"30\" class=\"input\"></td> </tr> <tr> <td width=\"1%\" valign=\"center\" $tdreg2><img hspace=\"5\" align=\"absmiddle\" src=\"images/a.jpg\"></td> <td width=\"54%\" $tdreg2><SPAN class=\"reg_text\"><strong>$lang_a_category</strong></td> <td width=\"45%\" $tdreg><select name=\"cat_id\" class=\"input\">";//===============================================================// CATEGORY DROP DOWN//---------------------------------------------------------------------------------I am getting this errorCould not connect: Incorrect string value: '\x92ll wo...' for column 'description' at row 1Also when using the same connection with other scripts like when adding articles etc it works fine and it is the same dbby the way this is the structure of the concerned table Field Type Collation Attributes Null Default Extra Action id int(11) No auto_increment Browse distinct values Change Drop Primary Unique Index Fulltext cat_id int(11) No 0 Browse distinct values Change Drop Primary Unique Index Fulltext title varchar(100) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext description text latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext size text latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext creator text latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext dl_url varchar(100) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext game varchar(255) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext date varchar(55) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext hits int(11) No 0 Browse distinct values Change Drop Primary Unique Index Fulltext ss_url varchar(255) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext ss2_url varchar(255) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext video varchar(55) latin1_swedish_ci No no Browse distinct values Change Drop Primary Unique Index Fulltext vwidth int(5) No 0 Browse distinct values Change Drop Primary Unique Index Fulltext vheight int(5) No 0 Browse distinct values Change Drop Primary Unique Index Fulltext category varchar(50) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext platform varchar(10) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext featured int(1) No 0 Browse distinct values Change Drop Primary Unique Index Fulltext timestamp int(10) No Browse distinct values Change Drop Primary Unique Index Fulltext allow_rating int(11) No Browse distinct values Change Drop Primary Unique Index Fulltext allow_comments int(11) No Browse distinct values Change Drop Primary Unique Index Fulltext mirror1 varchar(100) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext mirror2 varchar(100) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext mirror3 varchar(100) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext mirror4 varchar(100) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext mirror5 varchar(100) latin1_swedish_ci No Browse distinct values Change Drop Primary Unique Index Fulltext Thanks in Advance and yes the file is encoded with UTF-8 without BOM Link to comment Share on other sites More sharing options...
TKW22 Posted March 29, 2009 Share Posted March 29, 2009 this line is wrong $filess = mysql_query("INSERT INTO ccms_file SET cat_id='$_POST[cat_id]', allow_rating='$_POST[ratings]', allow_comments='$_POST[comments]', title='$title', description='$description', date='$_POST[date_inp]', creator='$_POST[creator]', size='$get_file_size', dl_url='$add3_url', game=\"$game\", platform='$pform', ss_url='$add1_url', ss2_url='$add2_url', video='$_POST[video]', vwidth='$_POST[vwidth]', vheight='$_POST[vheight]', timestamp='$timestamp', mirror1='$_POST[mirror1]', mirror2='$_POST[mirror2]', mirror3='$_POST[mirror3]', mirror4='$_POST[mirror4]', mirror5='$_POST[mirror5]'");if (!$filess){die('Could not connect: ' . mysql_error());} look here for an example on how to use insert.click hereyou should add some security to.edit sorry didn't mean to spell that Link to comment Share on other sites More sharing options...
shujjah Posted March 29, 2009 Author Share Posted March 29, 2009 Actually I am the same SET function to insert some values in other scripts and it works fine there an example if ($_REQUEST[action] == "Add") { if (!$_POST[sUBMIT]) { } else { $pform = $_POST[platform]; if ($_POST[featured] == "1") { $featured_ins = 1; } if (!$_POST[image_input]) { if (!$_FILES[image][name]) { } else { $time = date("Ymd"); $filenamea = str_replace("?", "", $_FILES[image][name]); $filenameb = str_replace(":", "", $filenamea); $filenamec = str_replace(" ", "", $filenameb); $add = "../images/uploads/$time" . "_" . "$filenamec"; copy($_FILES[image][tmp_name], $add); chmod("$add",0777); $add_url = str_replace('../','', $add); } } else { $add_url = $_POST[image_input]; } $title = str_replace("'", "’", $_POST[title]); $news = str_replace("'", "’", $_POST[news]); $news2 = str_replace("'", "’", $_POST[news2]); $preview = str_replace("'", "’", $_POST[preview]); $title = str_replace("'", "’", $_POST[title]); $content = str_replace("'", "’", $_POST[content]); $content2 = str_replace("'", "’", $_POST[content2]); $content3 = str_replace("'", "’", $_POST[content3]); $content4 = str_replace("'", "’", $_POST[content4]); $content5 = str_replace("'", "’", $_POST[content5]); $content6 = str_replace("'", "’", $_POST[content6]); $rating_1_text = str_replace("'", "’", $_POST[rating_1_text]); $rating_2_text = str_replace("'", "’", $_POST[rating_2_text]); $rating_3_text = str_replace("'", "’", $_POST[rating_3_text]); $rating_4_text = str_replace("'", "’", $_POST[rating_4_text]); $rating_5_text = str_replace("'", "’", $_POST[rating_5_text]); $rating_6_text = str_replace("'", "’", $_POST[rating_6_text]); $rating_overall_text = str_replace("'", "’", $_POST[rating_overall_text]); if (!$_POST[gametyped] || $_POST[gametyped] == "Type in title") { $game = "$_POST[game]"; } else { $game = "$_POST[gametyped]"; } $timestamp = time(); mysql_query("INSERT INTO ccms_article SET allow_rating='$_POST[ratings]', allow_comments='$_POST[comments]', preview='$preview', image=\"$add_url\", title='$title', date=\"$_POST[date]\", timestamp='$timestamp', featured=\"$_POST[featured]\", author=\"$_POST[author]\", type=\"$_POST[type]\", box=\"$_POST[box]\", rating_1=\"$_POST[rating_1]\", rating_2=\"$_POST[rating_2]\", rating_3=\"$_POST[rating_3]\", rating_4=\"$_POST[rating_4]\", rating_5=\"$_POST[rating_5]\", rating_6=\"$_POST[rating_6]\", rating_overall=\"$_POST[rating_overall]\", rating_1_text='$rating_1_text', rating_2_text='$rating_2_text', rating_3_text='$rating_3_text', rating_4_text='$rating_4_text', rating_5_text='$rating_5_text', rating_6_text='$rating_6_text', rating_overall_text='$rating_overall_text', tag=\"staff\", content='$content', content2='$content2', content3='$content3', content4='$content4', content5='$content5', content6='$content6', game=\"$game\", cat_id='$platform', rtype='$_POST[rtype]'");echo " <SPAN class=\"reg_text\"><strong>$lang_a_done</strong></SPAN><br /> <meta http-equiv=\"refresh\" content=\"1; url=index.php?page=Articles&op=Articles\">\n"; } if (!$_POST[sUBMIT]) { ....... Link to comment Share on other sites More sharing options...
TKW22 Posted March 29, 2009 Share Posted March 29, 2009 nvm found it. $description = str_replace("'", "’", $_POST[description]); i tryed you code for that im just getting a box in between the words i put.is the code working the way you want it to?im talking about output. Link to comment Share on other sites More sharing options...
shujjah Posted March 29, 2009 Author Share Posted March 29, 2009 well the forms show you up fine if that's what you mean , the only thing is that it is not inserting the values in the db ( I have checked through phpmyadmin the table is empty)Thanks for your help Link to comment Share on other sites More sharing options...
TKW22 Posted March 29, 2009 Share Posted March 29, 2009 well the forms show you up fine if that's what you mean , the only thing is that it is not inserting the values in the db ( I have checked through phpmyadmin the table is empty)Thanks for your helpno im talking about the output of $description.try to echo it in a different script make sure the out put is what you want. Link to comment Share on other sites More sharing options...
shujjah Posted March 29, 2009 Author Share Posted March 29, 2009 Ok I just echoed $description and I the description I entered but now I also got this errorTesintg description // the description I addedCould not connect: Incorrect integer value: '' for column 'vwidth' at row 1 Link to comment Share on other sites More sharing options...
TKW22 Posted March 29, 2009 Share Posted March 29, 2009 Ok I just echoed $description and I the description I entered but now I also got this errorTesintg description // the description I addedCould not connect: Incorrect integer value: '' for column 'vwidth' at row 1heres what i get when i test ittest � test what the error is mostly is the value of $description is Incorrect Link to comment Share on other sites More sharing options...
shujjah Posted March 29, 2009 Author Share Posted March 29, 2009 so well when I echo $description it works fine so it surely isn't a problem with that variable ? Is it a problem with the query ?Thanks for your help... Link to comment Share on other sites More sharing options...
shujjah Posted March 29, 2009 Author Share Posted March 29, 2009 tried it again and again I got thishopefully It’ll work! ( the description I entered )Could not connect: Incorrect string value: '\x92ll wo...' for column 'description' at row 1 Link to comment Share on other sites More sharing options...
shujjah Posted March 31, 2009 Author Share Posted March 31, 2009 hmm soo anyone .... ? please...Thanks, Link to comment Share on other sites More sharing options...
shujjah Posted March 31, 2009 Author Share Posted March 31, 2009 Ah finally thankfully got the problem fixed .... by using the more common INSERT function instead of the set functionThanks for your help Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.