473,729 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using arrays to take records from a html table and update database

Hello
Needing help with a suitable solution.
I have extracted records into a table under three columns 'category',
'comment' and share (the category column also holds the index no of the
record in a hidden field)
I wish the user to be able to edit the data in the table, so I have
extracted the records into hiddenfield, textareas, dropdown list and
checkbox so that they can make changes.
I named these elements as arrays and wish to run an sql to take each row in
turn (and any changes made) and update the mysql table. I did something
similar with just one record but am stuck as to how I use the arrays of a
number of form elements together

My code for the table is below but I dont know how the script should go when
the form is submitted to add each row in turn
Help greatly appreciated
Ian
*************** *************** *************** *************** **********
<form action="comment select.php" method="post" enctype="multip art/form-data"
name="UpdateCom ments">
<table width="100%" border="0" cellpadding="0" cellspacing="2"
bgcolor="#FFFFF F">
<tr align="center" class="ListHead ing">
<td width="20%" height="31">Cat egory</td>
<td width="60%" height="31">Com ment</td>
<td width="10%" height="31">Sha re</td>
</tr>
<tr class="BodyText ">
<?php
while($row =& mysql_fetch_arr ay($commentresu lts)) {
extract($row);

if ($i%2) {
$class = 'row1';
echo "<TR bgcolor=\"#CCCC CC\">\n";

} else {
$class = 'row2';
echo "<TR bgcolor=\"white \">\n";
}
$i += 1;
?>
<td width="20%" align="left" class="bodytext "><select
name="category[]" style="WIDTH: 90%">
<option value="<?php echo $row['TypeID']; ?>"><?php echo $row['typedesc'];
?></option>
<?php
$commenttype = mysql_query("SE LECT * FROM commenttype WHERE username =
'$username'");
if (!$commenttype) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
while($row1 =& mysql_fetch_arr ay($commenttype )) {
extract($row1);
?>
<option value="<?php echo $row1['TypeID']; ?>"><?php echo
$row1['typedesc']; ?><br>
</option>
<?php
}
?>
</select>
<input name="commindex[]" type="hidden" value="<?php echo $commindex;
?>"></td>
<td width="60%" align="left" class="bodytext " <textarea
name="comm[]" rows="2" style="WIDTH: 99%"><?php echo $comment;
?></textarea></td>
<td width="10%" align="center" class="bodytext "><input type="checkbox"
name="avail[]" value="checkbox " <?php share($availabl e); ?> </td>
</tr>
<?php
}
?>
</table>
</form>

*************** *************** *************** ***************
Jul 25 '06 #1
16 3495
If I understand you correctly, the way I would do it is the same way I have
my DVD database. This is rather than have the name of the elements as
"commindex[]" etc, actually place the table creation inside your while loop
and increment the naming field using the i variable you use, ie:
"commindex[<?=$i?>]".

As an example of what I mean, here is an excerpt of my DVD database code
which you can view at "http:// mydvds . psiss . com"

------------------------------------------------------
if($allRecords 0)
{
$recordCount = 0;
while($recordCo unt < $allRecords)
{
if(($recordCoun t / 2) % 2 == 1)
{
?>
<tr align="center" class="tr_even" >
<?
}
else
{
?>
<tr align="center" class="tr_odd">
<?
}
for($colCount = 0; $colCount < 2 && $recordCount < $allRecords;
$colCount++)
{
$dataArray = mysql_fetch_arr ay($result);
$dataArray['starring'] = str_replace("\r ","<BR>",$dataA rray['starring']);
$dataArray['synopsis'] = str_replace("\r ","<BR>",$dataA rray['synopsis']);
$dataArray['duration'] = date('H:i',strt otime($dataArra y['duration']));
?>
<td background="ima ges/barSilver.jpg" width="30"><?=( $recordCount +
1)?></td>
<td width="4">&nbsp ;</td>
<td>
<div class="div_info " style="position : absolute; width: 400px;
z-index: 1; visibility: hidden;" id="infoLayer_< ?=$recordCount? >"
align="left"><b ><u><?=$dataArr ay['title']?></u></b><p><u>Starrin g:</u><br><i><?=$da taArray['starring']?></i></p><p><?=$dataAr ray['synopsis']?></p></div>
<?
if($dataArray['dvd_image'] == "None")
{
?>
<img id="img_<?=$rec ordCount?>" width="50" height="70"
src="images/dvds/none_small.jpg"
onmouseover="po pShow(this,img_ <?=$recordCount ?>,'infoLayer_< ?=$recordCount? >',img_<?=$reco rdCount?>.width
+ 5,5)" onmouseout="pop Hide('infoLayer _<?=$recordCoun t?>')">
<?
}
else
{
?>
<img id="img_<?=$rec ordCount?>" width="50" height="70"
src="images/dvds/<?=$dataArray['dvd_image']?>"
onmouseover="po pShow(this,img_ <?=$recordCount ?>,'infoLayer_< ?=$recordCount? >',img_<?=$reco rdCount?>.width
+ 5,5)" onmouseout="pop Hide('infoLayer _<?=$recordCoun t?>')">
<?
}
echo " <img
src='images/certs/".$certImag e[$dataArray['certificate']].".gif'><BR>".$ dataArray['title'];
?>
</td>
<td width="4">&nbsp ;</td>
<td><b>Released </b><br><?=$dataA rray['year']?><br>
<b>Duration</b><br><?=$dataA rray['duration']?><br>
<b>Rating</b><br><img alt="Rating: <?=$dataArray['rating']/2?>"
align="absmiddl e"
src="images/ratings/pips<?=$dataArr ay['rating']?>.gif"></td>
<td width="4">&nbsp ;</td>
<?
$recordCount++;
}
?>
</tr>
<?
}
}
----------------------------------
"Ian Davies" <ia********@vir gin.netwrote in message
news:j3******** *******@newsfe3-win.ntli.net...
Hello
Needing help with a suitable solution.
I have extracted records into a table under three columns 'category',
'comment' and share (the category column also holds the index no of the
record in a hidden field)
I wish the user to be able to edit the data in the table, so I have
extracted the records into hiddenfield, textareas, dropdown list and
checkbox so that they can make changes.
I named these elements as arrays and wish to run an sql to take each row
in
turn (and any changes made) and update the mysql table. I did something
similar with just one record but am stuck as to how I use the arrays of a
number of form elements together

