MBrown
Diamond Member
I'm trying to make a dynamic list that pulls a pk from a database, but I am running into some stupid parse errors and I cannot see what the issue is. Can someone with some fresh eyes check this out? Thanks!
This is the error: Parse error: syntax error, unexpected '"'>"' (T_CONSTANT_ENCAPSED_STRING)
this is the function
UPDATE!!!!!!!
Ok. I'm trying a different approach now, but for some reason it is not displaying my first result. For example in my table I have 7 rows but its only displaying 2 through 7 in my list. I cannot see where my issue is. Anyone else see it?
Thanks in advance!
This is the error: Parse error: syntax error, unexpected '"'>"' (T_CONSTANT_ENCAPSED_STRING)
this is the function
Code:
function serialDropdown($listQuery, $con)
{
$list = mysql_query($listQuery, $con);
$menu = "<select name = 'serialNumberList'>";
while ($result = mysql_fetch_array($list))
{
// The line below is the one that keeps giving me errors!
$menu .= "<option value=' ".$result['serialNumber'] "'>" .$result['serialNumber'] ." </option>";
}
$menu .= "</select>";
return $menu;
}
UPDATE!!!!!!!
Ok. I'm trying a different approach now, but for some reason it is not displaying my first result. For example in my table I have 7 rows but its only displaying 2 through 7 in my list. I cannot see where my issue is. Anyone else see it?
Code:
$listRows = mysqli_num_rows($listQuery);
echo "<br /> <br /> <br />";
echo "<select name = 'serialNumberlist'>";
for ($y = 0; $y < $listRows; ++$y)
{
$listRows = mysqli_fetch_row($listQuery);
for ($x = 0; $x < 1; $x++)
{
echo "<option value = '$listRows[$x]'> $listRows[$x] </option>";
}
}
echo "</select>";
Thanks in advance!
Last edited: