Ciao Ragazzi!
Sono di nuovo qui a rompere...
Allora praticamente per il mio shop genero una lista li prodotti come dal codice seguente, il problema è che io vorrei recuperare ad esempio solo 250 caratteri dalla $row["descrizione_prodotto"].
Come si fa? E' possibile vero?
Comunque il campo della descrizione è in formato TEXT.
Codice PHP:
$rs = mysql_query("SELECT * FROM shop_prodotti WHERE categoria='$ref_cat' ORDER BY id ");
$nr = mysql_num_rows($rs);
if ($nr != 0){
for($x = 0; $x < $nr; $x++){
$row = mysql_fetch_assoc($rs);
echo "<form action='?inviodati=ok' method='POST'>";
echo "<table width=\"650\" border=\"0\">";
echo " <tr>";
echo " <td width=\"123\" rowspan=\"4\"><a href=\"shop_mostra_scheda_prodotto.php?ref_id=".$row["id"]."\"><img src=\"".$row["img_1"]."\" width=\"120\"></a></td>";
echo " <td colspan=\"4\"><a href=\"shop_mostra_scheda_prodotto.php?ref_id=".$row["id"]."\">".$row["nome_prodotto"]."</a></td>";
echo " </tr>";
echo " <tr>";
echo " <td width=\"232\">Prezzo: ".$row["prezzo_unitario"]." euro</td>";
echo " <td colspan=\"3\">Codice riferimento: ".$row["id"]."</td>";
echo " </tr>";
echo " <tr>";
echo " <td colspan=\"4\">".$row["descrizione_prodotto"]."</td>";
echo " </tr>";
echo " <tr>";
echo " <td colspan=\"4\"><div align=\"right\">Quantità*";
echo " <label>";
echo " <input name=\"quantita\" type=\"text\" id=\"quantita\" value=\"1\" size=\"6\" maxlength=\"3\">";
echo " <input type=\"submit\" name=\"button\" id=\"button\" value=\"Aggiungi al carrello\">";
echo " </label></div></td>";
echo " </tr>";
echo " <tr>";
echo " <td colspan=\"5\"><hr size=\"1\"></td>";
echo " </tr>";
echo "</table>";
echo "</form>";
}
}else{
echo "Nessun prodotto inserito.";
}
?>