My code for the table is below but I dont know how the script should go
when
the form is submitted to add each row in turn
Help greatly appreciated
Ian
*************** *************** *************** *************** **********
<form action="comment select.php" method="post"
enctype="multip art/form-data"
name="UpdateCom ments">
<table width="100%" border="0" cellpadding="0" cellspacing="2"
bgcolor="#FFFFF F">
<tr align="center" class="ListHead ing">
<td width="20%" height="31">Cat egory</td>
<td width="60%" height="31">Com ment</td>
<td width="10%" height="31">Sha re</td>
</tr>
<tr class="BodyText ">
<?php
while($row =& mysql_fetch_arr ay($commentresu lts)) {
extract($row);

if ($i%2) {
$class = 'row1';
echo "<TR bgcolor=\"#CCCC CC\">\n";

} else {
$class = 'row2';
echo "<TR bgcolor=\"white \">\n";
}
$i += 1;
?>
<td width="20%" align="left" class="bodytext "><select
name="category[]" style="WIDTH: 90%">
<option value="<?php echo $row['TypeID']; ?>"><?php echo $row['typedesc'];
?></option>
<?php
$commenttype = mysql_query("SE LECT * FROM commenttype WHERE username =
'$username'");
if (!$commenttype) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
while($row1 =& mysql_fetch_arr ay($commenttype )) {
extract($row1);
?>
<option value="<?php echo $row1['TypeID']; ?>"><?php echo
$row1['typedesc']; ?><br>
</option>
<?php
}
?>
</select>
<input name="commindex[]" type="hidden" value="<?php echo $commindex;
?>"></td>
<td width="60%" align="left" class="bodytext " <textarea
name="comm[]" rows="2" style="WIDTH: 99%"><?php echo $comment;
?></textarea></td>
<td width="10%" align="center" class="bodytext "><input
type="checkbox"
name="avail[]" value="checkbox " <?php share($availabl e); ?> </td>
</tr>
<?php
}
?>
</table>
</form>

*************** *************** *************** ***************


Jul 26 '06 #2
Thanks for the reply
The problem Im having isnt creating a table with the records in it. That
works fine. Im trying to find a way where the users can modify the records
in a table and they are all updated in one go. I thought using arrays would
be the answer, but Im not that familiar with them. At the moment the users
click a button at the begining of a row and that record is displated on a
new page where it can be updated. But this requires the user to click and
update one record at a time. Whereas I wish them to make all the changes to
all the records they want in the table and then on clicking a button some
script would take each row in turn and update that row in te database, it
would then loop through all the rows in the table and update each
accordingly

Hope this explains it better

Ian

"PSI_Orion" <or***@psiss.co mwrote in message
news:uF******** **********@news fe6-gui.ntli.net...
If I understand you correctly, the way I would do it is the same way I
have
my DVD database. This is rather than have the name of the elements as
"commindex[]" etc, actually place the table creation inside your while
loop
and increment the naming field using the i variable you use, ie:
"commindex[<?=$i?>]".

As an example of what I mean, here is an excerpt of my DVD database code
which you can view at "http:// mydvds . psiss . com"

------------------------------------------------------
if($allRecords 0)
{
$recordCount = 0;
while($recordCo unt < $allRecords)
{
if(($recordCoun t / 2) % 2 == 1)
{
?>
<tr align="center" class="tr_even" >
<?
}
else
{
?>
<tr align="center" class="tr_odd">
<?
}
for($colCount = 0; $colCount < 2 && $recordCount < $allRecords;
$colCount++)
{
$dataArray = mysql_fetch_arr ay($result);
$dataArray['starring'] =
str_replace("\r ","<BR>",$dataA rray['starring']);
$dataArray['synopsis'] =
str_replace("\r ","<BR>",$dataA rray['synopsis']);
$dataArray['duration'] = date('H:i',strt otime($dataArra y['duration']));
?>
<td background="ima ges/barSilver.jpg" width="30"><?=( $recordCount +
1)?></td>
<td width="4">&nbsp ;</td>
<td>
<div class="div_info " style="position : absolute; width: 400px;
z-index: 1; visibility: hidden;" id="infoLayer_< ?=$recordCount? >"
align="left"><b ><u><?=$dataArr ay['title']?></u></b><p><u>Starrin g:</u><br><i
><?=$dataArra y['starring']?></i></p><p><?=$dataAr ray['synopsis']?></p></div>
<?
if($dataArray['dvd_image'] == "None")
{
?>
<img id="img_<?=$rec ordCount?>" width="50" height="70"
src="images/dvds/none_small.jpg"
onmouseover="po pShow(this,img_ <?=$recordCount ?>,'infoLayer_< ?=$recordCount? >
',img_<?=$recor dCount?>.width
+ 5,5)" onmouseout="pop Hide('infoLayer _<?=$recordCoun t?>')">
<?
}
else
{
?>
<img id="img_<?=$rec ordCount?>" width="50" height="70"
src="images/dvds/<?=$dataArray['dvd_image']?>"
onmouseover="po pShow(this,img_ <?=$recordCount ?>,'infoLayer_< ?=$recordCount? >
',img_<?=$recor dCount?>.width
+ 5,5)" onmouseout="pop Hide('infoLayer _<?=$recordCoun t?>')">
<?
}
echo " <img
src='images/certs/".$certImag e[$dataArray['certificate']].".gif'><BR>".$ data
Array['title'];
?>
</td>
<td width="4">&nbsp ;</td>
<td><b>Released </b><br><?=$dataA rray['year']?><br>
<b>Duration</b><br><?=$dataA rray['duration']?><br>
<b>Rating</b><br><img alt="Rating: <?=$dataArray['rating']/2?>"
align="absmiddl e"
src="images/ratings/pips<?=$dataArr ay['rating']?>.gif"></td>
<td width="4">&nbsp ;</td>
<?
$recordCount++;
}
?>
</tr>
<?
}
}
----------------------------------
"Ian Davies" <ia********@vir gin.netwrote in message
news:j3******** *******@newsfe3-win.ntli.net...
Hello
Needing help with a suitable solution.
I have extracted records into a table under three columns 'category',
'comment' and share (the category column also holds the index no of the
record in a hidden field)
I wish the user to be able to edit the data in the table, so I have
extracted the records into hiddenfield, textareas, dropdown list and
checkbox so that they can make changes.
I named these elements as arrays and wish to run an sql to take each row
in
turn (and any changes made) and update the mysql table. I did something
similar with just one record but am stuck as to how I use the arrays of
a
number of form elements together

My code for the table is below but I dont know how the script should go
when
the form is submitted to add each row in turn
Help greatly appreciated
Ian
*************** *************** *************** *************** **********
<form action="comment select.php" method="post"
enctype="multip art/form-data"
name="UpdateCom ments">
<table width="100%" border="0" cellpadding="0" cellspacing="2"
bgcolor="#FFFFF F">
<tr align="center" class="ListHead ing">
<td width="20%" height="31">Cat egory</td>
<td width="60%" height="31">Com ment</td>
<td width="10%" height="31">Sha re</td>
</tr>
<tr class="BodyText ">
<?php
while($row =& mysql_fetch_arr ay($commentresu lts)) {
extract($row);

if ($i%2) {
$class = 'row1';
echo "<TR bgcolor=\"#CCCC CC\">\n";

} else {
$class = 'row2';
echo "<TR bgcolor=\"white \">\n";
}
$i += 1;
?>
<td width="20%" align="left" class="bodytext "><select
name="category[]" style="WIDTH: 90%">
<option value="<?php echo $row['TypeID']; ?>"><?php echo
$row['typedesc'];
?></option>
<?php
$commenttype = mysql_query("SE LECT * FROM commenttype WHERE username =
'$username'");
if (!$commenttype) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
while($row1 =& mysql_fetch_arr ay($commenttype )) {
extract($row1);
?>
<option value="<?php echo $row1['TypeID']; ?>"><?php echo
$row1['typedesc']; ?><br>
</option>
<?php
}
?>
</select>
<input name="commindex[]" type="hidden" value="<?php echo
$commindex;
?>"></td>
<td width="60%" align="left" class="bodytext " <textarea
name="comm[]" rows="2" style="WIDTH: 99%"><?php echo $comment;
?></textarea></td>
<td width="10%" align="center" class="bodytext "><input
type="checkbox"
name="avail[]" value="checkbox " <?php share($availabl e); ?> </td>
</tr>
<?php
}
?>
</table>
</form>

*************** *************** *************** ***************


Jul 26 '06 #3
Yes, that explains it much better. Which field is it you are trying to
amend? Is it a simple yes/no type field? If so then you need to adjust
your query accordingly. I don't have time right now to explain fully but if
you send me a personal email to orion at psiss dot com I will try and
explain how I would approach it.

Regards

PSI_Orion

"Ian Davies" <ia********@vir gin.netwrote in message
news:Bw******** **********@news fe1-win.ntli.net...
Thanks for the reply
The problem Im having isnt creating a table with the records in it. That
works fine. Im trying to find a way where the users can modify the records
in a table and they are all updated in one go. I thought using arrays
would
be the answer, but Im not that familiar with them. At the moment the users
click a button at the begining of a row and that record is displated on a
new page where it can be updated. But this requires the user to click and
update one record at a time. Whereas I wish them to make all the changes
to
all the records they want in the table and then on clicking a button some
script would take each row in turn and update that row in te database, it
would then loop through all the rows in the table and update each
accordingly

Hope this explains it better

Ian

"PSI_Orion" <or***@psiss.co mwrote in message
news:uF******** **********@news fe6-gui.ntli.net...
>If I understand you correctly, the way I would do it is the same way I
have
>my DVD database. This is rather than have the name of the elements as
"commindex[]" etc, actually place the table creation inside your while
loop
>and increment the naming field using the i variable you use, ie:
"commindex[<?=$i?>]".

As an example of what I mean, here is an excerpt of my DVD database code
which you can view at "http:// mydvds . psiss . com"

------------------------------------------------------
if($allRecor ds 0)
{
$recordCount = 0;
while($recordCo unt < $allRecords)
{
if(($recordCoun t / 2) % 2 == 1)
{
?>
<tr align="center" class="tr_even" >
<?
}
else
{
?>
<tr align="center" class="tr_odd">
<?
}
for($colCount = 0; $colCount < 2 && $recordCount < $allRecords;
$colCount++)
{
$dataArray = mysql_fetch_arr ay($result);
$dataArray['starring'] =
str_replace("\r ","<BR>",$dataA rray['starring']);
> $dataArray['synopsis'] =
str_replace("\r ","<BR>",$dataA rray['synopsis']);
> $dataArray['duration'] =
date('H:i',str totime($dataArr ay['duration']));
?>
<td background="ima ges/barSilver.jpg" width="30"><?=( $recordCount +
1)?></td>
<td width="4">&nbsp ;</td>
<td>
<div class="div_info " style="position : absolute; width: 400px;
z-index: 1; visibility: hidden;" id="infoLayer_< ?=$recordCount? >"
align="left"><b ><u><?=$dataArr ay['title']?></u></b><p><u>Starrin g:</u><br><i
>><?=$dataArr ay['starring']?></i></p><p><?=$dataAr ray['synopsis']?></p></div>
<?
if($dataArray['dvd_image'] == "None")
{
?>
<img id="img_<?=$rec ordCount?>" width="50" height="70"
src="images/dvds/none_small.jpg"
onmouseover="po pShow(this,img_ <?=$recordCount ?>,'infoLayer_< ?=$recordCount? >
',img_<?=$recor dCount?>.width
>+ 5,5)" onmouseout="pop Hide('infoLayer _<?=$recordCoun t?>')">
<?
}
else
{
?>
<img id="img_<?=$rec ordCount?>" width="50" height="70"
src="images/dvds/<?=$dataArray['dvd_image']?>"
onmouseover="po pShow(this,img_ <?=$recordCount ?>,'infoLayer_< ?=$recordCount? >
',img_<?=$recor dCount?>.width
>+ 5,5)" onmouseout="pop Hide('infoLayer _<?=$recordCoun t?>')">
<?
}
echo " <img
src='images/certs/".$certImag e[$dataArray['certificate']].".gif'><BR>".$ data
Array['title'];
>?>
</td>
<td width="4">&nbsp ;</td>
<td><b>Released </b><br><?=$dataA rray['year']?><br>
<b>Duration</b><br><?=$dataA rray['duration']?><br>
<b>Rating</b><br><img alt="Rating: <?=$dataArray['rating']/2?>"
align="absmidd le"
src="images/ratings/pips<?=$dataArr ay['rating']?>.gif"></td>
<td width="4">&nbsp ;</td>
<?
$recordCount++;
}
?>
</tr>
<?
}
}
----------------------------------
"Ian Davies" <ia********@vir gin.netwrote in message
news:j3******* ********@newsfe 3-win.ntli.net...
Hello
Needing help with a suitable solution.
I have extracted records into a table under three columns 'category',
'comment' and share (the category column also holds the index no of the
record in a hidden field)
I wish the user to be able to edit the data in the table, so I have
extracted the records into hiddenfield, textareas, dropdown list and
checkbox so that they can make changes.
I named these elements as arrays and wish to run an sql to take each
row
in
turn (and any changes made) and update the mysql table. I did something
similar with just one record but am stuck as to how I use the arrays of
a
number of form elements together

