[script] kann nichts mehr posten nach serverwechsel

schneeWITCHen

Mitglied
Ich habe grad meinen server gewechselt (bin jetzt bei all-inkl) und mein blog script funktioniert nicht mehr, ich kann nichts mehr posten - keine comments, keine einträge, und updaten auch nicht mehr. Bin verzweifelt!

Beim schreiben eines eintrags kommt dieser error:
Can't insert into table blog.
INSERT INTO blog (timestamp,title,category,category2,category3,entry) VALUES ('1127367484','the entry title.','general','','','The entry text.')
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 's wrong.','general','','','the entry

my write.php:
PHP:
<?php
include('../header.inc');

$current_month = date("F");
$current_date = date("d");
$current_year = date("Y");
$current_time = date("H:i");
?>

<form method="post" action="<? echo $PHP_SELF ?>">
<table>
<tr>
<td>
<b>date:</b>

<select name="month">
<option value="<? echo $current_month ?>"><? echo $current_month ?></option>
<option value="January">January</option>
<option value="February">February</option>
<option value="March">March</option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June</option>
<option value="July">July</option>
<option value="August">August</option>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
</select>

<input type="text" name="date" size="2" value="<? echo $current_date ?>">

<select name="year">
<option value="<? echo $current_year ?>"><? echo $current_year ?></option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2008</option>
<option value="2010">2010</option>
<option value="2010">2011</option>
<option value="2010">2012</option>
<option value="2010">2013</option>
<option value="2010">2014</option>
<option value="2010">2015</option>
<option value="2010">2016</option>
</select>

<input type="text" name="time" size="5" value="<? echo $current_time ?>">
</td>
</tr>

<tr>
<td>
<b>category:</b> 
<select name="category">
<option value="general">general</option>
<option value="personal">personal</option>
<option value="dreams">dreams</option>
<option value="thoughts">thoughts</option>
<option value="events">events</option>
<option value="reviews">reviews</option>
<option value="memories">memories</option>
<option value="mixed">mixed</option>
</select>


<b>category2:</b> 
<select name="category2">
<option value=""></option>
<option value="general">general</option>
<option value="personal">personal</option>
<option value="dreams">dreams</option>
<option value="thoughts">thoughts</option>
<option value="events">events</option>
<option value="reviews">reviews</option>
<option value="memories">memories</option>
<option value="mixed">mixed</option>
</select>


<b>category3:</b> 
<select name="category3">
<option value=""></option>
<option value="general">general</option>
<option value="personal">personal</option>
<option value="dreams">dreams</option>
<option value="thoughts">thoughts</option>
<option value="events">events</option>
<option value="reviews">reviews</option>
<option value="memories">memories</option>
<option value="mixed">mixed</option>
</select>
</td>
</tr>

<tr>
<td>
<b>title:</b> <input type="text" name="title" size="40">
</td>
</tr>

<tr>
<td>
<textarea cols="80" rows="20" name="entry"></textarea>
</td>
</tr>
<tr>
<td>
<input type="submit" name="submit" value="Submit">
</td>
</tr>
</table>
</form>


<?php

if($submit) {
$timestamp = strtotime ("$month $date $year $time");
$entry = nl2br($entry);

mysql_connect ('localhost', 'x', 'x');
mysql_select_db ('x');

$timestamp=time();
$sql = "INSERT INTO blog (timestamp,title,category,category2,category3,entry) VALUES ('$timestamp','$title','$category','$category2','$category3','$entry')";
$result = mysql_query($sql) or print ("Can't insert into table blog.<br />" . $sql . "<br />" . mysql_error());

if ($result != false)
{
print "Your entry has successfully been entered into the database!";
}

mysql_close();
}

include('../footer.inc');
?>



this is the single display page (comments)
PHP:
<?php
include('header.inc');

mysql_connect ('localhost', 'x', 'x');
mysql_select_db ('x');


$sql = "SELECT * FROM blog WHERE id='$id'";

