Jump to content

shujjah

Members
  • Posts

    243
  • Joined

  • Last visited

About shujjah

  • Birthday 07/24/1996

shujjah's Achievements

Member

Member (2/7)

0

Reputation

  1. so I think I should remove that part....Thanks
  2. Hey I am getting this error when I try to enter an article into the databaseCould not connect: Incorrect string value: '\x92t eve...' for column 'content' at row 1sometime its \x86m and stuff like thatI figured if I remove the " ' " in the article then the error goes away .. but there are just so many " ' " used in the article that I cant remove them all .. and why cant I post " ' " in the article ? Why does it give me this error....and how to solve it :)this only doesnt happen with articles but with other scripts as well where again I try to input something into the db .. I get similar errors 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(); echo $_REQUEST[ratingid]; $firstq = 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='$pform', rtype='c'"); if (!$firstq) { die('Could not connect: ' . mysql_error()); } echo "$pform"; 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"; is the str replace code causing the error ? table Thanks in advance.
  3. shujjah

    A Few Mysql Bugs

    Ok so heres the deal .. its a bit confusing but I hope that you'll understand since you are the only one who can help me :)this is the code Alright so heres the deal when the Red code is in use i.e when ratingid == 1I get this whereas if I insert the query directly into phpmyadmin it worksif the blue code is in use this is what I get again If I insert the query directly it worksso basically even after the change of syntax it is giving me the same error in both the cases full script if you wanna see it http://rapidshare.com/files/221354333/s_article.php.htmlThanks,
  4. shujjah

    A Few Mysql Bugs

    there are no queries before that .. but there are after it .. but I doubt they can cause a problem since the script gets stopped when it gets that error ..... anyways I will try the normal insert syntax now
  5. shujjah

    A Few Mysql Bugs

    yes yes its on the same page this is the code //===================================================// ARTICLE SUBMIT INSERT INTO THE DATABASE//----------------------------------------------------------------- $title = str_replace("'", "’", $_POST[title]); $content = str_replace("'", "’", $_POST[content]); $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 (isset($_POST[title])) { echo "game = ";echo $_POST[game];echo "<br />";echo "rtype = ";echo $_POST[rtype];echo "<br />"; echo "rating 1 = ";echo $_POST[rating_1];echo "<br />";echo "rating 2 = ";echo $_POST[rating_2];echo "<br />";echo "rating 3 = ";echo $_POST[rating_3];echo "<br />";echo "rating 4 = ";echo $_POST[rating_4];echo "<br />";echo "rating 5 = ";echo $_POST[rating_5];echo "<br />";echo "rating 6 = ";echo $_POST[rating_6];echo "<br />"; if ( $_REQUEST[ratingid] == 1 ) {$sql = "INSERT INTO ccms_article_submit SET title='$title', type='$_POST[submittype]', game='{$_POST['game']}', cat_id='$_POST[platform]', content='$content', author='$username', tag='user', rtype='$_POST[rtype]', 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='$_POST[rating_overall_text]'";echo "INSERT INTO ccms_article_submit SET title='$title', type='$_POST[submittype]', game='{$_POST['game']}', cat_id='$_POST[platform]', content='$content', author='$username', tag='user', rtype='$_POST[rtype]', 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='$_POST[rating_overall_text]'";}else {$sql = "INSERT INTO ccms_article_submit SET title='$title', type='$_POST[submittype]', game='{$_POST['game']}', cat_id='$_POST[platform]', content='$content', author='$username', tag='user'";echo "INSERT INTO ccms_article_submit SET title='$title', type='$_POST[submittype]', game='{$_POST['game']}', cat_id='$_POST[platform]', content='$content', author='$username', tag='user'";} if (@mysql_query($sql)) { echo " <img src=\"images/spacer2.gif\"> <table width=\"98%\" align=\"center\" $tablereg> <tr> <td width=\"100%\" $tdreg3><SPAN class=\"headertitle\"> $lang_success</td> </tr> <tr> <td width=\"100%\" $tdreg><SPAN class=\"content\"><center>$lang_success_submit</td> </tr> </table> <img src=\"images/spacer2.gif\">\n"; } else { echo("" . mysql_error() . "</p>"); } }} and this is what I get I get the same error whether ratingid is 1 or notthe full script if you wanna see it http://rapidshare.com/files/221325085/s_article.php.htmlThanks,
  6. shujjah

    A Few Mysql Bugs

    No I dont get the same error , it gets inserted into the db Inserted rows: 1Inserted row id: 10 (Query took 0.0002 sec)SQL query:INSERT INTO ccms_article_submitSET title = 'Testing muhahah',TYPE = 'Article',game = "Gears Of War 2",cat_id = 'ps3',content = ' OK so this is just a test ',author = 'SpEeDyZ',tag = 'user'So what does this mean ? I am confused.Thanks,
  7. shujjah

    A Few Mysql Bugs

    this is the code if ( $_REQUEST[ratingid] == 1 ) {$sql = "INSERT INTO ccms_article_submit SET title='$title', type='$_POST[submittype]', game=\"$_POST[game]\", cat_id='$_POST[platform]', content='$content', author='$username', tag='user', rtype='$_POST[rtype]', 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='$_POST[rating_overall_text]'";echo "INSERT INTO ccms_article_submit SET title='$title', type='$_POST[submittype]', game=\"$_POST[game]\", cat_id='$_POST[platform]', content='$content', author='$username', tag='user', rtype='$_POST[rtype]', 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='$_POST[rating_overall_text]'";}else {$sql = "INSERT INTO ccms_article_submit SET title='$title', type='$_POST[submittype]', game=\"$_POST[game]\", cat_id='$_POST[platform]', content='$content', author='$username', tag='user'";echo "INSERT INTO ccms_article_submit SET title='$title', type='$_POST[submittype]', game=\"$_POST[game]\", cat_id='$_POST[platform]', content='$content', author='$username', tag='user'";} and I get this ( when the ratingid is not 1 but in either case I get the game too long error ) and if instead of game=\"$_POST[game]\"I use game=\"$_POST['game']\" in the query then I get this Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/speedyz/public_html/CCMS/pages/s_article.php on line 95thanks,
  8. shujjah

    A Few Mysql Bugs

    I did echo game and I get the game I choose ( i.e Gears Of War 2 )but it still gives the same error the results of the echo ( yes I have managed to fix that rtype and ratings issue but that game issue still remains )Data too long for column 'game' at row 1although I have checked again that game field is varchar 250 whereas the above value is only like 20 charactersnow I did some googling and I found out that most of the errors are caused by something being wrong with the table like the encoding or something like that ? Also does it have to do anything with PHP strict mode ?Thanks in advance for helping me and Spence thanks for the brief explanation
  9. shujjah

    A Few Mysql Bugs

    Alright this is how the table looks like and this is the code //===================================================// ARTICLE SUBMIT INSERT INTO THE DATABASE//----------------------------------------------------------------- $title = str_replace("'", "’", $_POST[title]); $content = str_replace("'", "’", $_POST[content]); $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 (isset($_POST[title])) { echo "game = ";echo $_POST[game];echo "<br />";echo "rtype = ";echo $_POST[rtype];echo "<br />"; echo "rating 1 = ";echo $_POST[rating_1];echo "<br />";echo "rating 2 = ";echo $_POST[rating_2];echo "<br />";echo "rating 3 = ";echo $_POST[rating_3];echo "<br />";echo "rating 4 = ";echo $_POST[rating_4];echo "<br />";echo "rating 5 = ";echo $_POST[rating_5];echo "<br />";echo "rating 6 = ";echo $_POST[rating_6];echo "<br />"; $sql = "INSERT INTO ccms_article_submit SET title='$title', type='$_POST[submittype]', game='$_POST[game]', cat_id='$_POST[platform]', content='$content', author='$username', tag='user', rtype='$_POST[rtype]', 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='$rating_overall_text', 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='$_POST[rating_overall_text]'"; if (@mysql_query($sql)) { echo " <img src=\"images/spacer2.gif\"> <table width=\"98%\" align=\"center\" $tablereg> <tr> <td width=\"100%\" $tdreg3><SPAN class=\"headertitle\"> $lang_success</td> </tr> <tr> <td width=\"100%\" $tdreg><SPAN class=\"content\"><center>$lang_success_submit</td> </tr> </table> <img src=\"images/spacer2.gif\">\n"; } else { echo("" . mysql_error() . "</p>"); } } the result of the echo are now the problem is when I choose the game Gears Of War 2 I get this Data too long for column 'game' at row 1although in the table the game field is varchar 250and if I dont choose that game If I choose another game like Halo 3 I dont get that error but instead I get thisIncorrect integer value: '' for column 'rtype' at row 1although the rtype in my table is also varchar .......... If I manually put the value of rtype to 0 then I start getting thisIncorrect integer value: '' for column 'rating_1' at row 1although again rating_1 is varchar in the databasethe full scripthttp://rapidshare.com/files/219580513/s_article.php.htmlOne more thing the ratings fields are only filled when one is submitting a review ... the above error occurs when one is submitting an article Thanks,
  10. ahhhhh thanks a lot dude !I figured it out .. it turns out it wasnt a problem with the script but with the htaccess file!it contains links like ] the Media is with a capital M but in the script it is with a small m .. so I guess the .htaccess files are case sensitive! ok so I dont know how to say this .. but I AM REALLY REALLY THANKFUL! for you helping me out! If there is anything I can do for you just lemme know ...and one more thing what does a Mysql resource Id mean ?
  11. It is not displaying the results!!!!!! see the code I posted .. it should show all the screens but its not showing anything .. its empty although it is selecting it why isn't it showing it !see for yourselfhttp://gamerzgalore.net/CCMS/game.media-1-...s-Of-War-2.htmlThanks!
  12. Alright I did as you said and I got this I inserted it directly into phpmyadmin and I got the row so what does this mean ? the query is right but the code that is echoing it , is not right ? Thanks!
  13. this is the code only the blue lines show and the red ones do not .. and the orange ones only show the simple text Res2 and Resc2 etc ... the vriables dont show anything .. they are empty ?you can see it yourself herehttp://gamerzgalore.net/CCMS/game.media-1-...s-Of-War-2.html
  14. and what code do I use to print out the exact query .... echo doesnt seem to work .. Thanks,
  15. I inserted this SELECT *FROM ccms_screenshotsWHERE game = 'Gears Of War 2'AND platform = 'x360'ORDER BY id DESC; into my phpmyadmin and I got the row I needed It showed the correct row....Also not only this other similar scrpts like this one was for media others like for files and Faq are also showing the same blank pageshere are their queriesfor Faqs//===================================================// SUB PAGE > GAME FAQ//-----------------------------------------------------------------echo "gtitle = $gtitle";echo "category = $category";echo "glob_game = $glob_game";echo "glob_console = $glob_console";echo "Game id = $_REQUEST[id] ";echo "<br />";echo "Get Id";echo $_GET['id']; $divtitle = "$lang_faq"; include "templates/$skin/divtitle.php"; $gamearticles = mysql_query("SELECT * from ccms_gamefaq where gameid=\"$_REQUEST[id]\" order by id asc") or die('Line ' . __LINE__ . ': Error: ' . mysql_error()); echo " <img src=\"images/spacer2.gif\"> <table width=\"98%\" align=\"center\" $tablereg> <tr> <td width=\"45%\" colspan=\"2\" $tdreg3><SPAN class=\"headertitle\"> $lang_title</SPAN></td> <td width=\"25%\" $tdreg3><SPAN class=\"headertitle\"><center>$lang_date</SPAN></td> <td width=\"15%\" $tdreg3><SPAN class=\"headertitle\"><center>$lang_author</SPAN></td> <td width=\"15%\" $tdreg3><SPAN class=\"headertitle\"><center>$lang_views</SPAN></td> </tr>\n"; $c = 1; while ($row = mysql_fetch_assoc($gamearticles)) { $title_start = preg_replace('/[^a-zA-Z0-9 *]/', '', $row[title]); $title_seo = str_replace(' ', '-', $title_start); if ($odd = $c%2 ) { $style = "$tdreg2"; } else { $style = "$tdreg"; } $title = $row[title]; $atimestamp = $row[dateline]; $tfid = $row[id]; $platform = $row[cat_id]; $views = $row[views]; echo "<tr>\n";echo " <td width=\"5%\" $style><img src=\"images/consoles/$glob_console.gif\"></td> <td width=\"40%\" $style><SPAN class=\"content\"> <a class=\"content\" href=\"faq-$tfid-$title_seo.html\">$title</a></SPAN></td> <td width=\"25%\" $style><center><SPAN class=\"content\">\n";//===================================================// DATE & TIME DISPLAY//----------------------------------------------------------------- // Display date if timestamp doesn't exist if (!$atimestamp || $atimestamp == "0") { echo "$date"; // Display time stamp } else { echo date("$time_an", $atimestamp); }//===================================================echo " </SPAN></td> <td width=\"15%\" $style><center><a class=\"content\" href=\"profile-$row[author].html\">$row[author]</a></td> <td width=\"15%\" $style><center><SPAN class=\"content\">"; echo number_format($row[views]); echo "</td> </tr>\n"; $c++; }echo " </table> <img src=\"images/spacer2.gif\">\n";//=================================================== for FIles if ($_REQUEST[show] == 'files') {//===================================================// SUB PAGE > GAME FILES//-----------------------------------------------------------------echo "gtitle = $gtitle";echo "category = $category";echo "glob_game = $glob_game";echo "glob_console = $glob_console";echo "Game id = $_REQUEST[id] ";echo "<br />";echo "Get Id";echo $_GET['id']; $divtitle = "$lang_files"; include "templates/$skin/divtitle.php"; $gamefiles = mysql_query("SELECT * from ccms_file where game=\"$gtitle\" and platform=\"$category\"") or die('Line ' . __LINE__ . ': Error: ' . mysql_error()); echo " <img src=\"images/spacer2.gif\"> <table align=center width=98% $tablereg> <tr> <td width=\"60%\" $tdreg3><SPAN class=\"headertitle\"> $lang_file</td> <td width=\"25%\" $tdreg3><SPAN class=\"headertitle\"><center>$lang_added</td> <td width=\"15%\" $tdreg3><SPAN class=\"headertitle\"><center>$lang_hits</td> </tr>\n"; $c = 1; while($row = mysql_fetch_array($gamefiles)) { if ($odd = $c%2 ) { $style = "$tdreg2"; } else { $style = "$tdreg"; } $title_start = preg_replace('/[^a-zA-Z0-9 *]/', '', $row[title]); $title_seo = str_replace(' ', '-', $title_start); $title = $row[title]; $rdate = $row[date]; $ftimestamp = $row[timestamp]; $fid = $row[id]; $hits = $row[hits];echo " <tr> <td width=\"60%\" $style><SPAN class=\"content\">";//===================================================// FILE TYPE ICONS//----------------------------------------------------------------- $ext_1 = strrchr($row[dl_url],'.'); if ($ext_1 == ".gif" || $ext_1 == ".jpeg" || $ext_1 == ".png" || $ext_1 == ".jpg") {echo " <img src=\"images/icon_img.gif\" align=\"absmiddle\" hspace=\"4\" alt=\"Image - .jpg, .gif, .png\" /> "; } if ($ext_1 == ".rar" || $ext_1 == ".zip" || $ext_1 == ".tar" || $ext_1 == ".gzip") {echo " <img src=\"images/icon_archive.gif\" align=\"absmiddle\" hspace=\"4\" alt=\"Archive - .rar, .zip\" /> "; } if ($ext_1 == ".mpg" || $ext_1 == ".mpeg" || $ext_1 == ".mov" || $ext_1 == ".avi") {echo " <img src=\"images/icon_video.gif\" align=\"absmiddle\" hspace=\"4\" alt=\"Video - .mpeg, .mov, .avi\" /> "; } if ($ext_1 == ".txt" || $ext_1 == ".doc" || $ext_1 == ".rtf" || $ext_1 == ".word") {echo " <img src=\"images/icon_doc.gif\" align=\"absmiddle\" hspace=\"4\" alt=\"Text Document - .txt, .doc, .word, .rtf\" /> "; } if ($ext_1 == ".pdf") {echo " <img src=\"images/icon_pdf.gif\" align=\"absmiddle\" hspace=\"4\" alt=\"PDF File\" /> "; }//=================================================== echo "<a class=\"content\" href=\"file-$fid-$title_seo.html\">$title</a></td> <td width=\"25%\" $style><center><SPAN class=\"content\">";//===================================================// DATE & TIME DISPLAY//----------------------------------------------------------------- // Display date if timestamp doesn't exist if (!$ftimestamp || $ftimestamp == "0") { echo "$rdate"; // Display time stamp } else { echo date("$time_an", $ftimestamp); }//===================================================echo " </td> <td width=\"15%\" $style><center><SPAN class=\"content\">"; echo number_format($hits); echo "</td> </tr>\n"; $c++; }echo " </table> <img src=\"images/spacer2.gif\">\n"; } SO I guess its a common error with all the queries ?Thanks,
×
×
  • Create New...