dragazarth
New member
Ive got some code that goes like this:
echo "
<form action=\"existing_user.php\",>
<fieldset>
<legend>Edit What You Have Here!</legend>
Who are you? <select name=\"user\" />";
$con = mysql_connect("localhost","tf2");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("items", $con);
$result = mysql_query("SELECT * FROM things");
while($row = mysql_fetch_array($result))
{
echo "<option value = \"$row['idthing']\">$row['idthing']</option>"
}
echo "</select>
</br>
<input type=\"submit\" value=\"Submit\" />
</fieldset>";
It is meant to grab a column of names in a mysql database in a column called idthings and then give a dropdown (select) form with each choice a different option.
Im new to php and html and SQL so im not sure what im doing wrong...
I get this error:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\xampp\htdocs\tf2\index.php on line 50
LINE 50 correspondes to this line echo "<option value = \"$row['idthing']\">$row['idthing']</option>"
THanks
echo "<option value = \"$row['idthing']\">
$row['idthing']</option>"
echo "
<form action=\"existing_user.php\",>
<fieldset>
<legend>Edit What You Have Here!</legend>
Who are you? <select name=\"user\" />";
$con = mysql_connect("localhost","tf2");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("items", $con);
$result = mysql_query("SELECT * FROM things");
while($row = mysql_fetch_array($result))
{
echo "<option value = \"$row['idthing']\">$row['idthing']</option>"
}
echo "</select>
</br>
<input type=\"submit\" value=\"Submit\" />
</fieldset>";
It is meant to grab a column of names in a mysql database in a column called idthings and then give a dropdown (select) form with each choice a different option.
Im new to php and html and SQL so im not sure what im doing wrong...
I get this error:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\xampp\htdocs\tf2\index.php on line 50
LINE 50 correspondes to this line echo "<option value = \"$row['idthing']\">$row['idthing']</option>"
THanks
echo "<option value = \"$row['idthing']\">
$row['idthing']</option>"