Jump to content

Recommended Posts

I don't see why not.

 

I'm not sure of the specific code for the job, but it'd be a mysql_query("") with a while and a mysql_fetch_array.

 

something like this:

 

$read_tables = mysql_query(" sql query goes here (cheack the MySQL Manual for this)");

//this will read each table and output its values to a variable called table
while($table = mysql_fetch_array($read_tables))
{

print'
<label>
$table['name'] 
<input type="radio" id="'.$table['name'].'" name"'.$table['name'].'"  />
</label>
<br />';

}

 

 

I successfully did it but I now have too many tables (lol) so I changed my mind to a combo box but I can't figure out how to do it.

 

For my radio input I now have:

echo "<label>";
print "$row[0]\n";
echo "<input type=radio id=";
print "$row[0]\n";
echo "name=";
print "$row[0]\n";
echo "/>
</label>
<br>";

 

So how would I configure a combo box like this to do the same?

<input type="select" name="OS">
  <option value="Win95">Windows 95/98</option>
  <option value="WinNT">Windows NT/2000</option>
  <option value="OSX">Macintosh OS X</option>
  <option value="OS9">Macintosh OS 9</option>
  <option value="Linux">Linux</option>
  <option value="Solaris">Solaris</option>
  <option value="BSD">FreeBSD</option>
</input>

<?php

mysql_connect("localhost", "root", "");

$result = mysql_list_tables("test");

$num_rows = mysql_num_rows($result);

 

echo "<select name=''>";

for ($i = 0; $i < $num_rows; $i++) {

echo "<option value=''>".mysql_tablename($result, $i)."</option>";

}

echo "</select>";

   

 

 

mysql_free_result($result);

?>

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.