$result = mysql_query($sql) or
print ("Can't select entries from table blog.<br />" . $sql . "<br />" . mysql_error());
while ($row = mysql_fetch_array($result))
	{
  $date = date("l, F dS, Y - H:i",$row["timestamp"]);
  $title = $row["title"];
  $category = $row["category"];
  $entry = $row["entry"];
  print "<div class=\"bloghead\">$date</div>";	
  print "<div class=\"blogheadtitel\">$title</strong></div><br />";	
  print "<div class=\"blogtext\">$entry</div>";
  print "<div class=\"blogcatcom\">category: <a href=\"categoriesx.php?c=$category\">$category</a> </div> <br /><br />";

	}




$sql = "SELECT * FROM blog_comments WHERE entry='$id' ORDER BY timestamp";
$result = mysql_query ($sql) or
print ("Can't select comments from table blog_comments.<br />" . $sql . "<br />" . mysql_error());
while($row = mysql_fetch_array($result))
	{
  $timestamp = date("l, F dS, Y - H:i",$row["timestamp"]);
  printf("");
  printf("<a name=\"%s\"></a>", $row["id"]);
  printf("<blockquote><div class=\"blogcommenthead\"><a href=\"%s\" target=\"_blank\">%s</a> <a href=\"mailto:%s\" target=\"_blank\">@</a> | %s<br />\n</div>", $row["url"], $row["name"], $row["email"], $timestamp);
  printf("<div class=\"blogcomment\">%s \n</div></blockquote>",$row["comment"]);

  printf("");
	}



$timestamp=strtotime("now");

?>

<blockquote>
<table>
<form method="post" action="process.php">

<tr><td colspan='2'>
leave a comment<br />
<input type="hidden" name="entry" value="<?=$id?>">
<input type="hidden" name="timestamp" value="<?=$timestamp?>">
</td></tr>

<tr>
<td align="right" valign="top">name: </td>
<td>
<input type="text" name="name" size="50" value="<?php if (isset($_COOKIE['lostname'])) { print $_COOKIE['lostname']; } ?>">
</td></tr>

<tr>
<td align="right" valign="top">email: </td>
<td>
<input type="text" name="email" size="50" value="<?php if (isset($_COOKIE['lostmail'])) { print $_COOKIE['lostmail']; } ?>"><br>
</td></tr>

<tr>
<td align="right" valign="top">url: </td>
<td>
<input type="text" name="url" size="50" value="<?php if (isset($_COOKIE['losturl'])) { print $_COOKIE['losturl']; } ?>"><br>
</td></tr>

<tr>
<td align="right" valign="top">comment: </td>
<td>
<textarea cols="50" rows="5" name="comment"></textarea><br>
<input type="submit" name="submit_comment" value="comment">
<input type="checkbox" name="remember_me" checked /> Remember me?
</td></tr>

</form></table>
</blockquote>

<?php
mysql_connect ('localhost', 'x', 'x');
mysql_select_db ('x');

$sql_prev = "SELECT * FROM blog WHERE id<'$id' ORDER BY timestamp DESC LIMIT 1";
$result_prev = mysql_query ($sql_prev) or
print ("Can't select previous entry id table blog.<br />" . $sql_prev . "<br />" . mysql_error());

while ($row = mysql_fetch_array($result_prev))
	{
  $prev = $row["id"];
	}

if($prev)
	{
  // print a previous link
  printf("<center><a href=\"display.php?id=%s\">&laquo;&laquo;&laquo;</a> -<a href=\"index.php\">main</a>- ", $prev);
	}

else
	{
  // just print the word "previous"
  print"<center>&laquo;&laquo;&laquo; -<a href=\"index.php\">main</a>- ";
	}


$sql_next = "SELECT * FROM blog WHERE id>'$id' ORDER BY timestamp LIMIT 1";
$result_next = mysql_query ($sql_next) or

print ("Can't select next entry id table blog.<br />" . $sql_next . "<br />" . mysql_error());


