par
NiCeMaN29 » 29 avr. 2008, 04:28
Bonjour j'utilise un checkbox avec while ...
Dans mon index.php j'ai ceci
while( $row = mysql_fetch_assoc($result) ) {
$sql = sprintf("select * from tt_%s where ID = %s", intval($row['TypeID']), intval($row['ListingID']));
$result2 = $mysql->exSql($sql) or die($mysql->debugPrint());
if(mysql_num_rows($result)>0){
$row2 = mysql_fetch_assoc($result2);
echo "<form method=\"post\" action=removesaved.php onSubmit=\"return test(this)\">";
printf("
<input type=\"checkbox\" name=mon_champ[] value=\"TypeID=".$row['TypeID']."&ListingID=".$row['ListingID']."\">
<a href='detail.php?fatherID=%s&TypeID=%s&ListingID=%s'>%s</a></input>
<br>", $row['FatherID'], $row['TypeID'], $row['ListingID'], $row2['Titre']);
}
}
echo "<input type=Submit value=ok ></input></form>";
Puis dans removesaved.php
J'ai ceci , c'est suposé quand je clique sur un checkbox sa delete le checkbox selectionnez.
$memberID = $_SESSION['memberID'];
if (isset($_POST['mon_champ'])) {
for ($i = 0; $i < count($_POST['mon_champ']); $i++) {
$node = new sqlNode();
$node->table = "savedlistings";
$node->where = "where MemberID = $memberID and " . $_POST['mon_champ'][$i] . "";
if(($result = $mysql->delete($node)) === false )
die($mysql->debugPrint());
}
}
Le probleme , Il recupere les données . Mais riens ne delete . Puis quand sa delete , sa delete tout au complet ....
Aidez moi et esperant que je suis clair

Bonjour j'utilise un checkbox avec while ...
Dans mon index.php j'ai ceci
[php]
while( $row = mysql_fetch_assoc($result) ) {
$sql = sprintf("select * from tt_%s where ID = %s", intval($row['TypeID']), intval($row['ListingID']));
$result2 = $mysql->exSql($sql) or die($mysql->debugPrint());
if(mysql_num_rows($result)>0){
$row2 = mysql_fetch_assoc($result2);
echo "<form method=\"post\" action=removesaved.php onSubmit=\"return test(this)\">";
printf("
<input type=\"checkbox\" name=mon_champ[] value=\"TypeID=".$row['TypeID']."&ListingID=".$row['ListingID']."\">
<a href='detail.php?fatherID=%s&TypeID=%s&ListingID=%s'>%s</a></input>
<br>", $row['FatherID'], $row['TypeID'], $row['ListingID'], $row2['Titre']);
}
}
echo "<input type=Submit value=ok ></input></form>";
[/php]
Puis dans removesaved.php
J'ai ceci , c'est suposé quand je clique sur un checkbox sa delete le checkbox selectionnez.
[php]
$memberID = $_SESSION['memberID'];
if (isset($_POST['mon_champ'])) {
for ($i = 0; $i < count($_POST['mon_champ']); $i++) {
$node = new sqlNode();
$node->table = "savedlistings";
$node->where = "where MemberID = $memberID and " . $_POST['mon_champ'][$i] . "";
if(($result = $mysql->delete($node)) === false )
die($mysql->debugPrint());
}
}
[/php]
Le probleme , Il recupere les données . Mais riens ne delete . Puis quand sa delete , sa delete tout au complet ....
Aidez moi et esperant que je suis clair :P