My code for the table is below but I dont know how the script should go
when
the form is submitted to add each row in turn
Help greatly appreciated
Ian
*************** *************** *************** *************** **********
<form action="comment select.php" method="post"
enctype="multip art/form-data"
name="UpdateCom ments">
<table width="100%" border="0" cellpadding="0" cellspacing="2"
bgcolor="#FFFFF F">
<tr align="center" class="ListHead ing">
<td width="20%" height="31">Cat egory</td>
<td width="60%" height="31">Com ment</td>
<td width="10%" height="31">Sha re</td>
</tr>
<tr class="BodyText ">
<?php
while($row =& mysql_fetch_arr ay($commentresu lts)) {
extract($row);

if ($i%2) {
$class = 'row1';
echo "<TR bgcolor=\"#CCCC CC\">\n";

} else {
$class = 'row2';
echo "<TR bgcolor=\"white \">\n";
}
$i += 1;
?>
<td width="20%" align="left" class="bodytext "><select
name="category[]" style="WIDTH: 90%">
<option value="<?php echo $row['TypeID']; ?>"><?php echo
$row['typedesc'];
?></option>
<?php
$commenttype = mysql_query("SE LECT * FROM commenttype WHERE username =
'$username'");
if (!$commenttype) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
while($row1 =& mysql_fetch_arr ay($commenttype )) {
extract($row1);
?>
<option value="<?php echo $row1['TypeID']; ?>"><?php
echo
$row1['typedesc']; ?><br>
</option>
<?php
}
?>
</select>
<input name="commindex[]" type="hidden" value="<?php echo
$commindex;
?>"></td>
<td width="60%" align="left" class="bodytext " <textarea
name="comm[]" rows="2" style="WIDTH: 99%"><?php echo $comment;
?></textarea></td>
<td width="10%" align="center" class="bodytext "><input
type="checkbox"
name="avail[]" value="checkbox " <?php share($availabl e); ?> </td>
</tr>
<?php
}
?>
</table>
</form>

*************** *************** *************** ***************




Jul 26 '06 #4
Hi
I am trying to amend three fields all one text and two integer
In my original code you will see what I mean
The values for the text field would come from a textarea in one column of
the table and the values for the two integer fields would come from a
dropdown list and a tick box which are in the other columns.
Ian
"PSI_Orion" <or***@psiss.co mwrote in message
news:MQ******** *******@newsfe3-win.ntli.net...
Yes, that explains it much better. Which field is it you are trying to
amend? Is it a simple yes/no type field? If so then you need to adjust
your query accordingly. I don't have time right now to explain fully but
if
you send me a personal email to orion at psiss dot com I will try and
explain how I would approach it.

Regards

PSI_Orion

"Ian Davies" <ia********@vir gin.netwrote in message
news:Bw******** **********@news fe1-win.ntli.net...
Thanks for the reply
The problem Im having isnt creating a table with the records in it. That
works fine. Im trying to find a way where the users can modify the
records
in a table and they are all updated in one go. I thought using arrays
would
be the answer, but Im not that familiar with them. At the moment the
users
click a button at the begining of a row and that record is displated on
a
new page where it can be updated. But this requires the user to click
and
update one record at a time. Whereas I wish them to make all the changes
to
all the records they want in the table and then on clicking a button
some
script would take each row in turn and update that row in te database,
it
would then loop through all the rows in the table and update each
accordingly

Hope this explains it better

Ian

"PSI_Orion" <or***@psiss.co mwrote in message
news:uF******** **********@news fe6-gui.ntli.net...
If I understand you correctly, the way I would do it is the same way I
have
my DVD database. This is rather than have the name of the elements as
"commindex[]" etc, actually place the table creation inside your while
loop
and increment the naming field using the i variable you use, ie:
"commindex[<?=$i?>]".

As an example of what I mean, here is an excerpt of my DVD database
code
which you can view at "http:// mydvds . psiss . com"

------------------------------------------------------
if($allRecords 0)
{
$recordCount = 0;
while($recordCo unt < $allRecords)
{
if(($recordCoun t / 2) % 2 == 1)
{
?>
<tr align="center" class="tr_even" >
<?
}
else
{
?>
<tr align="center" class="tr_odd">
<?
}
for($colCount = 0; $colCount < 2 && $recordCount < $allRecords;
$colCount++)
{
$dataArray = mysql_fetch_arr ay($result);
$dataArray['starring'] =
str_replace("\r ","<BR>",$dataA rray['starring']);
$dataArray['synopsis'] =
str_replace("\r ","<BR>",$dataA rray['synopsis']);
$dataArray['duration'] =
date('H:i',strt otime($dataArra y['duration']));
?>
<td background="ima ges/barSilver.jpg" width="30"><?=( $recordCount +
1)?></td>
<td width="4">&nbsp ;</td>
<td>
<div class="div_info " style="position : absolute; width: 400px;
z-index: 1; visibility: hidden;" id="infoLayer_< ?=$recordCount? >"
align="left"><b ><u><?=$dataArr ay['title']?></u></b><p><u>Starrin g:</u><br><i
>
>><?=$dataArr ay['starring']?></i></p><p><?=$dataAr ray['synopsis']?></p></div
<?
if($dataArray['dvd_image'] == "None")
{
?>
<img id="img_<?=$rec ordCount?>" width="50" height="70"
src="images/dvds/none_small.jpg"
onmouseover="po pShow(this,img_ <?=$recordCount ?>,'infoLayer_< ?=$recordCount? >
',img_<?=$recor dCount?>.width
+ 5,5)" onmouseout="pop Hide('infoLayer _<?=$recordCoun t?>')">
<?
}
else
{
?>
<img id="img_<?=$rec ordCount?>" width="50" height="70"
src="images/dvds/<?=$dataArray['dvd_image']?>"
onmouseover="po pShow(this,img_ <?=$recordCount ?>,'infoLayer_< ?=$recordCount? >
',img_<?=$recor dCount?>.width
+ 5,5)" onmouseout="pop Hide('infoLayer _<?=$recordCoun t?>')">
<?
}
echo " <img
src='images/certs/".$certImag e[$dataArray['certificate']].".gif'><BR>".$ data
Array['title'];
?>
</td>
<td width="4">&nbsp ;</td>
<td><b>Released </b><br><?=$dataA rray['year']?><br>
<b>Duration</b><br><?=$dataA rray['duration']?><br>
<b>Rating</b><br><img alt="Rating: <?=$dataArray['rating']/2?>"
align="absmiddl e"
src="images/ratings/pips<?=$dataArr ay['rating']?>.gif"></td>
<td width="4">&nbsp ;</td>
<?
$recordCount++;
}
?>
</tr>
<?
}
}
----------------------------------
"Ian Davies" <ia********@vir gin.netwrote in message
news:j3******** *******@newsfe3-win.ntli.net...
Hello
Needing help with a suitable solution.
I have extracted records into a table under three columns 'category',
'comment' and share (the category column also holds the index no of
the
record in a hidden field)
I wish the user to be able to edit the data in the table, so I have
extracted the records into hiddenfield, textareas, dropdown list and
checkbox so that they can make changes.
I named these elements as arrays and wish to run an sql to take each
row
in
turn (and any changes made) and update the mysql table. I did
something
similar with just one record but am stuck as to how I use the arrays
of
a
number of form elements together

