$query = "select * from items WHERE Username LIKE '[[+username]]' ORDER BY ItemName";
$username = '[[+username]]';
[[!getMemberItems? &username=`[[!+username]]`]]
$query = "select * from items WHERE Username LIKE ?";
$stmt = $modx->prepare($query);
$stmt->execute(array($username));
foreach ($stmt->fetchAll(PDO::FETCH_ASSOC)) {
// collect your output here
}[[!edititem? &username=`[[!+username]]`]]
<?php
echo '<h2>Edit Your Items, [[+username]]</h2>';
include ('inc/dbconnect.php');
echo '<div style="margin-left:10px;"><form action="editlistings_getedit.php" method="post" name="editlistings_getedit"><input name="_User" class="formfield" type="hidden" value="[[+username]]" /><table cellpadding="10" cellspacing="0" width="480" border="0" style="font-size:10px;">
<tr>
<td width="60" align="left" height="40"><strong>Name</strong></td>
<td width="60" align="left" height="40"><strong>Category</strong></td>
<td width="60" align="left" height="40"><strong>Value</strong></td>
<td width="60" align="left" height="40"><strong>Description</strong></td>
<td width="60" align="left" height="40"><strong>Telephone</strong></td>
<td width="60" align="left" height="40"><strong>Email</strong></td>
<td width="60" align="left" height="40"><strong>Published</strong></td>
<td width="60" align="left" height="40"><strong>Action</strong></td></tr>';
$username = '[[+username]]';
// return $username;
// Build SQL Query
$stmt = $modx->query("select * from items WHERE Username LIKE '$username' ORDER BY ItemName"); // specify the table and field names for the SQL query
//echo $query;
$numresults=mysql_query($stmt);
$numrows=mysql_num_rows($numresults);
if ($numrows == 0)
{
echo "<p>You don't have any items listed for swapping at the moment. Why not <a href=\"members-add-item.html\"> add a new listing</a> now?</p>";
}
// get results
$result = mysql_query($stmt) or die("Couldn't execute query");
// display the results returned
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$itemname = $row["ItemName"];
$category = $row["Category"];
$estimatedvalue = $row["EstimatedValue"];
$itemdescription = $row["ItemDescription"];
$telephone = $row["ContactNumber"];
$emailaddress = $row["EmailAddress"];
$published = $row["Published"];
$id = $row["ID"];
echo '
<tr>
<td align="left">' . $itemname . '</td>
<td align="left">' . $category. '</td>
<td align="left">£' . $estimatedvalue . '</td>
<td align="left">' . $itemdescription . '</td>
<td align="left">' . $telephone . '</td>
<td align="left">' . $emailaddress . '</td>
<td align="left">' . $published . '</td>
<td><a href="editlistings_getedit.php?ID=' . $id . '&category=' . $category . '">Edit</a> <a href="editlistings_editdelete.php?ID=' . $id . '" onclick="return confirm(\'Are you sure you want to delete this item? Please note that the item cannot be restored once deleted!\');">Delete</a></td></tr>' ;
echo '<tr><td colspan="8"><hr></td></tr>';
$count++ ;
}
echo '</table></form></div>';
[[+username]]

[[!Profile]] [[!edititem? &username=`[[!+username]]`]]
<?php
echo '<h2>Edit Your Items, [[+username]]</h2>';
include ('inc/dbconnect.php');
echo '<div style="margin-left:10px;"><form action="editlistings_getedit.php" method="post" name="editlistings_getedit"><input name="_User" class="formfield" type="hidden" value="[[+username]]" /><table cellpadding="10" cellspacing="0" width="480" border="0" style="font-size:10px;">
<tr>
<td width="60" align="left" height="40"><strong>Name</strong></td>
<td width="60" align="left" height="40"><strong>Category</strong></td>
<td width="60" align="left" height="40"><strong>Value</strong></td>
<td width="60" align="left" height="40"><strong>Description</strong></td>
<td width="60" align="left" height="40"><strong>Telephone</strong></td>
<td width="60" align="left" height="40"><strong>Email</strong></td>
<td width="60" align="left" height="40"><strong>Published</strong></td>
<td width="60" align="left" height="40"><strong>Action</strong></td></tr>';
$username = '[[+username]]';
// return $username;
// Build SQL Query
$query = "select * from items WHERE Username LIKE '$username' ORDER BY ItemName"; // specify the table and field names for the SQL query
$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);
if ($numrows == 0)
{
echo "<p>You don't have any items listed for swapping at the moment. Why not <a href=\"members-add-item.html\"> add a new listing</a> now?</p>";
}
// get results
while ($row= mysql_fetch_array($result)) {
$itemname = $row["ItemName"];
$category = $row["Category"];
$estimatedvalue = $row["EstimatedValue"];
$itemdescription = $row["ItemDescription"];
$telephone = $row["ContactNumber"];
$emailaddress = $row["EmailAddress"];
$published = $row["Published"];
$id = $row["ID"];
echo '
<tr>
<td align="left">' . $itemname . '</td>
<td align="left">' . $category. '</td>
<td align="left">£' . $estimatedvalue . '</td>
<td align="left">' . $itemdescription . '</td>
<td align="left">' . $telephone . '</td>
<td align="left">' . $emailaddress . '</td>
<td align="left">' . $published . '</td>
<td><a href="editlistings_getedit.php?ID=' . $id . '&category=' . $category . '">Edit</a> <a href="editlistings_editdelete.php?ID=' . $id . '" onclick="return confirm(\'Are you sure you want to delete this item? Please note that the item cannot be restored once deleted!\');">Delete</a></td></tr>' ;
echo '<tr><td colspan="8"><hr></td></tr>';
$count++ ;
}
echo '</table></form></div>';
?>
[[+username]]
$username = '[[+username]]';
$username = $scriptProperties['username'];
echo '<h2>Edit Your Items,' . $username . '</h2>';
$output = '<h2>Edit Your Items,' . $username . '</h2>'; $output .= 'More stuff'; return $output;