Hi there,
I was trying to modify the code from the tutorial "PHP Basic Database Handling" and the code uses something I haven't seen before, but looks intriguing.
Can someone explain how to use this:
echo <<<SOMELABEL
stuff
SOMELABEL;
Or let me know why my code didn't work? The error is an unexpected end statement on the last line of the file.
My Code:
<?php
$mystring = $_GET['FirstLast'];
if($mystring == "")
{
echo "You reached this page by mistake, click on the link in your email";
}else
{
//echo $mystring;
// connect to db
$conn = mysql_connect('localhost','user','pw') or trigger_error("SQL",E_USER_ERROR);
$db = mysql_select_db('tsec',$conn) or trigger_error("SQL",E_USER_ERROR);
$sql = "SELECT `First Name`, `Last Name`, `Title`, `Org Parameter 1`, `Org/Person Name`,
`Attendee Parm Value 1`, `Attendee Parm Value 2`, `Attendee Parm Value 3`, `Attendee Parm Value 4`,
`Attendee Parm Value 5`, `Attendee Parm Value 6`, `Attendee Parm Value 7`, `Attendee Parm Value 8`
FROM `attendees` WHERE FirstLast = '$mystring'";
$result = mysql_query($sql,$conn) or trigger_error("SQL", E_USER_ERROR);
$list = mysql_fetch_assoc($result);
echo <<<LISTNAME
<form action = '{$_SERVER['PHP_SELF']}' method = 'post'>
<table border = '1'><tr><td colspan = '2'>{$list['First Name']} {$list['Last Name']}</td></tr>
<tr><td>Title</td><td><input type = 'text' name = 'Title' value = {$list['Title']}</td></tr>
</table></form>
LISTNAME;
mysql_close($conn);
}
?>
Thanks.