
le 24/07/2007 à 14:33
Manque une page de liens...
C'est prévu pour la rentrée, un annuaire complet même.
<?php
$pattern[0] = "(\[b\](.+?)\[\/b])is";
$pattern[1] = "(\[i\](.+?)\[\/i\])is";
$pattern[2] = "(\[u\](.+?)\[\/u\])is";
$pattern[3] = "(\[s\](.+?)\[\/s\])is";
$replace[0] = '<span class="gras">$1</span>';
$replace[1] = '<span class="italique">$1</span>';
$replace[2] = '<span class="souligne">$1</span>';
$replace[3] = '<span class="barre">$1</span>';
$string = preg_replace($pattern, $replace, $string);
?>
<?php
if (isset($_POST['blu'])) {
// traitement php du forumlaire
// si il y'a des erreurs, tu ne fais aucun header
// si le formulaire est validé, tu fais un header vers une page de confirmation
}
?><html>
...
<form action="index.php" method="post">
<input type="text" name="blu" value="<?php if (isset($_POST['blu'])) echo htmlentities($_POST['blu']); ?>" />
</form>
...
</html>
mysql> SELECT * FROM test;
+------------+-----------------+
| product_id | option_value_id |
+------------+-----------------+
| 58 | 1 |
| 58 | 6 |
| 58 | 3 |
| 59 | 6 |
+------------+-----------------+
4 rows in set (0.00 sec)
mysql> SELECT count(product_id) AS nb, product_id FROM test WHERE option_value_id = 6 OR option_value_id = 1 GROUP BY product_id;
+----+------------+
| nb | product_id |
+----+------------+
| 2 | 58 |
| 1 | 59 |
+----+------------+
2 rows in set (0.00 sec)