Schleife

PHP:
<?php

	require_once 'config2.php';

	$link = mysql_connect($server, $user, $password);
	mysql_select_db($dbname);

	$query = '
		SELECT
		        `link`,
		        `infoid`,
		        `name`,
		        `size`,
		        `lastupdate`,
		        `tracker`
		  FROM
		        `cm_dl_links`
		  ORDER BY
		        `id`
		';
	$result = mysql_query($query, $link);

	while( $row = mysql_fetch_assoc($result) ) {
		$query = '
			UPDATE
			        `cm_dl_info`
			  SET
			        `link`       = "'.mysql_real_escape_string($row['link']).'",
			        `dlname`     = "'.mysql_real_escape_string($row['name']).'",
			        `size`       = "'.mysql_real_escape_string($row['size']).'",
			        `lastupdate` = "'.mysql_real_escape_string($row['lastupdate']).'",
			        `tracker`    = "'.mysql_real_escape_string($row['tracker']).'"
			  WHERE
			        `id` = "'.$row['infoid'].'
			';
		mysql_query($query, $link)
			or die(mysql_error());
	}

?>
 
Wow, sieht ser komplex aus, dank dir!

Nun kommt aber:

Code:
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 10
 
Er sagt Syntax Fehler in Zeile 10...

Zeile 10

PHP:
                `link`,

in der Spalte Link sind URLs aber keine Zahlen. Wie kommt er dann auf die 1?
...Check the manual that corresponds to your MySQL server version for the right syntax to use near '"1' at line 10
 
Wenn ich error_reporting (E_ALL) benutze kommt folgende Fehlermeldung...

Parse error: parse error, unexpected T_REQUIRE_ONCE in /website/dbchange.php on line 5
 
Zurück