while ($row = mysql_fetch_array($result_next))
	{
  $next = $row["id"];
	}
if($next)
	{
  // print a next link
  printf("<a href=\"display.php?id=%s\">&raquo;&raquo;&raquo;</a></center><br />", $next);
	}
else
	{
  // just print the word "next"
  print"&raquo;&raquo;&raquo;</center><br />";
	}
include('footer.inc');
?>


this is the process for the comments:
PHP:
<?php

if ($remember_me) {

$cookie_life = time() + 31536000; // Life of one year

setcookie("lostname", "$name", $cookie_life, '/', 'http://lost.chaosworks.org.dd11508.kasserver.com');
setcookie("lostmail", "$email", $cookie_life, '/', 'http://lost.chaosworks.org.dd11508.kasserver.com');
setcookie("losturl", "$url", $cookie_life, '/', 'http://lost.chaosworks.org.dd11508.kasserver.com');

}


if($submit_comment)
{
$comment = strip_tags($comment);
$comment = nl2br($comment);


mysql_connect ('localhost', 'x', 'x');
mysql_select_db ('x');

$timestamp=time();

$result = mysql_query("INSERT INTO blog_comments (entry, timestamp, name, email, url, comment) VALUES ('$entry','$timestamp','$name','$email','$url','$comment')");



print"<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"0; URL=display.php?id=$entry\">";
}


?>



this is the update.php for editing:
PHP:
<?php
include('../header.inc');

mysql_connect ('localhost', 'x', 'x');
mysql_select_db ('x');


$result = mysql_query ("SELECT * FROM blog WHERE id='$id'") or print ("Can't select entry.<br />" . $sql . "<br />" . mysql_error());
while ($row = mysql_fetch_array($result))
	{
  $old_timestamp = $row["timestamp"];
  $old_title = $row["title"];
  $old_category = $row["category"];
  $old_category2 = $row["category2"];
  $old_category3 = $row["category3"];
  $old_entry = $row["entry"];
  $old_password = $row["password"];

  $old_title = str_replace('"','\'',$old_title);

  $old_month = date("F",$old_timestamp);
  $old_date = date("d",$old_timestamp);
  $old_year = date("Y",$old_timestamp);
  $old_time = date("H:i",$old_timestamp);
	}


print"<form method=\"post\" action=\"$PHP_SELF\">
<input type=\"hidden\" name=\"id\" value=\"$id\">
	<table>
  <tr>
  	<td>
    <b>date:</b>

    <select name=\"month\">
    <option value=\"$old_month\">$old_month</option>
    <option value=\"January\">January</option>
    <option value=\"February\">February</option>
    <option value=\"March\">March</option>
    <option value=\"April\">April</option>
    <option value=\"May\">May</option>
    <option value=\"June\">June</option>
    <option value=\"July\">July</option>
    <option value=\"August\">August</option>
    <option value=\"September\">September</option>
    <option value=\"October\">October</option>
    <option value=\"November\">November</option>
    <option value=\"December\">December</option>
    </select>

    <input type=\"text\" name=\"date\" size=\"2\" value=\"$old_date\">

    <select name=\"year\">
    <option value=\"$old_year\">$old_year</option>
    <option value=\"2004\">2004</option>
    <option value=\"2005\">2005</option>
    <option value=\"2006\">2006</option>
    <option value=\"2007\">2007</option>
    <option value=\"2008\">2008</option>
    <option value=\"2009\">2008</option>
    <option value=\"2010\">2010</option>
    </select>

    <input type=\"text\" name=\"time\" size=\"5\" value=\"$old_time\">
  	</td>
  </tr>

<tr>
<td>
<b>category:</b> 
<select name=\"category\">
<option value=\"$old_category\">$old_category</option>
<option value=\"general\">general</option>
<option value=\"personal\">personal</option>
<option value=\"dreams\">dreams</option>
<option value=\"thoughts\">thoughts</option>
<option value=\"events\">events</option>
<option value=\"reviews\">reviews</option>
<option value=\"memories\">memories</option>
<option value=\"mixed\">mixed</option>
</select>


