Jump to content

[SOLVED] While loop missing first entry in db


wrathican

Recommended Posts

hey guys.

i have a script that contains a dropdown list that is populated by querying a DB.

 

The only problem is the list is missing out the first entry in the table. no matter whether or not it is the actual first entry with an id of 1 or its the 50th with and id of 50 and all of records 1-49 have been deleted it still would not show.

 

any ideas why this is happening?

 

heres my script(it's not all of because most of it is irrelevant, and yes i have started the session :P):

<?php


$userid = $_SESSION['userid'];
$query = "SELECT album_id, album_name FROM ls12_album WHERE album_ownerid='".$userid."'";
$result = mysql_query($query);
$array = fetchArray($result);
$numRows = mysql_num_rows($result);
if($numRows == 0){
echo "Sorry, but none of the albums belong to you. Please create an album.";
}else{
echo $userid;
?>
<form action="../functions/memberfunctions.php?func=addimage" method="post" enctype="multipart/form-data" name="frmAlbum" id="frmAlbum" class="form">
Add To Album:<br />
<?php

echo '<select name="albumId">';
while ($row = mysql_fetch_assoc($result)+1) {
//declare vars
$albumid = $row['album_id'];
$albumtitle = $row['album_name'];

echo '<option value="'.$albumid.'">'.$albumtitle.'</option>';
}
echo "</select>";

?>
<br />
Image Title:<br />
<input name="imgName" type="text" id="txtName"><br />
Description:<br />
<textarea name="imgDesc" cols="50" rows="4" id="mtxDesc"></textarea><br />
Image:<br />
<input name="fileImage" type="file" class="box" id="fleImage"><br />
<input name="btnAdd" type="submit" id="btnAdd" value="Add Image"> 
<input name="btnCancel" type="button" id="btnCancel" value="Cancel" onClick="window.history.back();">
</form>

<?php
}

?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.