|
|
b321618 |
Subject: "re: FOREACH
holds you back
untill y..."
Posted: @ 9:16 pm on Feb 15 2010
|
|
|
Member #: 946 Rank: user - (7) Since: 05/28/09 Posts: 7
|
thanks for
reading if you
need more
information let
me know, ill be
actively
checking this
post throughout
the day!
|
Viewed: 18,313 Times | |  |
bs0d |
Subject: "re: FOREACH
holds you back
untill y..."
Posted: @ 12:16 am on Feb 16 2010
|
|
|
 Member #: 1 Rank: Admin. - (1,510) Since: 02/06/05 Posts: 604 From: USA
|
|
Viewed: 18,307 Times | |  |
b321618 |
Subject: "re: FOREACH
holds you back
untill y..."
Posted: @ 12:25 am on Feb 16 2010
|
|
|
Member #: 946 Rank: user - (7) Since: 05/28/09 Posts: 7
|
ok let me give
you some more
code here.
paint a better
picture sorry.
this is the
whole section,
including what
was above.
Thanks again
bs0d!
Code:
if
($_GET['reques
t'] ==
'request')
{
?>
<center><
br />
<form
name="add
box"
action="
".$_SERVER
['PHP_SELF'].
""
method="P
OST"><
br />
<input
type='submit'
name='add'
value='Accept
' />
<input
type='submit'
name='deny'va
lue='Deny'/&g
t;
<input
type='submit'
name='block'v
alue='Block'/
>
</center>
<?
$procheck =
mysql_query(&q
uot;SELECT *
FROM members
WHERE
user='$getuser
name' AND
level='5'&qu
ot;);
while($prodispl
ay =
mysql_fetch_arr
ay($procheck))<
br />
{
echo
"<cent
er><a
href='project.
php?id=".
$prodisplay['s
implename'].&
quot;'>&qu
ot;.$prodisplay
['project'].
"</a>
;<br><
/center>&qu
ot;;
$requestproname
=
$prodisplay['s
implename'];
$reqprocheck =
mysql_query(&q
uot;SELECT *
FROM
memberrequest
WHERE
simplename='$r
equestproname'
AND
block='0'&qu
ot;);
$rowcount =
mysql_num_rows(
$reqprocheck);<
br />
if($rowcount ==
0)
{
echo
"<cent
er>No
requests</ce
nter><br&
gt;";
}
else
while($reqdispl
ay =
mysql_fetch_arr
ay($reqprocheck
))
{
$addmember =
$reqdisplay['i
d'];
$smplnm =
$reqdisplay['s
implename'];
$user =
$reqdisplay['u
ser'];
$proj =
$reqdisplay['p
roject'];
echo
"<cent
er>".$
reqdisplay['us
er']."&l
t;/center>&l
t;br>"
;
?>
<center><
br />
<input
type='checkbox
'
name='id[]'
value='<?
echo
$addmember;
?>'><
/input>
</center>
if
(isset($_POST[
'add']))
{
if($_POST['id
'] ==
"")
{
}
else
{
foreach
($_POST['id']
as
$addmember)
{
if
(!mysql_query(
"DELETE
FROM
memberrequest
WHERE
id='$addmember
'") ||
!mysql_query(&
quot;INSERT
INTO members
VALUES
('','"
.$_POST['$smpl
nm']."'
,'".$_PO
ST['$user'].
"','&qu
ot;.$_POST['$p
roject'].&quo
t;','1','$y
ear')"))
{
echo
mysql_error();<
br />
}
}
}
}
<?
|
Viewed: 18,304 Times | |  |
bs0d |
Subject: "re: FOREACH
holds you back
untill y..."
Posted: @ 8:29 pm on Feb 16 2010
|
|
|
 Member #: 1 Rank: Admin. - (1,510) Since: 02/06/05 Posts: 604 From: USA
|
I wonder if you
tried using a
different
variable name
in the foreach
statement?
Since
$addmember is
defined earlier
as: $addmember
=
$reqdisplay['i
d']; Also try
IF(isset())
with
$_POST['id']
instead of that
if
condition...Is
the while()
loop displaying
a checkbox for
each member? Is
it checked by
default?
|
Viewed: 18,291 Times | |  |
b321618 |
Subject: "re: FOREACH
holds you back
untill y..."
Posted: @ 9:21 pm on Feb 16 2010
|
|
|
Member #: 946 Rank: user - (7) Since: 05/28/09 Posts: 7
|
yes its
displaying a
check box for
each
memberrequest,
and no they
aren't check.
It interesting
how it will
delete the row
that is
checked. and
insert into
members, but
with the insert
into members it
just goes
through the
loop inserting
every request.
But only
deletes the one
row because I
can tell it
which one to
delete
specifically.
|
Viewed: 18,287 Times | |  |
b321618 |
Subject: "re: FOREACH
holds you back
untill y..."
Posted: @ 9:53 pm on Feb 16 2010
|
|
|
Member #: 946 Rank: user - (7) Since: 05/28/09 Posts: 7
|
oop! I figured
it out! I had
to add another
while loop to
fill in the
INSERT section
using the id
from the
memberrequest!
Its always
something so
simple! Thanks
bs0d for you
time and help!
couldn't have
done it without
you!
|
Viewed: 18,285 Times | |  |
bs0d |
Subject: "re: FOREACH
holds you back
untill y..."
Posted: @ 11:40 pm on Feb 16 2010
|
|
|
 Member #: 1 Rank: Admin. - (1,510) Since: 02/06/05 Posts: 604 From: USA
|
Ok, sorry I
couldn't be
more help.
Logical errors
can be tricky
to debug. Good
luck with your
script
|
Viewed: 18,279 Times | |  |
Viewing Page: 1 of 1 |
|
|
|