Firefox PHP

Phorum Rename Author

Posted by Justin 
Phorum Rename Author
June 07, 2001 05:23PM
I wrote this code for my site to change the Author name at one time.
If you found it useful please mail me, lihlih@ipoh1.f2s.com


Justin
[www.ipoh1.f2s.com]


========= Code Begin =========

if ($author && $field && $newauthor && $Submit) {
$result = mysql($database,"SELECT id,author FROM $field WHERE author='$author'");
if ($result) {
$num = mysql_num_rows($result);
echo "Total Updated: ".$num."<br>";
$num--;
for($i=1;$i<=$num;$i++) {
$id = mysql_result($result,$i,"id");
echo "ID:";
echo $id;
echo "<br>";
mysql($database,"UPDATE $field SET author = '$newauthor' WHERE (id = '$id')");
}
mysql_free_result ($result);
}
}
?>
<form action="<?php echo $PHP_SELF; ?>">
Author:<br><input type="text" size=20 maxlength=40 name="author" value="">
<br>
New Author:<br><input type="text" size=20 maxlength=40 name="newauthor" value="">
<br>
Forums Name:<br><input type="text" size=20 maxlength=40 name="field" value="">
<br>

<input type="submit" name="Submit" value="submit">

========= Code End =========
Sorry, you do not have permission to post/reply in this forum.