My code for the table is below but I dont know how the script should
go
when
the form is submitted to add each row in turn
Help greatly appreciated
Ian
*************** *************** *************** *************** **********
<form action="comment select.php" method="post"
enctype="multip art/form-data"
name="UpdateCom ments">
<table width="100%" border="0" cellpadding="0" cellspacing="2"
bgcolor="#FFFFF F">
<tr align="center" class="ListHead ing">
<td width="20%" height="31">Cat egory</td>
<td width="60%" height="31">Com ment</td>
<td width="10%" height="31">Sha re</td>
</tr>
<tr class="BodyText ">
<?php
while($row =& mysql_fetch_arr ay($commentresu lts)) {
extract($row);

if ($i%2) {
$class = 'row1';
echo "<TR bgcolor=\"#CCCC CC\">\n";

} else {
$class = 'row2';
echo "<TR bgcolor=\"white \">\n";
}
$i += 1;
?>
<td width="20%" align="left" class="bodytext "><select
name="category[]" style="WIDTH: 90%">
<option value="<?php echo $row['TypeID']; ?>"><?php echo
$row['typedesc'];
?></option>
<?php
$commenttype = mysql_query("SE LECT * FROM commenttype WHERE username
=
'$username'");
if (!$commenttype) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
while($row1 =& mysql_fetch_arr ay($commenttype )) {
extract($row1);
?>
<option value="<?php echo $row1['TypeID']; ?>"><?php
echo
$row1['typedesc']; ?><br>
</option>
<?php
}
?>
</select>
<input name="commindex[]" type="hidden" value="<?php echo
$commindex;
?>"></td>
<td width="60%" align="left" class="bodytext " <textarea
name="comm[]" rows="2" style="WIDTH: 99%"><?php echo $comment;
?></textarea></td>
<td width="10%" align="center" class="bodytext "><input
type="checkbox"
name="avail[]" value="checkbox " <?php share($availabl e); ?>>
</td>
</tr>
<?php
}
?>
</table>
</form>

*************** *************** *************** ***************





Jul 27 '06 #5
I'm presuming comment is the textbox (or do you use textarea), category is
the dropdown and share is the checkbox?

I'm working on a solution now so I'm hoping I have it right.

PSI_Orion

"Ian Davies" <ia********@vir gin.netwrote in message
news:Q9******** **********@news fe2-win.ntli.net...
Hi
I am trying to amend three fields all one text and two integer
In my original code you will see what I mean
The values for the text field would come from a textarea in one column of
the table and the values for the two integer fields would come from a
dropdown list and a tick box which are in the other columns.
Ian
"PSI_Orion" <or***@psiss.co mwrote in message
news:MQ******** *******@newsfe3-win.ntli.net...
>Yes, that explains it much better. Which field is it you are trying to
amend? Is it a simple yes/no type field? If so then you need to adjust
your query accordingly. I don't have time right now to explain fully but
if
>you send me a personal email to orion at psiss dot com I will try and
explain how I would approach it.

Regards

PSI_Orion

"Ian Davies" <ia********@vir gin.netwrote in message
news:Bw******* ***********@new sfe1-win.ntli.net...
Thanks for the reply
The problem Im having isnt creating a table with the records in it.
That
works fine. Im trying to find a way where the users can modify the
records
in a table and they are all updated in one go. I thought using arrays
would
be the answer, but Im not that familiar with them. At the moment the
users
click a button at the begining of a row and that record is displated on
a
new page where it can be updated. But this requires the user to click
and
update one record at a time. Whereas I wish them to make all the
changes
to
all the records they want in the table and then on clicking a button
some
script would take each row in turn and update that row in te database,
it
would then loop through all the rows in the table and update each
accordingly

Hope this explains it better

Ian

"PSI_Orion" <or***@psiss.co mwrote in message
news:uF******** **********@news fe6-gui.ntli.net...
If I understand you correctly, the way I would do it is the same way I
have
my DVD database. This is rather than have the name of the elements as
"commindex[]" etc, actually place the table creation inside your while
loop
and increment the naming field using the i variable you use, ie:
"commindex[<?=$i?>]".

As an example of what I mean, here is an excerpt of my DVD database
code
>which you can view at "http:// mydvds . psiss . com"

------------------------------------------------------
if($allRecor ds 0)
{
$recordCount = 0;
while($recordCo unt < $allRecords)
{
if(($recordCoun t / 2) % 2 == 1)
{
?>
<tr align="center" class="tr_even" >
<?
}
else
{
?>
<tr align="center" class="tr_odd">
<?
}
for($colCount = 0; $colCount < 2 && $recordCount < $allRecords;
$colCount++)
{
$dataArray = mysql_fetch_arr ay($result);
$dataArray['starring'] =
str_replace("\r ","<BR>",$dataA rray['starring']);
$dataArray['synopsis'] =
str_replace("\r ","<BR>",$dataA rray['synopsis']);
$dataArray['duration'] =
date('H:i',str totime($dataArr ay['duration']));
?>
<td background="ima ges/barSilver.jpg" width="30"><?=( $recordCount +
1)?></td>
<td width="4">&nbsp ;</td>
<td>
<div class="div_info " style="position : absolute; width: 400px;
z-index: 1; visibility: hidden;" id="infoLayer_< ?=$recordCount? >"

align="left"><b ><u><?=$dataArr ay['title']?></u></b><p><u>Starrin g:</u><br><i
>>
>>><?=$dataArra y['starring']?></i></p><p><?=$dataAr ray['synopsis']?></p></div
><?
if($dataArray['dvd_image'] == "None")
{
?>
<img id="img_<?=$rec ordCount?>" width="50" height="70"
src="images/dvds/none_small.jpg"

onmouseover="po pShow(this,img_ <?=$recordCount ?>,'infoLayer_< ?=$recordCount? >
',img_<?=$recor dCount?>.width
+ 5,5)" onmouseout="pop Hide('infoLayer _<?=$recordCoun t?>')">
<?
}
else
{
?>
<img id="img_<?=$rec ordCount?>" width="50" height="70"
src="images/dvds/<?=$dataArray['dvd_image']?>"

onmouseover="po pShow(this,img_ <?=$recordCount ?>,'infoLayer_< ?=$recordCount? >
',img_<?=$recor dCount?>.width
+ 5,5)" onmouseout="pop Hide('infoLayer _<?=$recordCoun t?>')">
<?
}
echo " <img

src='images/certs/".$certImag e[$dataArray['certificate']].".gif'><BR>".$ data
Array['title'];
?>
</td>
<td width="4">&nbsp ;</td>
<td><b>Released </b><br><?=$dataA rray['year']?><br>
<b>Duration</b><br><?=$dataA rray['duration']?><br>
<b>Rating</b><br><img alt="Rating: <?=$dataArray['rating']/2?>"
align="absmidd le"
src="images/ratings/pips<?=$dataArr ay['rating']?>.gif"></td>
<td width="4">&nbsp ;</td>
<?
$recordCount++;
}
?>
</tr>
<?
}
}
----------------------------------
"Ian Davies" <ia********@vir gin.netwrote in message
news:j3******* ********@newsfe 3-win.ntli.net...
Hello
Needing help with a suitable solution.
I have extracted records into a table under three columns
'category',
'comment' and share (the category column also holds the index no of
the
record in a hidden field)
I wish the user to be able to edit the data in the table, so I have
extracted the records into hiddenfield, textareas, dropdown list and
checkbox so that they can make changes.
I named these elements as arrays and wish to run an sql to take each
row
in
turn (and any changes made) and update the mysql table. I did
something
similar with just one record but am stuck as to how I use the arrays
of
a
number of form elements together

