Add custom multi language product fields - php

I'm trying to add multi-language custom product fields. Please anybody help me out from this problem.
Add table
CREATE TABLE IF NOT EXISTS `product_custom` (
`product_id` int(11) NOT NULL,
`title` varchar(255) CHARACTER SET utf8 NOT NULL,
` language_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
In admin/view/template/catalog/product.tpl
<div class="tab-pane" id="tab-custom">
<div class="table-responsive">
<table id="custom" class="table table-striped table-bordered table-hover">
<thead>
<tr>
<td class="text-right">Title</td>
<td class="text-right">Value</td>
<td></td>
</tr>
</thead>
<tbody>
<?php $custom_row = 0; ?>
<?php foreach ($product_customs as $product_custom) { ?>
<tr id="custom-row<?php echo $custom_row; ?>">
<?php foreach ($languages as $language) { ?>
<td class="text-right">
<img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" style="margin-right:10px;padding:5px 0px"/><br/>
<input type="text" name="product_custom[<?php echo $custom_row; ?>][<?php echo $language['language_id']; ?>][title]" value="<?php echo $product_custom[$language['language_id']]['title']; ?>" placeholder="Title" class="form-control" />
</td>
<?php }?>
<td class="text-left"><button type="button" onclick="$('#custom-row<?php echo $custom_row; ?>').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>
</tr>
<?php $custom_row++; ?>
<?php } ?>
</tbody>
<tfoot>
<tr>
<td colspan="1"></td>
<td class="text-left"><button type="button" onclick="addCustom();" data-toggle="tooltip" title="Add Mediabox" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td>
</tr>
</tfoot>
</table>
</div>
</div>
<script type="text/javascript"><!--
var custom_row = <?php echo $custom_row; ?>;
function addCustom() {
html = '<tr id="custom-row' + custom_row + '">';
<?php foreach ($languages as $language) { ?>
html += ' <td class="text-right"><input type="text" name="product_custom[' + custom_row + '][title]" value="" placeholder="Title" class="form-control" /></td>';
<?php }?>
html += ' <td class="text-left"><button type="button" onclick="$(\'#custom-row' + custom_row + '\').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>';
html += '</tr>';
$('#custom tbody').append(html);
custom_row++;
}
//--></script>
In admin/controller/catalog/product.php
//Custom
if (isset($this->request->post['product_custom'])) {
$product_customs = $this->request->post['product_custom'];
} elseif (isset($this->request->get['product_id'])) {
$product_customs = $this->model_catalog_product->getProductCustoms($this->request->get['product_id']);
} else {
$product_customs = array();
}
$data['product_mediaboxs'] = array();
foreach ($product_customs as $language_id => $product_custom) {
$data['product_customs'] = $this->language->get('product_customs');
$data['product_customs'][] = array(
'title' => $product_custom['title'],
);
}
In admin/model/catalog/product.php
if (isset($data['product_custom'])) {
foreach ($data['product_custom'] as $language_id => $product_custom) {
$this->db->query("INSERT INTO " . DB_PREFIX . "product_custom SET product_id = '" . (int)$product_id . "', title = '" . $this->db->escape($product_custom['title']) . "', language_id = '" . (int)$language_id . "'");
}
}
$this->db->query("DELETE FROM " . DB_PREFIX . "product_custom WHERE product_id = '" . (int)$product_id . "'");
if (isset($data['product_custom'])) {
foreach ($data['product_custom'] as $language_id => $product_custom) {
$this->db->query("INSERT INTO " . DB_PREFIX . "product_mediabox SET product_id = '" . (int)$product_id . "', title = '" . $this->db->escape($product_custom['title']) . "', language_id = '" . (int)$language_id . "'");
}
}
$data['product_custom'] = $this->getProductCustoms($product_id);
$this->db->query("DELETE FROM " . DB_PREFIX . "product_custom WHERE product_id = '" . (int)$product_id . "'");
public function getProductCustoms($product_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_custom WHERE product_id = '" . (int)$product_id . "' ORDER BY title");
return $query->rows;
}

Check with following changes :
Add table
CREATE TABLE IF NOT EXISTS `oc_product_custom` (
`opc_id` int(11) NOT NULL AUTO_INCREMENT,
`product_id` int(11) NOT NULL,
PRIMARY KEY (`opc_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `oc_product_custom_desc` (
`opc_id` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
`language_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
In admin/view/template/catalog/product_form.tpl
add below html
<div class="tab-pane" id="tab-custom">
<div class="table-responsive">
<table id="custom" class="table table-striped table-bordered table-hover">
<thead>
<tr>
<td class="text-right">Title</td>
<td></td>
</tr>
</thead>
<tbody>
<?php $custom_row = 0; ?>
<?php foreach ($product_customs as $product_custom) { ?>
<tr id="custom-row<?php echo $custom_row; ?>"><td class="text-right">
<?php foreach ($languages as $language) { ?>
<div class="input-group"><span class="input-group-addon"><img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /></span>
<input type="text" name="product_custom[<?php echo $custom_row; ?>][<?php echo $language['language_id']; ?>][title]" value="<?php echo $product_custom[$language['language_id']]['title']; ?>" placeholder="Title" class="form-control" />
</div>
<?php }?>
</td>
<td class="text-left"><button type="button" onclick="$('#custom-row<?php echo $custom_row; ?>').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>
</tr>
<?php $custom_row++; ?>
<?php } ?>
</tbody>
<tfoot>
<tr>
<td colspan="1"></td>
<td class="text-left"><button type="button" onclick="addCustom();" data-toggle="tooltip" title="Add Mediabox" class="btn btn-primary"><i class="fa fa-plus-circle"></i></button></td>
</tr>
</tfoot>
</table>
</div>
</div>
Add below script
<script type="text/javascript"><!--
var custom_row = <?php echo $custom_row; ?>;
function addCustom() {
html = '<tr id="custom-row' + custom_row + '">';
html += '<td class="text-right">';
<?php foreach ($languages as $language) { ?>
html += '<div class="input-group"><span class="input-group-addon"><img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /></span><input type="text" name="product_custom[' + custom_row + '][<?php echo $language['language_id']; ?>][title]" value="" placeholder="Title" class="form-control" /></div>';
<?php }?>
html += '</td>';
html += ' <td class="text-left"><button type="button" onclick="$(\'#custom-row' + custom_row + '\').remove();" data-toggle="tooltip" title="<?php echo $button_remove; ?>" class="btn btn-danger"><i class="fa fa-minus-circle"></i></button></td>';
html += '</tr>';
$('#custom tbody').append(html);
custom_row++;
}
//--></script>
admin/controller/catalog/product.php
//Custom
if (isset($this->request->post['product_custom'])) {
$product_customs = $this->request->post['product_custom'];
} elseif (isset($this->request->get['product_id'])) {
$product_customs = $this->model_catalog_product->getProductCustoms($this->request->get['product_id']);
} else {
$product_customs = array();
}
$data['product_customs'] = array();
foreach ($product_customs as $key=>$product_custom) {
foreach ($data['languages'] as $language){
$customdata = $this->model_catalog_product->getProductCustom($product_custom['opc_id'],$language['language_id']);
$data['product_customs'][$key][$language['language_id']] = array(
'title' => $customdata['title'],
);
}
}
admin/model/catalog/product.php
in addProduct method add following code before $this->cache->delete('product')
if (isset($data['product_custom'])) {
foreach ($data['product_custom'] as $product_custom_data) {
$this->db->query("INSERT INTO `" . DB_PREFIX . "product_custom` SET `product_id` = '" . (int) $product_id . "'");
$opc_id = $this->db->getLastId();
if (!empty($product_custom_data)) {
foreach ($product_custom_data as $language_id => $product_custom) {
$this->db->query("INSERT INTO `" . DB_PREFIX . "product_custom_desc` SET `opc_id` = '" . (int) $opc_id . "', `title` = '" . $this->db->escape($product_custom['title']) . "', `language_id` = '" . (int) $language_id . "'");
}
}
}
}
In editProduct method add following code before $this->cache->delete('product')
$this->db->query("DELETE FROM " . DB_PREFIX . "product_custom WHERE product_id = '" . (int) $product_id . "'");
$this->db->query("DELETE FROM " . DB_PREFIX . "product_custom_desc WHERE product_id = '" . (int) $product_id . "'");
if (isset($data['product_custom'])) {
foreach ($data['product_custom'] as $product_custom_data) {
$this->db->query("INSERT INTO `" . DB_PREFIX . "product_custom` SET `product_id` = '" . (int) $product_id . "'");
$opc_id = $this->db->getLastId();
if (!empty($product_custom_data)) {
foreach ($product_custom_data as $language_id => $product_custom) {
$this->db->query("INSERT INTO `" . DB_PREFIX . "product_custom_desc` SET `opc_id` = '" . (int) $opc_id . "', `title` = '" . $this->db->escape($product_custom['title']) . "', `language_id` = '" . (int) $language_id . "'");
}
}
}
}
in copyProduct method add following code before $this->addProduct($data);
$data['product_custom'] = $this->getProductCustoms($product_id);
in deleteProduct method add below code before $this->cache->delete('product')
$this->db->query("DELETE FROM " . DB_PREFIX . "product_custom WHERE product_id = '" . (int) $product_id . "'");
$this->db->query("DELETE FROM " . DB_PREFIX . "product_custom_desc WHERE product_id = '" . (int) $product_id . "'");
add below method :
public function getProductCustoms($product_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_custom WHERE product_id = '" . (int) $product_id . "'");
return $query->rows;
}
public function getProductCustom($opc_id,$language_id) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_custom_desc WHERE opc_id = '" . (int) $opc_id . "' AND language_id='".$language_id."' ORDER BY title");
return $query->row;
}
Note : I think there is no need of product_mediabox table.

Related

how to get single value from group_concat query

i am getting these
but i need this
How to get seperate value for quiz name ?
query=select userquiz.id,userquiz.user_id,userss.username,quiz.quiz_name,GROUP_CONCAT(userquiz.quiz_id) as 'quiz_id',GROUP_CONCAT(quiz.quiz_name) as 'quiz_name' from userquiz join userss on userss.id=userquiz.user_id join quiz on quiz.quiz_id=userquiz.quiz_id group by user_id;
$filter_query = $query . ' ' . 'LIMIT ' . $start . ', ' . $limit
. '';
$statement = $connect->prepare($query);
// print_r($query);
$statement->execute();
$total_data = $statement->rowCount();
$statement = $connect->prepare($filter_query);
$statement->execute();
$result = $statement->fetchAll();
$total_filter_data = $statement->rowCount();
$output = '
<label> Total Records :- ' . $total_data . '</label>
<table class="table table-bordered" style="margin-top:40px";>
<tr>
<th>Username</th>
<th>Quizname</th>
<th>Action</th>
</tr>
';
if ($total_data > 0) {
foreach ($result as $row) {
$output .= '
<tr>
<td>' . $row["username"] . '</td>
<td><button type=" button" style="background-color:maroon; border: #4685A9;" class="btn btn-success"">' . $row["quiz_name"] . '</td>
<td><button type=" button" style="background-color:red; border: #4685A9;" class="btn btn-primary dltbtn" data-id="' . $row["user_id"] . '"> DELETE</button>
<button type=" button" style="background-color:orange; border: #4685A9;" class="btn btn-primary editbtn" data-eid="' . $row["user_id"] . '">Assign Quiz</button></td>
</tr>
';
}
this is how i am fetching the values
i need to make quiz as button so that can be deleted

PHP display images dynamically in grid pattern

I'm new to php and I'm working with a tutorial about showing images dynamically on the page, it works fine but it shows them vertically and I would like them to be horizontal. I created a page with code to do that but I can't seem to figure out where to insert the code to get the images to show.
Thanks for any help.
Vertical output looks like this
$dynamicList = "";
$sql = mysql_query("SELECT * FROM products ORDER BY date_added ASC LIMIT 6");
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$product_name = $row["product_name"];
$price = $row["price"];
$details = $row["details"];
$date_added = strftime("%b %d, %Y", strtotime($row["date_added"]));
$dynamicList .= '<table width="1000px" border="0" cellspacing="0" cellpadding="6" align="center">
<tr>
<td width="1000px" align="center"><img style="border:#666 0px solid;" src="images/' . $id . '.jpg" width="50%" height="50%" alt="' . $product_name . '" width="77" height="102" border="1" /></td>
<td width="83%" valign="top">' . $product_name . '<br />
$' . $price . '<br /> $' . $details . '<br />
order</td>
</tr>
</table>';
}
mysql_close();
?>
Grid Output
$sql = mysql_query("SELECT * FROM products ORDER BY id ASC LIMIT 15");
$i = 0;
// Establish the output variable
$dynamiclist = '<table width="1000px" border="1" cellspacing="2" cellpadding="10" align="center">';
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$product_name = $row["product_name"];
$details = $row["details"];
$price = $row["price"];
if ($i % 3 == 0) { // if $i is divisible by our target number (in this case "3")
$dynamiclist .= '<tr><td>' . $product_name . '</br>' . $details . '</br>' . $price . '</td>';
} else {
$dynamiclist .= '<td>' . $product_name . '</td>';
}
$i++;
}
$dynamiclist .= '</tr></table>';
?>
I got it figured out, Thanks for the help.
$sql = mysql_query("SELECT * FROM products ORDER BY id ASC LIMIT 15");
$i = 0;
// Establish the output variable
$dynamiclist = "";
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$product_name = $row["product_name"];
$details = $row["details"];
$price = $row["price"];
if ($i % 4 == 0) { // if $i is divisible by our target number (in this case "3")
$dynamiclist .= '<tr><td width="250px" align="center"><img src="images/' . $id . '.jpg"><br/>' . $product_name . '<br />
' . $details . '<br /> $' . $price . '<br />
order</td>';
} else {
$dynamiclist .= '<td width="250px" align="center"><img src="images/' . $id . '.jpg"><br/>' . $product_name . '<br />
' . $details . '<br /> $' . $price . '<br />
order</td>';
}
$i++;
}
$dynamiclist .= '</tr></table>';
?>

Pagination not working-PHP

When I put a term in search-box, my pagination is not working although it gives me a perfect result.
For an eg. If I type "Laptops" it gives me records having laptops,but my pagination is not going with the flow. I don't know where I have missed something.
Here is my code:
Search-Box:
<form action="" method="GET">
Search: <input type="text" name="term" value="<?php echo #$_REQUEST['term']; ?>" /><br />
<input type="submit" value="Submit" />
</form>
To Display data:
<table id="employee-grid" width="auto" cellpadding="1" cellspacing="1" border="1" class="table table-hover">
<?php
include_once '../storescripts/connect_to_mysql.php';
$num_rec_per_page = 5;
if (isset($_GET["page"])) {
$page = $_GET["page"];
} else {
$page = 1;
};
$start_from = ($page - 1) * $num_rec_per_page;
$sql = "SELECT * FROM products WHERE status='Active' LIMIT $start_from, $num_rec_per_page";
?>
<thead>
<tr class="success">
<th>Id</th>
<th>Product Image</th>
<th>Product Name</th>
<th>Price</th>
<th>Status</th>
<th>Quantity</th>
<th>Details</th>
<!--<th>Category</th>
<th>Subcategory</th>-->
<th>Date Added</th>
<th colspan="2">Functions</th>
</tr>
</thead>
<?php
if (!empty($_REQUEST['term']))
{
$term = mysql_real_escape_string($_REQUEST['term']);
$sql = "SELECT * FROM products WHERE product_name LIKE '%" . $term . "%' or status LIKE '%" . $term . "' or quantity LIKE '%" . $term . "' or details LIKE '%" . $term . "' or price LIKE '%" . $term . "' or details LIKE '%" . $term . "'";
}
$r_query = mysql_query($sql);
if ($r_query > 1)
{
while ($row = mysql_fetch_array($r_query))
{
echo "<tr bgcolor=''>";
echo "<td width='5%'>" . $row['id'] . "</td>";?>
<td width="10%"><img style='border:#666 1px solid;' width='70' src="<?php echo $row["productimage"]; ?>" alt="" /></td>
<?php echo "<td width='20%'>" . $row['product_name'] . "</td>";
echo "<td width='5%'>" . $row['price'] . "</td>";
echo "<td width='5%'>" . $row['status'] . "</td>";
echo "<td width='5%'>" . $row['quantity'] . "</td>";
echo "<td width='19%'>" . $row['details'] . "</td>";
// echo "<td>" . $row['category'] . "</td>";
// echo "<td>" . $row['subcategory'] . "</td>";
echo "<td width='10%'>" . $row['date_added'] . "</td>";
echo "<td><a href='product_listing_edit.php?id=" . $row['id'] . "'>Edit</a></td>";?>
<td><a href="#" class="delete" onclick="dialogbox(<?php echo $row['id']; ?>)" >Delete</a>
<?php
//echo "<td><a name='delete' href='product_listing_delete.php?id=" . $row['id'] . "' onclick='return show_confirm();' >Delete</a></td><tr>";
echo "</tr>";
}
}
else {
echo "Nothing should be displayed";
}
?>
</table>
Pagination Code:
<?php
//Pagination code starts here
$sql = "SELECT * FROM products";
$rs_result = mysql_query($sql); //run the query
$total_records = mysql_num_rows($rs_result); //count number of records
$total_pages = ceil($total_records / $num_rec_per_page);
echo "<a href='product_listing.php?page=1'>".'|<'."</a> "; // Goto 1st page
for ($i=1; $i<=$total_pages; $i++) {
echo "<a href='product_listing.php?page=".$i."'>".$i."</a> ";
};
echo "<a href='product_listing.php?page=$total_pages'>".'>|'."</a> "; // Goto last page
?>
You have to use r_query to find no of rows in pagination. Now you are finding the total number of rows in the table
<?php
//Pagination code starts here
$total_records = mysql_num_rows($r_query); //count number of records
$total_pages = ceil($total_records / $num_rec_per_page);
echo "<a href='product_listing.php?page=1'>".'|<'."</a> "; // Goto 1st page
for ($i=1; $i<=$total_pages; $i++) {
echo "<a href='product_listing.php?page=".$i."'>".$i."</a> ";
};
echo "<a href='product_listing.php?page=$total_pages'>".'>|'."</a> "; // Goto last page
?>

Update a whole table with mysqli and php

I have created a page to list all users with their rights on the website. I used the code below to create and fill the table and it works great.
echo '<form method="post" id="detail" class="group" action="includes/setup_change.php?change=rights">';
echo '<div class="group">';
if (!empty($_GET['change'])) {
if ($_GET['change'] == 'rights') { echo '<span class="message_alert success"><span class="icon success"></span><span class="text">' . _('Your password was successfully changed') . '.</span></span>'; }
}
echo '<h2>' . _('Change') . ' ' . _('rights') . '</h2>';
// select database
mysqli_select_db( $mysqli, 'db_ccadmin' );
// check connection
if ( $mysqli->connect_errno > 0 ) {
trigger_error( _('Database connection failed') . ': ' . $mysqli->connect_error, E_USER_ERROR );
}
// sql query
$sql = "SELECT * FROM users";
$res = $mysqli->query( $sql );
if( !$res ) {
trigger_error( _('Wrong') . ' SQL: [' . $sql . ']. ' . _('Error') . ' : [' . $mysqli->error . ']' );
} else {
echo '<table id="table_sort_no_search">';
echo '<thead><tr>
<th class="username">' . _('Username') . '</th>
<th class="readonly">' . _('Read-only') . '</th>
<th class="manage">' . _('Manage') . '</th>
<th class="admin">' . _('Admin') . '</th>
</tr></thead>';
echo '<tbody>';
// output query results
while($row = $res->fetch_assoc()) {
echo '<tr>';
echo '<td><input type="text" name="username" value="' . $row['username'] . '" readonly></td>';
echo '<td><label><input type="radio" class="rights" name="rights_' . $row['username'] . '" value="1" ' . (isset($row['rights']) ? (($row['rights'] == '1') ? 'checked="checked"' : '' ) : '') . '></label></td>';
echo '<td><label><input type="radio" class="rights" name="rights_' . $row['username'] . '" value="2" ' . (isset($row['rights']) ? (($row['rights'] == '2') ? 'checked="checked"' : '' ) : '') . '></label></td>';
echo '<td><label><input type="radio" class="rights" name="rights_' . $row['username'] . '" value="3" ' . (isset($row['rights']) ? (($row['rights'] == '3') ? 'checked="checked"' : '' ) : '') . '></label></td>';
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
// free results to free up some system resources
$res->free();
The trouble is updating the whole table in the database. I don't know how to do this. Is it even possible to update the whole table (as generated) at once? If yes, how?
What would be the code that I need to put in my setup_change.php?
It would be great if you could help me!
It is not clear what you want to update, but this is how you can update (example):
$mysqli->query("UPDATE birthday SET Manage = null");
Of course, this does not solve your problem, as there is infinite ways to update the whole table. What table do you want to update, what values do you want to set?

Update a variable on click

basically I've written the following but I'm wondering what the best way to get $message_id = to the $row['id'] you click on to view an inbox message. If I just statically set $message_id = to say 39 and click on the row that's $row['id'] is 39 it'll open the message.
Basically what it does is list inbox messages I have, and anchor tag them with its row id to be used in the header to show the full contents of that message.
<p>
<?php
$message_id = "39";
if (isset($_GET[$message_id]) && empty($_GET[$message_id])) {
$username = $user_data['username'];
$get_message = mysql_query("SELECT * FROM `users_inbox` WHERE `id` = '$message_id' AND `send_to` = '$username'");
$get_message_result = mysql_fetch_array($get_message);
echo '<h1><u>' . $get_message_result['subject'] . '</u></h1>';
echo $get_message_result['sent_from'] . '<br />';
echo $get_message_result['body'] . '<br />';
echo 'Back';
}
$username = $user_data['username'];
$result = mysql_query("SELECT * FROM `users_inbox` WHERE `send_to` = '$username'");
?>
<table border="1">
<tr>
<td>From</td>
<td>Subject</td>
<td>Date</td>
</tr>
<?php
while($row = mysql_fetch_array($result))
{
echo
'<tr>' .
'<td>' . $row['sent_from'] . '</td>' .
'<td>' . $row['subject'] . '</td>' .
'<td>' . $row['post_date'] . '</td>' .
'</tr>';
}
?>
</table>
</p>
Anyone know if this is even possible, as I know code is read from top to bottom and as far as I'm aware you cant go back upwards at all.
I assume that the $user_data['username'] is set or available,if yes then you could pass a variable name of you choice which points the message id instead of sending only the id (eg: i am setting it as msg_id ), Now you can access the message id via $_GET['msg_id']
<p>
<?php
$username = $user_data['username'];
if ( isset( $_GET['msg_id'] ) ) {
$get_message = mysql_query("SELECT * FROM `users_inbox` WHERE `id` = '$message_id' AND `send_to` = '$username'");
$get_message_result = mysql_fetch_array($get_message);
echo '<h1><u>' . $get_message_result['subject'] . '</u></h1>';
echo $get_message_result['sent_from'] . '<br />';
echo $get_message_result['body'] . '<br />';
echo 'Back';
}else{
$result = mysql_query("SELECT * FROM `users_inbox` WHERE `send_to` = '$username'");
?>
<table border="1">
<tr>
<td>From</td>
<td>Subject</td>
<td>Date</td>
</tr>
<?php
while($row = mysql_fetch_array($result))
{
echo
'<tr>' .
'<td>' . $row['sent_from'] . '</td>' .
'<td>' . $row['subject'] . '</td>' .
'<td>' . $row['post_date'] . '</td>' .
'</tr>';
}
?>
</table>
</p>

Categories