If i have error in the script below. My intention is to make a script which displays the fields of one row at a time, u can edit them and after u click on modify the values should be updated and u should be taken to the next row. Does anyone see any errors? You have some suggestions?
Thanks!
<?php
if($filename){ //If row is in buffer
require("sqlconnect.php");
mysql_query("UPDATE data set filename= '$filename', description = '$description', gorevalue= '$gorevalue'where filename ='$filename'");
$row = mysql_fetch_object($result);
}
else{
require("sqlconnect.php");
$result = mysql_query("Select from data Order by filename limit $begin,$eind");
$row = mysql_fetch_object($result);
}
if(!isset($begin)){ //If $begin isn't initialised yet, give it the value 1
$begin=1;
$eind=2;
}
else{
$begin=$begin+1;
$eind=$eind+1;
}
if ($row->gorevalue==0) $array=array('Selected','','','','','');
elseif ($row->gorevalue==1) $array=(array('','Selected','','','','');
elseif ($row->gorevalue==2) $array=(array('','','Selected','','','');
elseif ($row->gorevalue==3) $array=(array('','','','Selected','','');
elseif ($row->gorevalue==4) $array=(array('','','','','Selected','');
elseif ($row->gorevalue==5) $array=(array('','','','','','Selected');
echo <form method="post" action="modify.php?begin=$begin&eind=$eind> ?>
Filename : <input type="text" name="filename" value="<?php echo $row->filename;?>"><br>
Description : <input type="text" name="description" value="<?php echo $row->description;?>"><br>
Value : <Select name="gorevalue">
<option value="0" <?php echo $array[0];?>>NONE</OPTION>
<option value="1" <?php echo $array[1];?>></OPTION>
<option value="2" <?php echo $array[2];?>></OPTION>
<option value="3" <?php echo $array[3];?>></OPTION>
<option value="4" <?php echo $array[4];?>></OPTION>
<option value="5" <?php echo $array[5];?>>**</OPTION>
</select><br><br>
<input type="submit" value="Modify">
</form>