My code for the table is below but I dont know how the script should
go
when
the form is submitted to add each row in turn
Help greatly appreciated
Ian
*************** *************** *************** *************** **********
<form action="comment select.php" method="post"
enctype="multip art/form-data"
name="UpdateCom ments">
<table width="100%" border="0" cellpadding="0" cellspacing="2"
bgcolor="#FFFFF F">
<tr align="center" class="ListHead ing">
<td width="20%" height="31">Cat egory</td>
<td width="60%" height="31">Com ment</td>
<td width="10%" height="31">Sha re</td>
</tr>
<tr class="BodyText ">
<?php
while($row =& mysql_fetch_arr ay($commentresu lts)) {
extract($row);

if ($i%2) {
$class = 'row1';
echo "<TR bgcolor=\"#CCCC CC\">\n";

} else {
$class = 'row2';
echo "<TR bgcolor=\"white \">\n";
}
$i += 1;
?>
<td width="20%" align="left" class="bodytext "><select
name="category[]" style="WIDTH: 90%">
<option value="<?php echo $row['TypeID']; ?>"><?php echo
$row['typedesc'];
?></option>
<?php
$commenttype = mysql_query("SE LECT * FROM commenttype WHERE username
=
'$username'");
if (!$commenttype) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
while($row1 =& mysql_fetch_arr ay($commenttype )) {
extract($row1);
?>
<option value="<?php echo $row1['TypeID']; ?>"><?php
echo
$row1['typedesc']; ?><br>
</option>
<?php
}
?>
</select>
<input name="commindex[]" type="hidden" value="<?php echo
$commindex;
?>"></td>
<td width="60%" align="left" class="bodytext " <textarea
name="comm[]" rows="2" style="WIDTH: 99%"><?php echo $comment;
?></textarea></td>
<td width="10%" align="center" class="bodytext "><input
type="checkbox"
name="avail[]" value="checkbox " <?php share($availabl e); ?>>
</td>
</tr>
<?php
}
?>
</table>
</form>

*************** *************** *************** ***************




Jul 27 '06 #6
Hello
That is correct. also comment is a textarea. and a hidden field to contain
the index of each row to use to update the correct record in the subsequent
sql statement.

Is your solution somehow based on creating an array from each of the
elements.
The solution i was trying to do was to get 4 arrays and somehow use them in
a loop with an sql update. But Im lost as to how to create and use the
arrays appropriately

Cheers
Ian
also I greatly appreciate your assistance
"PSI_Orion" <or***@psiss.co mwrote in message
news:e7******** **********@news fe1-win.ntli.net...
I'm presuming comment is the textbox (or do you use textarea), category is
the dropdown and share is the checkbox?

I'm working on a solution now so I'm hoping I have it right.

PSI_Orion

"Ian Davies" <ia********@vir gin.netwrote in message
news:Q9******** **********@news fe2-win.ntli.net...
Hi
I am trying to amend three fields all one text and two integer
In my original code you will see what I mean
The values for the text field would come from a textarea in one column
of
the table and the values for the two integer fields would come from a
dropdown list and a tick box which are in the other columns.
Ian
"PSI_Orion" <or***@psiss.co mwrote in message
news:MQ******** *******@newsfe3-win.ntli.net...
Yes, that explains it much better. Which field is it you are trying to
amend? Is it a simple yes/no type field? If so then you need to
adjust
your query accordingly. I don't have time right now to explain fully
but
if
you send me a personal email to orion at psiss dot com I will try and
explain how I would approach it.

Regards

PSI_Orion

"Ian Davies" <ia********@vir gin.netwrote in message
news:Bw******** **********@news fe1-win.ntli.net...
Thanks for the reply
The problem Im having isnt creating a table with the records in it.
That
works fine. Im trying to find a way where the users can modify the
records
in a table and they are all updated in one go. I thought using arrays
would
be the answer, but Im not that familiar with them. At the moment the
users
click a button at the begining of a row and that record is displated
on
a
new page where it can be updated. But this requires the user to click
and
update one record at a time. Whereas I wish them to make all the
changes
to
all the records they want in the table and then on clicking a button
some
script would take each row in turn and update that row in te
database,
it
would then loop through all the rows in the table and update each
accordingly

Hope this explains it better

Ian

"PSI_Orion" <or***@psiss.co mwrote in message
news:uF******** **********@news fe6-gui.ntli.net...
If I understand you correctly, the way I would do it is the same way
I
have
my DVD database. This is rather than have the name of the elements
as
"commindex[]" etc, actually place the table creation inside your
while
loop
and increment the naming field using the i variable you use, ie:
"commindex[<?=$i?>]".

As an example of what I mean, here is an excerpt of my DVD database
code
which you can view at "http:// mydvds . psiss . com"

------------------------------------------------------
if($allRecords 0)
{
$recordCount = 0;
while($recordCo unt < $allRecords)
{
if(($recordCoun t / 2) % 2 == 1)
{
?>
<tr align="center" class="tr_even" >
<?
}
else
{
?>
<tr align="center" class="tr_odd">
<?
}
for($colCount = 0; $colCount < 2 && $recordCount < $allRecords;
$colCount++)
{
$dataArray = mysql_fetch_arr ay($result);
$dataArray['starring'] =
str_replace("\r ","<BR>",$dataA rray['starring']);
$dataArray['synopsis'] =
str_replace("\r ","<BR>",$dataA rray['synopsis']);
$dataArray['duration'] =
date('H:i',strt otime($dataArra y['duration']));
?>
<td background="ima ges/barSilver.jpg" width="30"><?=( $recordCount
+
1)?></td>
<td width="4">&nbsp ;</td>
<td>
<div class="div_info " style="position : absolute; width: 400px;
z-index: 1; visibility: hidden;" id="infoLayer_< ?=$recordCount? >"
align="left"><b ><u><?=$dataArr ay['title']?></u></b><p><u>Starrin g:</u><br><i
>
>>><?=$dataArra y['starring']?></i></p><p><?=$dataAr ray['synopsis']?></p></di
v
>
<?
if($dataArray['dvd_image'] == "None")
{
?>
<img id="img_<?=$rec ordCount?>" width="50" height="70"
src="images/dvds/none_small.jpg"
onmouseover="po pShow(this,img_ <?=$recordCount ?>,'infoLayer_< ?=$recordCount? >
',img_<?=$recor dCount?>.width
+ 5,5)" onmouseout="pop Hide('infoLayer _<?=$recordCoun t?>')">
<?
}
else
{
?>
<img id="img_<?=$rec ordCount?>" width="50" height="70"
src="images/dvds/<?=$dataArray['dvd_image']?>"
onmouseover="po pShow(this,img_ <?=$recordCount ?>,'infoLayer_< ?=$recordCount? >
',img_<?=$recor dCount?>.width
+ 5,5)" onmouseout="pop Hide('infoLayer _<?=$recordCoun t?>')">
<?
}
echo " <img
src='images/certs/".$certImag e[$dataArray['certificate']].".gif'><BR>".$ data
Array['title'];
?>
</td>
<td width="4">&nbsp ;</td>
<td><b>Released </b><br><?=$dataA rray['year']?><br>
<b>Duration</b><br><?=$dataA rray['duration']?><br>
<b>Rating</b><br><img alt="Rating: <?=$dataArray['rating']/2?>"
align="absmiddl e"
src="images/ratings/pips<?=$dataArr ay['rating']?>.gif"></td>
<td width="4">&nbsp ;</td>
<?
$recordCount++;
}
?>
</tr>
<?
}
}
----------------------------------
"Ian Davies" <ia********@vir gin.netwrote in message
news:j3******** *******@newsfe3-win.ntli.net...
Hello
Needing help with a suitable solution.
I have extracted records into a table under three columns
'category',
'comment' and share (the category column also holds the index no
of
the
record in a hidden field)
I wish the user to be able to edit the data in the table, so I
have
extracted the records into hiddenfield, textareas, dropdown list
and
checkbox so that they can make changes.
I named these elements as arrays and wish to run an sql to take
each
row
in
turn (and any changes made) and update the mysql table. I did
something
similar with just one record but am stuck as to how I use the
arrays
of
a
number of form elements together

