<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Piccola modifica rewriterule]]></title><description><![CDATA[<p dir="auto">L'obiettivo del mio rewriting è fare pagine del tipo <strong>/articolo/nome-articolo.php</strong></p>
<p dir="auto">Fino adesso sono arrivato a fare solo pagine del tipo <strong>/articolo/<em>id</em>/nome-articolo.php</strong></p>
<p dir="auto">Cioè se vado ad eliminare l'ID nell'url mi errore:<br />
Warning:  mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ...</p>
<p dir="auto">vi allego il codice che uso</p>
<p dir="auto">index.php</p>
<pre><code class="language-php">&lt;?php
include('connessione_db.inc.php');

$query = "SELECT * FROM `tb_annunci` ";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
           
           echo "&lt;a href=\"annunci/$row[id]/$row[titolo].php\"&gt;$row[titolo]&lt;/a&gt;";
}
?&gt;
</code></pre>
<p dir="auto">view.php</p>
<pre><code>&lt;?php
include('../connessione.inc.php');

$query = "SELECT * FROM `tb_annunci` WHERE id=".$_GET['titolo'];
$result = mysql_query($query);
$row = mysql_fetch_array($result);
?&gt;

&lt;html&gt;
&lt;head&gt;
&lt;title&gt;&lt;?php echo $row['titolo']; ?&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;h1&gt;&lt;?php echo $row['titolo']; ?&gt;&lt;/h1&gt;
&lt;p&gt;&lt;?php echo $row['testo']; ?&gt;&lt;/p&gt;
&lt;br&gt;&lt;br&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p dir="auto">.htacces</p>
<pre><code>RewriteEngine On
RewriteRule ^(.+)/(.+).php view.php?titolo=$1 [L]
</code></pre>
]]></description><link>https://dev.connect.gt/topic/147402/piccola-modifica-rewriterule</link><generator>RSS for Node</generator><lastBuildDate>Sun, 29 Nov 2026 10:00:09 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/147402.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 11 Mar 2011 00:30:44 GMT</pubDate><ttl>60</ttl></channel></rss>