Found a solution, but recieving a error
ERROR:
Warning: Cannot use a scalar value as an array in SYS:/apache2/folder/folder/folder/folder/folder/updatedDocument3.php on line 64
61-thats the id number for that row-
This error comes up for every row, and then displays the row number like i ask it to.
Could someone please look at this and let me know what you think. I have not seen this error prior.
PHP Code:
<?php
//This include links to the connection to the database, which holds the following function | connectToDB();
include('_admin/connectToDB.php');
// This is closeing the database connection
connectToDB();
//The table we are choosing to connect to
$tbl_name = "table";
?>
<div>
<img border="0" src="images/manuals.jpg"><br><img border="0" src="images/home.jpg" >
<p>Product Manual Maintence | Updated Document Page</p>
<!-- Sections For Product Manual Maintenance -->
<!-- Submitting the Form -->
<!-- Selection of Latest Document -->
<?php
$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
// Count table rows
$count=mysql_num_rows($result);
?>
<table cellpadding=1 cellspacing=0 border=1 valign="top">
<form name="form1" method="post" action="">
<p><b>Latest Document:</b><br>info:</p>
<tr>
<td colspan=8 bgcolor="#999900" align=center><font color="white"><b>subject</b></font></td>
</tr>
<tr>
<!--categories-->
<td width=1%><font size=-2><b>ID</b></font></td>
<td width=15%><font size=-2><b>Title</b></font></td>
<td width=9%><font size=-2><b>File Name</b></font></td>
<td width=35%><font size=-2><b>Document</b></font></td>
<td width=8%><font size=-2><b>version</b></font></td>
<td width=15%><font size=-2><b>Last Updated</b></font></td>
<td width=8%><font size=-2><b>Document Hidden</b></font></td>
<td width=8%><font size=-2><b>Title Hidden</b></font></td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td align="center"><? $id[]=$rows['id']; ?><? echo $rows['id']; ?></td>
<td align="center"><input name="title[]" type="text" id="title" value="<? echo $rows['title']; ?>"></td>
<td align="center"><input name="filename[]" type="text" id="filename" value="<? echo $rows['filename']; ?>"></td>
<td align="center"><input name="document[]" type="text" id="document" value="<? echo $rows['document']; ?>"></td>
<td align="center"><input name="version[]" type="text" id="version" value="<? echo $rows['version']; ?>"></td>
<td align="center"><input name="date[]" type="text" id="date" value="<? echo $rows['date']; ?>"></td>
<td align="center"><input name="documenthide[]" type="text" id="documenthide" value="<? echo $rows['documenthide']; ?>"></td>
<td align="center"><input name="titlehide[]" type="text" id="titlehide" value="<? echo $rows['titlehide']; ?>"></td> </tr>
</tr>
<?php
}
?>
<tr>
<td colspan="4" align="center"><input type="submit" name="Submit" value="Submit"></td>
</tr>
</form>
</table>
<?php
// Check if button name "Submit" is active, do this
if($Submit){
for($i=0;$i<$count;$i++){
$sql1="UPDATE $tbl_name SET
title='$title[$i]',
filename='$filename[$i]',
document='$document[$i]'
version='$version[$i]',
date='$date[$i]',
documenthide='$documenthide[$i]',
titlehide='$titlehide[$i]',
WHERE id='$id[$i]'";
$result1=mysql_query($sql1);
}
}
if($result1){
echo 'working';
}
mysql_close();
?>
__________________
Bookmarks