My code for the table is below but I dont know how the script
should
go
when
the form is submitted to add each row in turn
Help greatly appreciated
Ian
*************** *************** *************** *************** **********
<form action="comment select.php" method="post"
enctype="multip art/form-data"
name="UpdateCom ments">
<table width="100%" border="0" cellpadding="0" cellspacing="2"
bgcolor="#FFFFF F">
<tr align="center" class="ListHead ing">
<td width="20%" height="31">Cat egory</td>
<td width="60%" height="31">Com ment</td>
<td width="10%" height="31">Sha re</td>
</tr>
<tr class="BodyText ">
<?php
while($row =& mysql_fetch_arr ay($commentresu lts)) {
extract($row);

if ($i%2) {
$class = 'row1';
echo "<TR bgcolor=\"#CCCC CC\">\n";

} else {
$class = 'row2';
echo "<TR bgcolor=\"white \">\n";
}
$i += 1;
?>
<td width="20%" align="left" class="bodytext "><select
name="category[]" style="WIDTH: 90%">
<option value="<?php echo $row['TypeID']; ?>"><?php echo
$row['typedesc'];
?></option>
<?php
$commenttype = mysql_query("SE LECT * FROM commenttype WHERE
username
=
'$username'");
if (!$commenttype) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
while($row1 =& mysql_fetch_arr ay($commenttype )) {
extract($row1);
?>
<option value="<?php echo $row1['TypeID'];
?>"><?php
echo
$row1['typedesc']; ?><br>
</option>
<?php
}
?>
</select>
<input name="commindex[]" type="hidden" value="<?php echo
$commindex;
?>"></td>
<td width="60%" align="left" class="bodytext " <textarea
name="comm[]" rows="2" style="WIDTH: 99%"><?php echo $comment;
?></textarea></td>
<td width="10%" align="center" class="bodytext "><input
type="checkbox"
name="avail[]" value="checkbox " <?php share($availabl e); ?>>
</td>
</tr>
<?php
}
?>
</table>
</form>

*************** *************** *************** ***************







Jul 27 '06 #7
'....and a hidden field to contain...'
SHOULD READ
'....and I also have a hidden field that contains...'
ian
"Ian Davies" <ia********@vir gin.netwrote in message
news:EJ******** ***********@new sfe4-win.ntli.net...
Hello
That is correct. also comment is a textarea. and a hidden field to contain
the index of each row to use to update the correct record in the
subsequent
sql statement.

Is your solution somehow based on creating an array from each of the
elements.
The solution i was trying to do was to get 4 arrays and somehow use them
in
a loop with an sql update. But Im lost as to how to create and use the
arrays appropriately

Cheers
Ian
also I greatly appreciate your assistance
"PSI_Orion" <or***@psiss.co mwrote in message
news:e7******** **********@news fe1-win.ntli.net...
I'm presuming comment is the textbox (or do you use textarea), category
is
the dropdown and share is the checkbox?

I'm working on a solution now so I'm hoping I have it right.

PSI_Orion

"Ian Davies" <ia********@vir gin.netwrote in message
news:Q9******** **********@news fe2-win.ntli.net...
Hi
I am trying to amend three fields all one text and two integer
In my original code you will see what I mean
The values for the text field would come from a textarea in one column
of
the table and the values for the two integer fields would come from a
dropdown list and a tick box which are in the other columns.
Ian
>
>
"PSI_Orion" <or***@psiss.co mwrote in message
news:MQ******** *******@newsfe3-win.ntli.net...
>Yes, that explains it much better. Which field is it you are trying
to
>amend? Is it a simple yes/no type field? If so then you need to
adjust
>your query accordingly. I don't have time right now to explain fully
but
if
>you send me a personal email to orion at psiss dot com I will try and
>explain how I would approach it.
>>
>Regards
>>
>PSI_Orion
>>
>"Ian Davies" <ia********@vir gin.netwrote in message
>news:Bw******* ***********@new sfe1-win.ntli.net...
Thanks for the reply
The problem Im having isnt creating a table with the records in it.
That
works fine. Im trying to find a way where the users can modify the
records
in a table and they are all updated in one go. I thought using
arrays
would
be the answer, but Im not that familiar with them. At the moment
the
users
click a button at the begining of a row and that record is
displated
on
a
new page where it can be updated. But this requires the user to
click
and
update one record at a time. Whereas I wish them to make all the
changes
to
all the records they want in the table and then on clicking a
button
some
script would take each row in turn and update that row in te
database,
it
would then loop through all the rows in the table and update each
accordingly
>
Hope this explains it better
>
Ian
>
"PSI_Orion" <or***@psiss.co mwrote in message
news:uF******** **********@news fe6-gui.ntli.net...
>If I understand you correctly, the way I would do it is the same
way
I
have
>my DVD database. This is rather than have the name of the
elements
as
>"commindex[]" etc, actually place the table creation inside your
while
loop
>and increment the naming field using the i variable you use, ie:
>"commindex[<?=$i?>]".
>>
>As an example of what I mean, here is an excerpt of my DVD
database
code
>which you can view at "http:// mydvds . psiss . com"
>>
>------------------------------------------------------
>if($allRecor ds 0)
>{
> $recordCount = 0;
> while($recordCo unt < $allRecords)
> {
> if(($recordCoun t / 2) % 2 == 1)
> {
>?>
> <tr align="center" class="tr_even" >
><?
> }
> else
> {
>?>
> <tr align="center" class="tr_odd">
><?
> }
> for($colCount = 0; $colCount < 2 && $recordCount < $allRecords;
>$colCount++)
> {
> $dataArray = mysql_fetch_arr ay($result);
> $dataArray['starring'] =
str_replace("\r ","<BR>",$dataA rray['starring']);
> $dataArray['synopsis'] =
str_replace("\r ","<BR>",$dataA rray['synopsis']);
> $dataArray['duration'] =
>date('H:i',str totime($dataArr ay['duration']));
>?>
> <td background="ima ges/barSilver.jpg"
width="30"><?=( $recordCount
+
>1)?></td>
> <td width="4">&nbsp ;</td>
> <td>
> <div class="div_info " style="position : absolute; width:
400px;
>z-index: 1; visibility: hidden;" id="infoLayer_< ?=$recordCount? >"
>>
>
>
align="left"><b ><u><?=$dataArr ay['title']?></u></b><p><u>Starrin g:</u><br><i
>>
>>><?=$dataArra y['starring']?></i></p><p><?=$dataAr ray['synopsis']?></p></di
v
>>
><?
> if($dataArray['dvd_image'] == "None")
> {
>?>
> <img id="img_<?=$rec ordCount?>" width="50" height="70"
>src="images/dvds/none_small.jpg"
>>
>
>
onmouseover="po pShow(this,img_ <?=$recordCount ?>,'infoLayer_< ?=$recordCount? >
',img_<?=$recor dCount?>.width
>+ 5,5)" onmouseout="pop Hide('infoLayer _<?=$recordCoun t?>')">
><?
> }
> else
> {
>?>
> <img id="img_<?=$rec ordCount?>" width="50" height="70"
>src="images/dvds/<?=$dataArray['dvd_image']?>"
>>
>
>
onmouseover="po pShow(this,img_ <?=$recordCount ?>,'infoLayer_< ?=$recordCount? >
',img_<?=$recor dCount?>.width
>+ 5,5)" onmouseout="pop Hide('infoLayer _<?=$recordCoun t?>')">
><?
> }
> echo " <img
>>
>
>
src='images/certs/".$certImag e[$dataArray['certificate']].".gif'><BR>".$ data
Array['title'];
>?>
> </td>
> <td width="4">&nbsp ;</td>
> <td><b>Released </b><br><?=$dataA rray['year']?><br>
> <b>Duration</b><br><?=$dataA rray['duration']?><br>
> <b>Rating</b><br><img alt="Rating: <?=$dataArray['rating']/2?>"
>align="absmidd le"
>src="images/ratings/pips<?=$dataArr ay['rating']?>.gif"></td>
> <td width="4">&nbsp ;</td>
><?
> $recordCount++;
> }
>?>
> </tr>
><?
> }
>}
>----------------------------------
>>
>>
>"Ian Davies" <ia********@vir gin.netwrote in message
>news:j3******* ********@newsfe 3-win.ntli.net...
Hello
Needing help with a suitable solution.
I have extracted records into a table under three columns
'category',
'comment' and share (the category column also holds the index no
of
the
record in a hidden field)
I wish the user to be able to edit the data in the table, so I
have
extracted the records into hiddenfield, textareas, dropdown list
and
checkbox so that they can make changes.
I named these elements as arrays and wish to run an sql to take
each
row
in
turn (and any changes made) and update the mysql table. I did
something
similar with just one record but am stuck as to how I use the
arrays
of
a
number of form elements together
>
My code for the table is below but I dont know how the script
should
go
when
the form is submitted to add each row in turn
Help greatly appreciated
Ian
>
*************** *************** *************** *************** **********
<form action="comment select.php" method="post"
enctype="multip art/form-data"
name="UpdateCom ments">
<table width="100%" border="0" cellpadding="0" cellspacing="2"
bgcolor="#FFFFF F">
<tr align="center" class="ListHead ing">
<td width="20%" height="31">Cat egory</td>
<td width="60%" height="31">Com ment</td>
<td width="10%" height="31">Sha re</td>
</tr>
<tr class="BodyText ">
<?php
while($row =& mysql_fetch_arr ay($commentresu lts)) {
extract($row);
>
if ($i%2) {
$class = 'row1';
echo "<TR bgcolor=\"#CCCC CC\">\n";
>
} else {
$class = 'row2';
echo "<TR bgcolor=\"white \">\n";
}
$i += 1;
?>
<td width="20%" align="left" class="bodytext "><select
name="category[]" style="WIDTH: 90%">
<option value="<?php echo $row['TypeID']; ?>"><?php echo
$row['typedesc'];
?></option>
<?php
$commenttype = mysql_query("SE LECT * FROM commenttype WHERE
username
=
'$username'");
if (!$commenttype) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
while($row1 =& mysql_fetch_arr ay($commenttype )) {
extract($row1);
?>
<option value="<?php echo $row1['TypeID'];
?>"><?php
echo
$row1['typedesc']; ?><br>
</option>
<?php
}
?>
</select>
<input name="commindex[]" type="hidden" value="<?php echo
$commindex;
?>"></td>
<td width="60%" align="left" class="bodytext ">
<textarea
name="comm[]" rows="2" style="WIDTH: 99%"><?php echo $comment;
?></textarea></td>
<td width="10%" align="center" class="bodytext "><input
type="checkbox"
name="avail[]" value="checkbox " <?php share($availabl e); ?>>
</td>
</tr>
<?php
}
?>
</table>
</form>
>
*************** *************** *************** ***************
>
>
>>
>>
>
>
>>
>>
>
>


Jul 27 '06 #8
Take a look at http://www.psiss.com/dummy to see if I'm on the right lines.
Obviously it's not nicely formatted and the "Update" checkboxes would be
hidden and automatically set on an onchange event in the fields. Also, it
doesn't actually do any changes right now as I need to work on that more but
I wanted to make sure I'm on the right lines first. Just tick some update
checkboxes, click submit and see if that's what you are after.

Chris

"Ian Davies" <ia********@vir gin.netwrote in message
news:KL******** **********@news fe4-win.ntli.net...
'....and a hidden field to contain...'
SHOULD READ
'....and I also have a hidden field that contains...'
ian
"Ian Davies" <ia********@vir gin.netwrote in message
news:EJ******** ***********@new sfe4-win.ntli.net...
>Hello
That is correct. also comment is a textarea. and a hidden field to
contain
the index of each row to use to update the correct record in the
subsequent
>sql statement.

Is your solution somehow based on creating an array from each of the
elements.
The solution i was trying to do was to get 4 arrays and somehow use them
in
>a loop with an sql update. But Im lost as to how to create and use the
arrays appropriately

Cheers
Ian
also I greatly appreciate your assistance
"PSI_Orion" <or***@psiss.co mwrote in message
news:e7******* ***********@new sfe1-win.ntli.net...
I'm presuming comment is the textbox (or do you use textarea), category
is
the dropdown and share is the checkbox?

I'm working on a solution now so I'm hoping I have it right.

PSI_Orion

"Ian Davies" <ia********@vir gin.netwrote in message
news:Q9******** **********@news fe2-win.ntli.net...
Hi
I am trying to amend three fields all one text and two integer
In my original code you will see what I mean
The values for the text field would come from a textarea in one
column
of
the table and the values for the two integer fields would come from a
dropdown list and a tick box which are in the other columns.
Ian
"PSI_Orion" <or***@psiss.co mwrote in message
news:MQ******** *******@newsfe3-win.ntli.net...
Yes, that explains it much better. Which field is it you are trying
to
>amend? Is it a simple yes/no type field? If so then you need to
adjust
>your query accordingly. I don't have time right now to explain
fully
but
if
you send me a personal email to orion at psiss dot com I will try
and
explain how I would approach it.

Regards

PSI_Orion

"Ian Davies" <ia********@vir gin.netwrote in message
news:Bw******* ***********@new sfe1-win.ntli.net...
Thanks for the reply
The problem Im having isnt creating a table with the records in
it.
That
works fine. Im trying to find a way where the users can modify the
records
in a table and they are all updated in one go. I thought using
arrays
would
be the answer, but Im not that familiar with them. At the moment
the
users
click a button at the begining of a row and that record is
displated
>on
a
new page where it can be updated. But this requires the user to
click
and
update one record at a time. Whereas I wish them to make all the
changes
to
all the records they want in the table and then on clicking a
button
some
script would take each row in turn and update that row in te
database,
it
would then loop through all the rows in the table and update each
accordingly

Hope this explains it better

Ian

"PSI_Orion" <or***@psiss.co mwrote in message
news:uF******** **********@news fe6-gui.ntli.net...
If I understand you correctly, the way I would do it is the same
way
>I
have
my DVD database. This is rather than have the name of the
elements
>as
>"commindex[]" etc, actually place the table creation inside your
while
loop
and increment the naming field using the i variable you use, ie:
"commindex[<?=$i?>]".

As an example of what I mean, here is an excerpt of my DVD
database
code
which you can view at "http:// mydvds . psiss . com"

------------------------------------------------------
if($allRecor ds 0)
{
$recordCount = 0;
while($recordCo unt < $allRecords)
{
if(($recordCoun t / 2) % 2 == 1)
{
?>
<tr align="center" class="tr_even" >
<?
}
else
{
?>
<tr align="center" class="tr_odd">
<?
}
for($colCount = 0; $colCount < 2 && $recordCount < $allRecords;
$colCount++)
{
$dataArray = mysql_fetch_arr ay($result);
$dataArray['starring'] =
str_replace("\r ","<BR>",$dataA rray['starring']);
$dataArray['synopsis'] =
str_replace("\r ","<BR>",$dataA rray['synopsis']);
$dataArray['duration'] =
date('H:i',str totime($dataArr ay['duration']));
?>
<td background="ima ges/barSilver.jpg"
width="30"><?=( $recordCount
>+
>1)?></td>
<td width="4">&nbsp ;</td>
<td>
<div class="div_info " style="position : absolute; width:
400px;
>z-index: 1; visibility: hidden;" id="infoLayer_< ?=$recordCount? >"
align="left"><b ><u><?=$dataArr ay['title']?></u></b><p><u>Starrin g:</u><br><i
>>
>>>><?=$dataArr ay['starring']?></i></p><p><?=$dataAr ray['synopsis']?></p></di
v
>>
<?
if($dataArray['dvd_image'] == "None")
{
?>
<img id="img_<?=$rec ordCount?>" width="50" height="70"
src="images/dvds/none_small.jpg"
onmouseover="po pShow(this,img_ <?=$recordCount ?>,'infoLayer_< ?=$recordCount? >
',img_<?=$recor dCount?>.width
+ 5,5)" onmouseout="pop Hide('infoLayer _<?=$recordCoun t?>')">
<?
}
else
{
?>
<img id="img_<?=$rec ordCount?>" width="50" height="70"
src="images/dvds/<?=$dataArray['dvd_image']?>"
onmouseover="po pShow(this,img_ <?=$recordCount ?>,'infoLayer_< ?=$recordCount? >
',img_<?=$recor dCount?>.width
+ 5,5)" onmouseout="pop Hide('infoLayer _<?=$recordCoun t?>')">
<?
}
echo " <img
src='images/certs/".$certImag e[$dataArray['certificate']].".gif'><BR>".$ data
Array['title'];
?>
</td>
<td width="4">&nbsp ;</td>
<td><b>Released </b><br><?=$dataA rray['year']?><br>
<b>Duration</b><br><?=$dataA rray['duration']?><br>
<b>Rating</b><br><img alt="Rating:
<?=$dataArra y['rating']/2?>"
align="absmidd le"
src="images/ratings/pips<?=$dataArr ay['rating']?>.gif"></td>
<td width="4">&nbsp ;</td>
<?
$recordCount++;
}
?>
</tr>
<?
}
}
----------------------------------
"Ian Davies" <ia********@vir gin.netwrote in message
news:j3******* ********@newsfe 3-win.ntli.net...
Hello
Needing help with a suitable solution.
I have extracted records into a table under three columns
'category',
'comment' and share (the category column also holds the index
no
of
the
record in a hidden field)
I wish the user to be able to edit the data in the table, so I
have
extracted the records into hiddenfield, textareas, dropdown
list
and
checkbox so that they can make changes.
I named these elements as arrays and wish to run an sql to take
each
row
in
turn (and any changes made) and update the mysql table. I did
something
similar with just one record but am stuck as to how I use the
arrays
of
a
number of form elements together

