<?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[ComboBox MySQL Php]]></title><description><![CDATA[<p dir="auto">Salve, da giorni tento di capire dove sbaglio ma invano. Chiedo dunque a voi se potete darmi una dritta.</p>
<p dir="auto">Sto cercando di connettere un database ad un php per una combobox.<br />
Il problema è che non mi rileva nulla, come se non fosse connesso ma non mi da errori.</p>
<p dir="auto">Ora posto il codice.</p>
<pre><code>&lt;!doctype html&gt;


&lt;?php 
    
    define('DB_USER', 'root');
    define('DB_PASSWORD', '');
    define('DB_HOST', 'localhost');
    define('DB_NAME', 'formato');
    
    mysql_connect('DB_HOST', 'DB_USER', 'DB_PASSWORD')  or die('Impossibile connettersi' .mysql_error());
    mysql_select_db('DB_NAME');
    
    $borse = $_REQUEST['borse'];
    
    $query = "SELECT name FROM `borse_formato`";
    $res = mysql_query($query);
    
?&gt;


&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html" charset="utf-8"&gt; 


&lt;title&gt;&lt;/title&gt;


&lt;style type="text/css"&gt;
@import url(css/style.css);
&lt;/style&gt;


&lt;/head&gt;


&lt;body&gt;
    &lt;div id="container_borse"&gt;
        &lt;label&gt;Formato:&lt;/label&gt;
        &lt;select name="borse"&gt;
            &lt;option value=""&gt;Seleziona&lt;/option&gt;
                &lt;?php
                    while($row = mysql_fetch_array($res)) {
                ?&gt;
               &lt;option value="&lt;?php echo $row['name'] ?&gt;"&gt; &lt;?php echo $row['name']; ?&gt;&lt;/option&gt;
            
                &lt;?php    
                    }
                ?&gt;
        &lt;/select&gt;
</code></pre>
<p dir="auto">Grazie per l'aiuti.</p>
]]></description><link>https://dev.connect.gt/topic/217140/combobox-mysql-php</link><generator>RSS for Node</generator><lastBuildDate>Wed, 25 Nov 2026 22:33:58 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/217140.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 08 Sep 2015 11:34:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ComboBox MySQL Php on Fri, 18 Sep 2015 09:48:02 GMT]]></title><description><![CDATA[<p dir="auto">Potete chiudere, ho risolto rifacendo il progetto in <a href="http://ASP.NET" rel="nofollow ugc">ASP.NET</a></p>
<p dir="auto">Grazie a tutti.</p>
]]></description><link>https://dev.connect.gt/post/1206892</link><guid isPermaLink="true">https://dev.connect.gt/post/1206892</guid><dc:creator><![CDATA[trese]]></dc:creator><pubDate>Fri, 18 Sep 2015 09:48:02 GMT</pubDate></item><item><title><![CDATA[Reply to ComboBox MySQL Php on Sat, 12 Sep 2015 08:17:03 GMT]]></title><description><![CDATA[<p dir="auto">Come posso mostrarvi l'immagine del database?</p>
]]></description><link>https://dev.connect.gt/post/1206891</link><guid isPermaLink="true">https://dev.connect.gt/post/1206891</guid><dc:creator><![CDATA[trese]]></dc:creator><pubDate>Sat, 12 Sep 2015 08:17:03 GMT</pubDate></item><item><title><![CDATA[Reply to ComboBox MySQL Php on Thu, 10 Sep 2015 07:04:56 GMT]]></title><description><![CDATA[<p dir="auto">Ti ringrazio per la risposta ma sembra comunque non funzionare. Ho notato che nell'index ora mi mostra, in alto a sinistra, questa parte di codice: query("SELECT name FROM borse_formato"); ?&gt;</p>
<p dir="auto">Utilizzo la versione di prova di DreamWeaver e provo a simulare i colori del codice php.</p>
<p dir="auto"><strong>index.php</strong></p>
<pre><code>&lt;!doctype html&gt;


