Hay guys
Quick question
function am_query_display_quick($page,$order ='DATE DESC'){
global $email;
$conn = db_connect_2();
$max_per_page = 50;
$color1 = "tableRowOdd";
$color2 = "tableRowEven";
$RowCount = 0;
$start_row = $page*$max_per_page;
$result = $conn->query("SELECT pro,pro_update,ana,ana_update,cell,cell_update,cellother,cellother_update,gen,gen_update,genother,genother_update,author,author_update,other,other_update
FROM mailing_list
WHERE email = '$email'
ORDER BY $order LIMIT $start_row, $max_per_page;");
echo "<table class=\\"sortable\\" id=\\"query_quick2\\" width=\\"100%\\" >\\r\
";
echo "\ <tr><th>Edit Queries</th><th>Promoter
Locus</th><th>Update?</th><th>Anatomical Area</th><th>Update?</th><th>Cell
Type</th><th>Update?</th><th>Other Cell Type</th><th>Update?</th><th>Genetic
Background</th><th>Update?</th><th>Other Gen.
Back.</th><th>Update?</th><th>Author</th><th>Update?</th><th>Other</th><th>Update?</th>\\r\
";
if($result->num_rows){
while ($row = $result->fetch_array()){
$RowCount ++;
$row_color = ($RowCount % 2) ? $color1 : $color2;
echo "\ <tr class=\\"$row_color\\"><td><input type="submit" name="edit_mail" value = "Edit Queries"></td><td>{$row['pro']}</td><td>{$row['pro_update']}</td><td>{$row['ana']}</td>
<td>{$row['ana_update']}</td><td>{$row['cell']}</td><td>{$row['cell_update']}</td><td>{$row['cellother']}</td>
<td>{$row['cellother_update']}</td><td>{$row['gen']}</td><td>{$row['gen_update']}</td><td>{$row['genother']}</td>
<td>{$row['genother_update']}</td><td>{$row['author']}</td><td>{$row['author_update']}</td><td>{$row['other']}</td><td>{$row['other_update']}</td>
</tr>";
}
} ...
Parse error: syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’
it is referring to this line:
echo "\ <tr class=\\"$row_color\\"><td><input type="submit" name="edit_mail" value = "Edit Queries"></td><td>{$row['pro']}</td><td>{$row['pro_update']}</td> ...
All i want is to just add a “Edit Queries” button right at the beginning of the row, but this parse error stops me from doing that
Please help
you need to escape the all the double quotes in that line - the syntax highlighting above shows the unescaped quoted parts in blue
O yes thanks for the quick reply!
rpkamp
4
You need to escape the double quotes
echo "\ <tr class=\\"$row_color\\"><td><input type=[COLOR="Red"]\\[/COLOR]"submit[COLOR="Red"]\\[/COLOR]" name=[COLOR="Red"]\\[/COLOR]"edit_mail[COLOR="Red"]\\[/COLOR]" value=[COLOR="Red"]\\[/COLOR]"Edit Queries[COLOR="Red"]\\[/COLOR]"></td><td>{$row['pro']}</td><td>{$row['pro_update']}</td><td>{$row['ana']}</td>
Although, which such humangous blocks of HTML I’d personally use heredoc:
echo <<<END
<tr class="$row_color"><td><input type="submit" name="edit_mail" value="Edit Queries"></td><td>{$row['pro']}</td><td>{$row['pro_update']}</td><td>{$row['ana']}</td>
<td>{$row['ana_update']}</td><td>{$row['cell']}</td><td>{$row['cell_update']}</td><td>{$row['cellother']}</td>
<td>{$row['cellother_update']}</td><td>{$row['gen']}</td><td>{$row['gen_update']}</td><td>{$row['genother']}</td>
<td>{$row['genother_update']}</td><td>{$row['author']}</td><td>{$row['author_update']}</td><td>{$row['other']}</td><td>{$row['other_update']}</td>
</tr>
END;
Hi ScallioXTX
Although, which such humangous blocks of HTML I’d personally use heredoc:
could you elaborate on heredoc?
By the way, one more question related to parse error arises
if($result->num_rows){
while ($row = $result->fetch_array()){
$RowCount ++;
$row_color = ($RowCount % 2) ? $color1 : $color2;
echo "<form method = \\"post\\" action=\\"<? echo $_SERVER['PHP_SELF'] ?>\\">";
echo "\ <tr class=\\"$row_color\\"><td><input type=\\"submit\\" name=\\"edit_mail\\" value = \\"Edit Queries\\"></td>
<td>{$row['pro']}</td><td>{$row['pro_update']}</td><td>{$row['ana']}</td>
<td>{$row['ana_update']}</td><td>{$row['cell']}</td><td>{$row['cell_update']}</td><td>{$row['cellother']}</td>
<td>{$row['cellother_update']}</td><td>{$row['gen']}</td><td>{$row['gen_update']}</td><td>{$row['genother']}</td>
<td>{$row['genother_update']}</td><td>{$row['author']}</td><td>{$row['author_update']}</td><td>{$row['other']}</td><td>{$row['other_update']}</td>
</tr>";
echo "</form>";
}
}
echo "</table>";
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
it’s pointing to this line:
echo "<form method = \\"post\\" action=\\"<? echo $_SERVER['PHP_SELF'] ?>\\">";
I tried to escape the double quotes, but i am suspecting the problem mainly comes from the echo statement… How should i format this?
Also, am i placing <form></form> at the right place?
Thanks guys
Problem solved
echo “<form method = \“post\” action=\”{$_SERVER[‘PHP_SELF’]}\“>”;
Thanks
Heredoc:
echo <<<STOP
<html>
<head>
<title>$Title</title>
</head>
</html>
STOP;
//Do more php stuff here
You can use anything as stop - END, MYEND, MYSTOPPER, ENDER etc.