Location: PHPKode > projects > 427BB > avatars.php
<?php

include 'sql_connect.php';

$sql = "SELECT Avatar, ID, UserName FROM Personal order by UserName ASC";
$query = mysql_query($sql) or die (mysql_error());
while ($row = mysql_fetch_row($query)) {
	$avatar = $row[0];
	$ID = $row[1];
	$name = stripslashes($row[2]);
	$old = "/<img src=\"(.*?)\"/";
	$new = "<img src=\"$1\" alt=\"$1\"";
	$avatar = preg_replace($old, $new, $avatar);
	$savatar = htmlentities($avatar);
	$nsql = "UPDATE Personal SET Avatar='$avatar' WHERE ID=$ID";
	mysql_query($nsql) or $error .= mysql_error() . "\n";
}
if ($error != NULL) {
	echo $error;
} else {
	echo "OK";
}
echo "\n";

?>
Return current item: 427BB