&lt;?php
    [COLOR=#0000ff]$mySqli[/COLOR] = [COLOR=#008000]new[/COLOR] [COLOR=#ff0000]mysqli[/COLOR]([COLOR=#ee82ee]"localhost"[/COLOR], [COLOR=#ee82ee]"root"[/COLOR], [COLOR=#ee82ee]""[/COLOR], [COLOR=#ee82ee]"db_test"[/COLOR]);
    [COLOR=#0000ff]$query[/COLOR] = [COLOR=#0000ff]$mysqli[/COLOR]-&gt;[COLOR=#ff0000]query[/COLOR]([COLOR=#ee82ee]"SELECT name FROM borse_formato"[/COLOR]);
?&gt;


&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html" charset="utf-8"&gt; 


&lt;title&gt;Preventivatore&lt;/title&gt;


&lt;style type="text/css"&gt;
@import url(css/style.css);
&lt;/style&gt;


&lt;/head&gt;


&lt;body&gt;


&lt;div id="container"&gt;
    &lt;div id="header"&gt;
        &lt;div id="logo"&gt;
        &lt;/div&gt;
        
        &lt;div align="right"&gt;
            &lt;div id="menu"&gt;
                &lt;div id="nav"&gt;
                    &lt;ul&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Store&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;News&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Blog&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Azienda&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Collabora&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Contatti&lt;/a&gt;&lt;/li&gt;
                    &lt;/ul&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        
    &lt;/div&gt;
    
    &lt;div id="titolo"&gt;
        &lt;div align="center"&gt;
            PREVENTIVO BUSTE
        &lt;/div&gt;
    &lt;div&gt;
    
    &lt;div id="titolo_borse"&gt;
        &lt;div align="center"&gt;
            &lt;label&gt;BORSE&lt;/label&gt;
           &lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div id="titolo_personalizzazione"&gt;
        &lt;div align="center"&gt;
            &lt;label&gt;PERSONALIZZAZIONE&lt;/label&gt;
           &lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div id="container_borse"&gt;
        &lt;label&gt;Formato:&lt;/label&gt;
        &lt;select name="borse"&gt;
            &lt;option value="" selected&gt; Seleziona &lt;/option&gt;
                &lt;?php
                    [COLOR=#00ff00]while[/COLOR]([COLOR=#0000ff]$row[/COLOR] = [COLOR=#0000ff]$query[/COLOR]-&gt;[COLOR=#ff0000]fetch_row[/COLOR]()) {
                ?&gt;
                &lt;option value="&lt;?php [COLOR=#00ff00]echo[/COLOR] [COLOR=#0000ff]$row[/COLOR][0]; ?&gt;"&gt; &lt;?php [COLOR=#00ff00]echo[/COLOR] [COLOR=#0000ff]$row[/COLOR][0]; ?&gt;&lt;/option&gt;
                &lt;?php
                    }
                ?&gt;
        &lt;/select&gt;
...
</code></pre>
<p dir="auto">Volevo chiederti, a scopo informativo, la funzione di -&gt;.</p>
<p dir="auto">Grazie per la disponibilità, se necessario posto delle immagini relative al database.</p>
]]></description><link>https://dev.connect.gt/post/1206895</link><guid isPermaLink="true">https://dev.connect.gt/post/1206895</guid><dc:creator><![CDATA[trese]]></dc:creator><pubDate>Thu, 10 Sep 2015 07:04:56 GMT</pubDate></item><item><title><![CDATA[Reply to ComboBox MySQL Php on Thu, 10 Sep 2015 00:19:27 GMT]]></title><description><![CDATA[<p dir="auto">Ciao Trese,</p>
<p dir="auto">intanto prova così, ricorda di scrivere sempre un codice leggero e pulito come questo.</p>
<pre><code class="language-php">&lt;!DOCTYPE HTML&gt;
&lt;?php 
    $mysqli = new mysqli("host","user","password","nomedb");
    $query = $mysqli-&gt;query("SELECT name FROM borse_formato");
?&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;&lt;/title&gt;
&lt;style type="text/css"&gt;
@import url(css/style.css);
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;div id="container_borse"&gt;
        &lt;label&gt;Formato:&lt;/label&gt;
        &lt;select name="borse"&gt;
            &lt;option value="" selected&gt;Seleziona&lt;/option&gt;
                &lt;?php
                    while($row = $query-&gt;fetch_row()) {
                ?&gt;
               &lt;option value="&lt;?php echo $row[0]; ?&gt;"&gt; &lt;?php echo $row[0]; ?&gt;&lt;/option&gt;
                &lt;?php    
                    }
                ?&gt;
        &lt;/select&gt;
     &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p dir="auto">Se imposti i parametri correttamente, ed hai i valori e non c'è nulla di sbagliato al di fuori del codice che hai postato deve funzionare.</p>
<p dir="auto">Se non và iniziamo i controlli ed identifichiamo il problema.</p>
]]></description><link>https://dev.connect.gt/post/1206881</link><guid isPermaLink="true">https://dev.connect.gt/post/1206881</guid><dc:creator><![CDATA[miwebdesign]]></dc:creator><pubDate>Thu, 10 Sep 2015 00:19:27 GMT</pubDate></item><item><title><![CDATA[Reply to ComboBox MySQL Php on Wed, 09 Sep 2015 16:50:22 GMT]]></title><description><![CDATA[<p dir="auto">Qualche consiglio?</p>
]]></description><link>https://dev.connect.gt/post/1206898</link><guid isPermaLink="true">https://dev.connect.gt/post/1206898</guid><dc:creator><![CDATA[trese]]></dc:creator><pubDate>Wed, 09 Sep 2015 16:50:22 GMT</pubDate></item><item><title><![CDATA[Reply to ComboBox MySQL Php on Tue, 08 Sep 2015 19:14:39 GMT]]></title><description><![CDATA[<p dir="auto">Non funziona ugualmente.<br />
Ho provato modificando la struttura, magari così l'errore è più semplice da individuare:</p>
<p dir="auto"><strong>index.php</strong></p>
<pre><code>&lt;!doctype html&gt;