<b>category2:</b> 
<select name=\"category2\">
<option value=\"$old_category2\">$old_category2</option>
<option value=\"\"></option>
<option value=\"general\">general</option>
<option value=\"personal\">personal</option>
<option value=\"dreams\">dreams</option>
<option value=\"thoughts\">thoughts</option>
<option value=\"events\">events</option>
<option value=\"reviews\">reviews</option>
<option value=\"memories\">memories</option>
<option value=\"mixed\">mixed</option>
</select>

<b>category3:</b> 
<select name=\"category3\">
<option value=\"$old_category3\">$old_category3</option>
<option value=\"\"></option>
<option value=\"general\">general</option>
<option value=\"personal\">personal</option>
<option value=\"dreams\">dreams</option>
<option value=\"thoughts\">thoughts</option>
<option value=\"events\">events</option>
<option value=\"reviews\">reviews</option>
<option value=\"memories\">memories</option>
<option value=\"mixed\">mixed</option>
</select>

</td>
</tr>

  <tr>
  	<td>
    <b>title:</b> <input type=\"text\" name=\"title\" size=\"40\" value=\"$old_title\">
  	</td>
  </tr>
  <tr>
  	<td>
    <textarea cols=\"80\" rows=\"20\" name=\"entry\">$old_entry</textarea>
  	</td>
  </tr>
  <tr>
  	<td>
    <input type=\"submit\" name=\"update\" value=\"Update\">
  	</td>
  </tr>
	</table>
</form>
<table>
	<tr>
  <td>
  <p><b>Before deleting, be absolutely sure - there is no confirmation nor is there any way to reverse deletion!!</b><br />
  <font size='1'>(You may be shown your entry again after deleting, do not worry, it HAS been deleted.  Check the main page of the blog if you are still unsure.</font></p>
  <form action='$PHP_SELF' method='post'>
  <input type='hidden' name='id' value='$id'>
  <input type='submit' name='delete' value='Yes, I am absolutely and positively sure I want to delete this entry.'>
  </form>
</td>
</tr>
</table>";




if($update)
    {
    	$timestamp = strtotime ("$month $date $year $time");

mysql_connect ('localhost', 'd001bfa0', 'l0k1skywalk3r');
mysql_select_db ('d001bfa0');


	$result = mysql_query("UPDATE blog SET timestamp='$timestamp', title='$title', category='$category', category2='$category2',category3='$category3',entry='$entry' WHERE id='$id'") or print ("Can't update entry.<br />" . $sql . "<br />" . mysql_error());
  print"<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"0; URL=editentries.php\">";
	mysql_close();
     }



if($delete)
	{

mysql_connect ('localhost', 'x', 'x');
mysql_select_db ('x');


$result = mysql_query("DELETE FROM blog WHERE id='$id'") or print ("Can't delete entry.<br />" . $sql . "<br />" . 
mysql_error());

if ($result != false)
{
print "<b>Your entry has successfully been deleted from the database!</b>";
}
}
include('../footer.inc');
?>
 
Zuletzt bearbeitet:
Dann les dir doch einfach mal die Fehlermeldung durch:

Can't insert into table blog.
INSERT INTO blog (timestamp,title,category,category2,category3,entry) VALUES ('1127367484','the entry title.','general','','','The entry text.')
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 's wrong.','general','','','the entry

Der markierte Abostroph vor dem "s" muss auskommentiert werden, wenn du die Daten engibst, da das Script sonst davon ausgeht, dass dein String zu ende ist.
 
Zuletzt bearbeitet:
meinst du wenn ich nen eintrag schreibe soll ich mit \' schreiben?

das 's wrong kan aus dem test-eintrag "i don't know what's wrong" mit dem ich versucht hab was zu posten
 
Zurück