My code for the table is below but I dont know how the script
should
go
when
the form is submitted to add each row in turn
Help greatly appreciated
Ian

*************** *************** *************** *************** **********
<form action="comment select.php" method="post"
enctype="multip art/form-data"
name="UpdateCom ments">
<table width="100%" border="0" cellpadding="0" cellspacing="2"
bgcolor="#FFFFF F">
<tr align="center" class="ListHead ing">
<td width="20%" height="31">Cat egory</td>
<td width="60%" height="31">Com ment</td>
<td width="10%" height="31">Sha re</td>
</tr>
<tr class="BodyText ">
<?php
while($row =& mysql_fetch_arr ay($commentresu lts)) {
extract($row);

if ($i%2) {
$class = 'row1';
echo "<TR bgcolor=\"#CCCC CC\">\n";

} else {
$class = 'row2';
echo "<TR bgcolor=\"white \">\n";
}
$i += 1;
?>
<td width="20%" align="left" class="bodytext "><select
name="category[]" style="WIDTH: 90%">
<option value="<?php echo $row['TypeID']; ?>"><?php echo
$row['typedesc'];
?></option>
<?php
$commenttype = mysql_query("SE LECT * FROM commenttype WHERE
username
=
'$username'");
if (!$commenttype) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
while($row1 =& mysql_fetch_arr ay($commenttype )) {
extract($row1);
?>
<option value="<?php echo $row1['TypeID'];
?>"><?php
echo
$row1['typedesc']; ?><br>
</option>
<?php
}
?>
</select>
<input name="commindex[]" type="hidden" value="<?php echo
$commindex;
?>"></td>
<td width="60%" align="left" class="bodytext ">
<textarea
name="comm[]" rows="2" style="WIDTH: 99%"><?php echo $comment;
?></textarea></td>
<td width="10%" align="center" class="bodytext "><input
type="checkbox"
name="avail[]" value="checkbox " <?php share($availabl e); ?>>
</td>
</tr>
<?php
}
?>
</table>
</form>

*************** *************** *************** ***************






Jul 27 '06 #9
Yes thats exactly what I have so far. except I dont have an update check
box, which I didnt include because I suspect some users would make changes
to the comments and categories etc but would forget to tick the update check
box. My solution was to update ALL the displayed records. this wouldnt be a
problem as there would only be about between 5 and 100 so not a big deal if
some are updated despite no changes being made. Also I dont have the ID
displayed (its meaninless to the user), its in a hidden field which I
planned to use to reference the correct record from the database table

ian

"PSI_Orion" <or***@psiss.co mwrote in message
news:aE******** ***********@new sfe6-gui.ntli.net...
Take a look at http://www.psiss.com/dummy to see if I'm on the right
lines.
Obviously it's not nicely formatted and the "Update" checkboxes would be
hidden and automatically set on an onchange event in the fields. Also, it
doesn't actually do any changes right now as I need to work on that more
but
I wanted to make sure I'm on the right lines first. Just tick some update
checkboxes, click submit and see if that's what you are after.

Chris

"Ian Davies" <ia********@vir gin.netwrote in message
news:KL******** **********@news fe4-win.ntli.net...
'....and a hidden field to contain...'
SHOULD READ
'....and I also have a hidden field that contains...'
ian
"Ian Davies" <ia********@vir gin.netwrote in message
news:EJ******** ***********@new sfe4-win.ntli.net...
Hello
That is correct. also comment is a textarea. and a hidden field to
contain
the index of each row to use to update the correct record in the
subsequent
sql statement.

Is your solution somehow based on creating an array from each of the
elements.
The solution i was trying to do was to get 4 arrays and somehow use
them
in
a loop with an sql update. But Im lost as to how to create and use the
arrays appropriately

Cheers
Ian
also I greatly appreciate your assistance
"PSI_Orion" <or***@psiss.co mwrote in message
news:e7******** **********@news fe1-win.ntli.net...
I'm presuming comment is the textbox (or do you use textarea),
category
is
the dropdown and share is the checkbox?

I'm working on a solution now so I'm hoping I have it right.

PSI_Orion

"Ian Davies" <ia********@vir gin.netwrote in message
news:Q9******** **********@news fe2-win.ntli.net...
Hi
I am trying to amend three fields all one text and two integer
In my original code you will see what I mean
The values for the text field would come from a textarea in one
column
of
the table and the values for the two integer fields would come from
a
dropdown list and a tick box which are in the other columns.
Ian
>
>
"PSI_Orion" <or***@psiss.co mwrote in message
news:MQ******** *******@newsfe3-win.ntli.net...
>Yes, that explains it much better. Which field is it you are
trying
to
>amend? Is it a simple yes/no type field? If so then you need to
adjust
>your query accordingly. I don't have time right now to explain
>fully
but
if
>you send me a personal email to orion at psiss dot com I will try
>and
>explain how I would approach it.
>>
>Regards
>>
>PSI_Orion
>>
>"Ian Davies" <ia********@vir gin.netwrote in message
>news:Bw******* ***********@new sfe1-win.ntli.net...
Thanks for the reply
The problem Im having isnt creating a table with the records in
it.
That
works fine. Im trying to find a way where the users can modify
the
records
in a table and they are all updated in one go. I thought using
arrays
would
be the answer, but Im not that familiar with them. At the moment
the
users
click a button at the begining of a row and that record is
displated
on
a
new page where it can be updated. But this requires the user to
click
and
update one record at a time. Whereas I wish them to make all the
changes
to
all the records they want in the table and then on clicking a
button
some
script would take each row in turn and update that row in te
database,
it
would then loop through all the rows in the table and update
each
accordingly
>
Hope this explains it better
>
Ian
>
"PSI_Orion" <or***@psiss.co mwrote in message
news:uF******** **********@news fe6-gui.ntli.net...
>If I understand you correctly, the way I would do it is the
same
way
I
have
>my DVD database. This is rather than have the name of the
elements
as
>"commindex[]" etc, actually place the table creation inside
your
while
loop
>and increment the naming field using the i variable you use,
ie:
>"commindex[<?=$i?>]".
>>
>As an example of what I mean, here is an excerpt of my DVD
database
code
>which you can view at "http:// mydvds . psiss . com"
>>
>------------------------------------------------------
>if($allRecor ds 0)
>{
> $recordCount = 0;
> while($recordCo unt < $allRecords)
> {
> if(($recordCoun t / 2) % 2 == 1)
> {
>?>
> <tr align="center" class="tr_even" >
><?
> }
> else
> {
>?>
> <tr align="center" class="tr_odd">
><?
> }
> for($colCount = 0; $colCount < 2 && $recordCount <
$allRecords;
>$colCount++)
> {
> $dataArray = mysql_fetch_arr ay($result);
> $dataArray['starring'] =
str_replace("\r ","<BR>",$dataA rray['starring']);
> $dataArray['synopsis'] =
str_replace("\r ","<BR>",$dataA rray['synopsis']);
> $dataArray['duration'] =
>date('H:i',str totime($dataArr ay['duration']));
>?>
> <td background="ima ges/barSilver.jpg"
width="30"><?=( $recordCount
+
>1)?></td>
> <td width="4">&nbsp ;</td>
> <td>
> <div class="div_info " style="position : absolute; width:
400px;
>z-index: 1; visibility: hidden;"
id="infoLayer_< ?=$recordCount? >"
>>
>
>
align="left"><b ><u><?=$dataArr ay['title']?></u></b><p><u>Starrin g:</u><br><i
>>

>>>><?=$dataArr ay['starring']?></i></p><p><?=$dataAr ray['synopsis']?></p></d
i
v
>>
><?
> if($dataArray['dvd_image'] == "None")
> {
>?>
> <img id="img_<?=$rec ordCount?>" width="50" height="70"
>src="images/dvds/none_small.jpg"
>>
>
>
onmouseover="po pShow(this,img_ <?=$recordCount ?>,'infoLayer_< ?=$recordCount? >
',img_<?=$recor dCount?>.width
>+ 5,5)" onmouseout="pop Hide('infoLayer _<?=$recordCoun t?>')">
><?
> }
> else
> {
>?>
> <img id="img_<?=$rec ordCount?>" width="50" height="70"
>src="images/dvds/<?=$dataArray['dvd_image']?>"
>>
>
>
onmouseover="po pShow(this,img_ <?=$recordCount ?>,'infoLayer_< ?=$recordCount? >
',img_<?=$recor dCount?>.width
>+ 5,5)" onmouseout="pop Hide('infoLayer _<?=$recordCoun t?>')">
><?
> }
> echo " <img
>>
>
>
src='images/certs/".$certImag e[$dataArray['certificate']].".gif'><BR>".$ data
Array['title'];
>?>
> </td>
> <td width="4">&nbsp ;</td>
> <td><b>Released </b><br><?=$dataA rray['year']?><br>
> <b>Duration</b><br><?=$dataA rray['duration']?><br>
> <b>Rating</b><br><img alt="Rating:
><?=$dataArra y['rating']/2?>"
>align="absmidd le"
>src="images/ratings/pips<?=$dataArr ay['rating']?>.gif"></td>
> <td width="4">&nbsp ;</td>
><?
> $recordCount++;
> }
>?>
> </tr>
><?
> }
>}
>----------------------------------
>>
>>
>"Ian Davies" <ia********@vir gin.netwrote in message
>news:j3******* ********@newsfe 3-win.ntli.net...
Hello
Needing help with a suitable solution.
I have extracted records into a table under three columns
'category',
'comment' and share (the category column also holds the index
no
of
the
record in a hidden field)
I wish the user to be able to edit the data in the table, so
I
have
extracted the records into hiddenfield, textareas, dropdown
list
and
checkbox so that they can make changes.
I named these elements as arrays and wish to run an sql to
take
each
row
in
turn (and any changes made) and update the mysql table. I did
something
similar with just one record but am stuck as to how I use the
arrays
of
a
number of form elements together
>
My code for the table is below but I dont know how the script
should
go
when
the form is submitted to add each row in turn
Help greatly appreciated
Ian
>
>
*************** *************** *************** *************** **********
<form action="comment select.php" method="post"
enctype="multip art/form-data"
name="UpdateCom ments">
<table width="100%" border="0" cellpadding="0"
cellspacing="2"
bgcolor="#FFFFF F">
<tr align="center" class="ListHead ing">
<td width="20%" height="31">Cat egory</td>
<td width="60%" height="31">Com ment</td>
<td width="10%" height="31">Sha re</td>
</tr>
<tr class="BodyText ">
<?php
while($row =& mysql_fetch_arr ay($commentresu lts)) {
extract($row);
>
if ($i%2) {
$class = 'row1';
echo "<TR bgcolor=\"#CCCC CC\">\n";
>
} else {
$class = 'row2';
echo "<TR bgcolor=\"white \">\n";
}
$i += 1;
?>
<td width="20%" align="left" class="bodytext "><select
name="category[]" style="WIDTH: 90%">
<option value="<?php echo $row['TypeID']; ?>"><?php echo
$row['typedesc'];
?></option>
<?php
$commenttype = mysql_query("SE LECT * FROM commenttype WHERE
username
=
'$username'");
if (!$commenttype) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
while($row1 =& mysql_fetch_arr ay($commenttype )) {
extract($row1);
?>
<option value="<?php echo $row1['TypeID'];
?>"><?php
echo
$row1['typedesc']; ?><br>
</option>
<?php
}
?>
</select>
<input name="commindex[]" type="hidden" value="<?php
echo
$commindex;
?>"></td>
<td width="60%" align="left" class="bodytext ">
<textarea
name="comm[]" rows="2" style="WIDTH: 99%"><?php echo
$comment;
?></textarea></td>
<td width="10%" align="center" class="bodytext "><input
type="checkbox"
name="avail[]" value="checkbox " <?php share($availabl e); ?>>
</td>
</tr>
<?php
}
?>
</table>
</form>
>
*************** *************** *************** ***************
>
>
>>
>>
>
>
>>
>>
>
>





Jul 27 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
9893
by: Jason | last post by:
Currently I have a number of html forms which loop through records in a database table. In order to be able to update the right record when the form is submitted, I've tacked number on to the field names, i.e.: PHP: echo '<input type="text" name="hat_color_'.$i.'" value="'.$currentRow.'"> <input type="text" name="favorite_food_'.$i.'" value="'.$currentRow.'">'; HTML: <input type="text" name="hat_color_0" value="brown"><input
1
2023
by: mursyidatun ismail | last post by:
Dear all, database use: Ms Access. platform: .Net i'm trying to update a record/records in a table called t_doctors by clicking da edit link provided in the database. when i ran through da browsers and click update it gave me this error: Specified argument was out of the range of valid values. Parameter name:
11
4436
by: pmarisole | last post by:
I am trying to use the vbscript "split" function on a multi-select field. I am trying to do a mass update of several records at a time. I am getting an error and I'm not sure what to do. Here is the code if someone could help... strID = split(request.form("proj"), ", ") projstat = split(request.form("rojstat"),",") impr = split(request.form("impr"),",") idate =...
10
12300
by: Roger Withnell | last post by:
I'm using ASP, VBScript and SQL Server. I'm also using UTF-8 character set and so my codepage is 65001 and SQL Server datatype nvarchar. I can insert unicode characters correctly into the database table using INSERT.... (field1) ...VALUES ......... (N'Characters'). How do I do this using Rs.Update viz-a-viz:
5
2199
by: cover | last post by:
I have an input form that passes data when submitted to a second form to let the user know what they have just entered into the db. My question comes with using 'update'. I'd like to query the database by equipment number (equipno is unique) and query all fields from that row, populating an original form 'look alike' whereby the user can add detail to the original records as the db builds. I'm using 'date' twice because I'd like to...
4
2055
by: mantrid | last post by:
Im using arrays generated from my records displayed in a table on my site to update the corresponding records in a mysql database ie on the web page col1 col2 col3 1 2 2 1 6 2 7 4 which I post to next page as col1array col2array col3array problem is some
10
12714
by: MLH | last post by:
Suppose, in a multi-user environment, you have append query SQL in a VBA procedure that looks like INSERT INTO MyTable... and the next line reads MyVar=DMax("","MyTable... You can never be certain that MyVar will be set to the key-field value that was created when the Append query ran. Now, there are other ways to do it - I know - that will ensure you 'nab' the correct record. But I was wondering
1
4609
by: javediq143 | last post by:
Hi All, This is my first post in this forum. I'm developing a CMS for my latest website. This CMS is also in PhP & MySQL. I'm done with the ADD section where the Admin can INSERT new records in Database but I'm stuck in the EDIT. I'm getting 2 problems over here. Below is the description: 1)The FIRST page will list all the records from the table which Admin can EDIT with CHECKBOX for each record to select. He can select one or more than one...
3
2041
by: planethax | last post by:
I have multiple arrays that I need to insert/update database and I am not sure how to start, I think I need to use the "foreach" statement and also not sure whether or not to serialize and unserialize? this info is then going to be used to populate a table. This is what I have so far <?php $url = 'http://sports.yahoo.com/nascar/standings'; $html = file_get_contents($url);
0
8928
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8766
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9428
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9217
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9158
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6026
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4535
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4799
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3244
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.