Forum Moderators: coopster
I have a slight problem with a line of my code, I am getting the following problem.
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/www/juttuffi/menuadd.php on line 16
I suspect this is my own fault I am experimenting with this piece of code and cant seam to stumble upon the correct way of doing it as I usually do, anyhow the code is below, its not very long.
<?php
include '/home/www/juttuffi/dbc.php';
$name = $_POST['pages'];
$menuname = $_POST['pname'];
$query1 = mysql_query("SELECT pid FROM tpages WHERE name='$name'");
if (mysql_numrows($query1) == 0)
{
echo "There is nothing in the database";
}
else
{
while ($row = mysql_fetch_array($query1,MYSQL_ASSOC))
{
[b][2]$query2 = mysql_query("INSERT INTO tmenu (name, pid) VALUES ('$menuname', '$row['pid']')");[/2][/b]
echo $query2;
}
}
mysql_close($dbc);
?>
I have highlighted the line of code which is causing the problem and my guess is the problem is to do with $row['pid']
can anyone help me out here I would be grateful.