yeah im really going slow with this! :eek:
When I try the code:
<?
$sql = "SELECT name, title FROM authors ORDER BY name, title ASC";
$result = mysql_query($sql);
?>
<tr>
<td align="center">
<table width="400" border="0" cellspacing="1" cellpadding="4" bgcolor="#F2F2F2">
<tr bgcolor="#CCCCCC">
<td> </td>
<td><?php print "$admin_authorname"; ?></td>
<td><?php print "$admin_title"; ?></td>
<td colspan="3"><?php print "$admin_opreation"; ?></td>
</tr>
<?php
if (!empty($result)) {
while ( list($key,$val)=each($result) ) {
$authorid = stripslashes($val["authorid"]);
$name = stripslashes($val["authorname"]);
$title = stripslashes($val["title"]);
$picture = stripslashes($val["picture"]);
?>
<tr bgcolor="#FFFFFF">
<td><?php print "$authorid"; ?></td>
<td><?php print "$name"; ?></td>
<td><?php print "$title"; ?></td>
<td valign="middle" align="center"><a href="authoradmin.php?page=<?php print "$page";?>&picid=<?php print "$authorid"; ?>" class="en_b">
<?php
if ($picture>'') {
?>
<img src="<?php echo $PicturePath.$picture;?>" height="30" width="30" border="0">
<?php
}
?>
<?php ($picture>'') ? print "$admin_change" : print "$admin_add"; ?>
</a></td>
<td><a href="authoradmin.php?editid=<?php print "$authorid"; ?>" class="en_b"><?php print "$admin_edit"; ?></a></td>
<td><a href="authoradmin.php?delid=<?php print "$authorid"; ?>" class="en_b"><?php print "$admin_del"; ?></a></td>
</tr>
<?php
}
}
?>
<tr bgcolor="#FFFFFF">
<td align="right" colspan="6">
<?php
$pagenext = $page+1;
$result1 = $db->getallauthors($pagenext,$record);
if ($page!=0)
{
$pagepre = $page-1;
print "<a href=\"$PHP_SELF?page=$pagepre\"><font color=\"#FF0000\">$admin_previouspage</font></a> ";
}
if (!empty($result1))
{
print "<a href=\"$PHP_SELF?page=$pagenext\"><font color=\"#FF0000\">$admin_nextpage</font></a> ";
}
?>
I get an empty output.
When I try:
(only difference being 'SELECT' authorname, or name)
<?
$sql = "SELECT authorname, title FROM authors ORDER BY authorname, title ASC";
$result = mysql_query($sql);
?>
<tr>
<td align="center">
<table width="400" border="0" cellspacing="1" cellpadding="4" bgcolor="#F2F2F2">
<tr bgcolor="#CCCCCC">
<td> </td>
<td><?php print "$admin_authorname"; ?></td>
<td><?php print "$admin_title"; ?></td>
<td colspan="3"><?php print "$admin_opreation"; ?></td>
</tr>
<?php
if (!empty($result)) {
while ( list($key,$val)=each($result) ) {
$authorid = stripslashes($val["authorid"]);
$name = stripslashes($val["authorname"]);
$title = stripslashes($val["title"]);
$picture = stripslashes($val["picture"]);
?>
<tr bgcolor="#FFFFFF">
<td><?php print "$authorid"; ?></td>
<td><?php print "$name"; ?></td>
<td><?php print "$title"; ?></td>
<td valign="middle" align="center"><a href="authoradmin.php?page=<?php print "$page";?>&picid=<?php print "$authorid"; ?>" class="en_b">
<?php
if ($picture>'') {
?>
<img src="<?php echo $PicturePath.$picture;?>" height="30" width="30" border="0">
<?php
}
?>
<?php ($picture>'') ? print "$admin_change" : print "$admin_add"; ?>
</a></td>
<td><a href="authoradmin.php?editid=<?php print "$authorid"; ?>" class="en_b"><?php print "$admin_edit"; ?></a></td>
<td><a href="authoradmin.php?delid=<?php print "$authorid"; ?>" class="en_b"><?php print "$admin_del"; ?></a></td>
</tr>
<?php
}
}
?>
<tr bgcolor="#FFFFFF">
<td align="right" colspan="6">
<?php
$pagenext = $page+1;
$result1 = $db->getallauthors($pagenext,$record);
if ($page!=0)
{
$pagepre = $page-1;
print "<a href=\"$PHP_SELF?page=$pagepre\"><font color=\"#FF0000\">$admin_previouspage</font></a> ";
}
if (!empty($result1))
{
print "<a href=\"$PHP_SELF?page=$pagenext\"><font color=\"#FF0000\">$admin_nextpage</font></a> ";
}
?>
I get the error:
Warning: Variable passed to each() is not an array or object in /home/stfusaco/public_html/news/admin/authoradmin.php on line 214
Line 214 being:
while ( list($key,$val)=each($result) ) {
😕 :eek: :xbones: