Hello,
I am totally newbie to PHP and recently successfully wrote my first code of creating database, creating two tables, and inserting datas into each table. The feeling was nice for a moment there but now I am back to where I was at the beginning.
So anyway, I am trying to write a code that will fetch the data from mysql using "drop-down" menu to show list of all teams' name. The reason I need some help is because I kept getting error message and I am not sure what the error is.
<?php
include 'conn.php';
include 'opendb.php';
// select the database
mysql_select_db($dbname_conn, $conn);
$checkuser = mysql_query("SELECT * FROM ncaa WHERE id_info=$id");
$row = mysql_fetch_array($result);
?>
<body>
<center>
<br>
<br>
<br>
<table width="600" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<table width="300" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="text">#1:</td>
<td><?
$query ="SELECT * FROM ncaa";
$result =mysql_query($query) or die(mysql_error());
while ($row =mysql_fetch_array($result)){
echo "<option ".$row["teamid"]."></option>";
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
</form>
<?
include 'endb.php';
?>
}
I am attempting to create a page that you could assign teams to rank by using drop-down menu rather than to type in team name per each line. But for this, I am using one to make it short and readable.
Thank in advance for helping me out and I really appreciate it! Do keep in mind that I am a newbie! 😃