&lt;?php
    include_once 'database_connection.php';
    connect();
?&gt;


&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html" charset="utf-8"&gt; 


&lt;title&gt;Preventivatore&lt;/title&gt;


&lt;style type="text/css"&gt;
@import url(css/style.css);
&lt;/style&gt;


&lt;/head&gt;


&lt;body&gt;


&lt;div id="container"&gt;
    &lt;div id="header"&gt;
        &lt;div id="logo"&gt;
        &lt;/div&gt;
        
        &lt;div align="right"&gt;
            &lt;div id="menu"&gt;
                &lt;div id="nav"&gt;
                    &lt;ul&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Store&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;News&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Blog&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Azienda&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Collabora&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="#"&gt;Contatti&lt;/a&gt;&lt;/li&gt;
                    &lt;/ul&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        
    &lt;/div&gt;
    
    &lt;div id="titolo"&gt;
        &lt;div align="center"&gt;
            PREVENTIVO BUSTE
        &lt;/div&gt;
    &lt;div&gt;
    
    &lt;div id="titolo_borse"&gt;
        &lt;div align="center"&gt;
            &lt;label&gt;BORSE&lt;/label&gt;
           &lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div id="titolo_personalizzazione"&gt;
        &lt;div align="center"&gt;
            &lt;label&gt;PERSONALIZZAZIONE&lt;/label&gt;
           &lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div id="container_borse"&gt;
        &lt;label&gt;Formato:&lt;/label&gt;
        &lt;select name="borse_formato"&gt;
            &lt;?php query_01() ?&gt;
        &lt;/select&gt;
            &lt;?php close() ?&gt;
...
</code></pre>
<p dir="auto"><strong>database_connection.php</strong></p>
<pre><code>&lt;?php
    
    include_once 'database_information.php';
    
    function connection() {
        $connect = mysql_connect('DB_HOST', 'DB_USER', 'DB_PASSWORD') or die('Impossibile connettersi al server' .mysql_error());
        mysql_select_db('DB_NAME', $connect);
    }
    
    function close() {
        mysql_close();
    }
    
    function query_01() {
        $myData = mysql_query("SELECT * FROM borse_formato");
        
        while($record = mysql_fetch_array($myData)) {
            echo '&lt;option value="' . $record['name'] . '"&gt;' . $record['name'] . '&lt;/option&gt;';
        }
    }
    
?&gt;
</code></pre>
<p dir="auto">Visualizzando l'index.php non cambia nulla, visualizzando il database_connection.php mi appare questo: ' . $record['name'] . ''; } } ?&gt;<br />
Ho controllato più e più volte gli apici e le virgolette ma mi sembrano corrette... Dove sbaglio?</p>
<p dir="auto">Grazie per la risposta!</p>
]]></description><link>https://dev.connect.gt/post/1206896</link><guid isPermaLink="true">https://dev.connect.gt/post/1206896</guid><dc:creator><![CDATA[trese]]></dc:creator><pubDate>Tue, 08 Sep 2015 19:14:39 GMT</pubDate></item><item><title><![CDATA[Reply to ComboBox MySQL Php on Tue, 08 Sep 2015 13:21:02 GMT]]></title><description><![CDATA[<pre><code class="language-php">$connect = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD)  or die('Impossibile connettersi' .mysql_error());
mysql_select_db(DB_NAME, $connect);
</code></pre>
]]></description><link>https://dev.connect.gt/post/1206887</link><guid isPermaLink="true">https://dev.connect.gt/post/1206887</guid><dc:creator><![CDATA[jhon92]]></dc:creator><pubDate>Tue, 08 Sep 2015 13:21:02 GMT</pubDate></item></channel></rss>