gibigbig Posted September 25, 2010 Share Posted September 25, 2010 $search = $_POST['search']; $replace = $_POST['replace']; $zero = 0; $gibs = mysql_query("SELECT * FROM anime"); while ($gib = mysql_fetch_assoc($gibs)) { $new_description[] = str_replace($search,$replace,$gib['description']); $new_history[] = str_replace($search,$replace,$gib['history']); $anime_id[] = $gib['anime_id']; $numberlinks = ++$zero; } for($i=0; $i<$numberlinks; $i++) { $thequery[] = mysql_query("UPDATE anime SET description = '".mysql_real_escape_string($new_description[$i])."', history='".mysql_real_escape_string($new_history[$i])."' WHERE anime_id='".$anime_id[$i]."'"); } foreach ($thequery as $query){ mysql_query($query) or die (mysql_error()); echo "<span style='color:green'>Edited sucessfully <b>Anime ".++$one."</b> </span><br/>"; } echo "<meta http-equiv='refresh' content='2;url=http://www.website.com/forums/downloads-manager.php?task=fix-descriptions'>"; output: 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 '1' at line 1 Inputs: $search: ’ $replace: " Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted September 25, 2010 Share Posted September 25, 2010 Echo your query when you get an error, so you can see what caused the problem: <?php mysql_query($query) or die ("Problem with the query: $query<br>" . mysql_error()); ?> Ken Quote Link to comment Share on other sites More sharing options...
sasa Posted September 26, 2010 Share Posted September 26, 2010 change $thequery[] = mysql_query("UPDATE anime SET description = '".mysql_real_escape_string($new_description[$i])."', history='".mysql_real_escape_string($new_history[$i])."' WHERE anime_id='".$anime_id[$i]."'"); to $thequery[] = "UPDATE anime SET description = '".mysql_real_escape_string($new_description[$i])."', history='".mysql_real_escape_string($new_history[$i])."' WHERE anime_id='".$anime_id[$i]."'"; Quote Link to comment Share on other sites More sharing options...
gibigbig Posted September 26, 2010 Author Share Posted September 26, 2010 Thank you very much sasa worked perfectly *hugs* Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.