Note that there are some explanatory texts on larger screens.

plurals
  1. POchange sqldatabase php script
    primarykey
    data
    text
    <p>i have this problem for 3 days already :( i created a 3 databases via phpmyadmin and i already put those 3 database into a dropdown list what i wanted is, when ever i click submit, the default database changes dependin on the value of the dropdown list</p> <p>this is the code i came up to</p> <pre><code>&lt;table width="300" border="0" align="center" cellpadding="0" cellspacing="1"&gt; &lt;tr&gt; &lt;td&gt;&lt;form name="form2" method="post" &gt; &lt;table width="100%" border="0" cellspacing="1" cellpadding="3"&gt; &lt;tr&gt; &lt;td colspan="3"&gt;&lt;center&gt;&lt;strong&gt;Select Default Database&lt;/strong&gt;&lt;/center&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;center&gt;&lt;select name="db_used"&gt; &lt;?php $host="localhost"; $username="root"; $password=""; $link = mysql_connect("$host", "$username", "$password")or die("cannot connect"); $result = mysql_list_dbs( $link ); while( $row = mysql_fetch_object( $result ) ){ echo "&lt;option&gt;$row-&gt;Database&lt;/option&gt;"; } ?&gt; &lt;/select&gt;&lt;/center&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan="3" align="center"&gt;&lt;input type="submit" name="Submit" value="Submit"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;?php $host="localhost"; $username="root"; $password=""; $db_name = "#this depends on the value of the dropdown list"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); ?&gt; </code></pre> <p>any help is greatly appreciated~~</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload