About
|
|
Author: FR
|
|
Credits:
|
|
|
Brookfresh, Brad Lawryk, Crogon, DaMysterious, EklipzeDesigns, ML, musashi, phpBB Group, phpBB-Auction-Team, php-styles, sanman, Tel, Vampy, wGEric
|
|
Supported Sites
|
|
Statistics
|
User:
|
16758
|
Posts:
|
18401
|
Latest User:
|
Slaidrobeede
|
|
|
|
View previous topic :: View next topic |
Author |
Message |
guyb Small-Cap Auctioneer

Joined: 22 Oct 2008 Posts: 21
|
Posted: Tue Feb 24, 2009 9:59 pm Post subject: Need help updating sql from form |
|
|
Hi FR and Crogon - good to see you on the forum again!
I'm having a php problem with an sql "UPDATE":
I wanted to make the administrator's display of auction data (admin_auction_offer) an auction management tool by turning its data into editable fields - to display current data on each auction but allow the admin to edit/change and UPDATE those changes.
Each row is a separate auction offer, and at the end of the row I added a text link which triggers a "mode" to update all the fields of that row.
I've been able to get my sql data to display, but my attempts to get that data (the original stored values or my edited values) to be re-updated don't work - the process uploads blank fields. I'm pretty sure my problem is at the stage just before my sql UPDATE command - but I have no idea what to do. HELP!
For reference, that text link is this (below) which appears further down in my PHP code:
Code: |
'U_ADMIN_OFFER_EDIT' => append_sid("admin_auction_offer.$phpEx?mode=admin_offer_edit&" . POST_AUCTION_OFFER_URL . "=" . $offer_rowset[$i]['PK_auction_offer_id'] . ""),
|
The modded form field does does display the data, but when I click the mode-link to upload the related row of fields back into the table - whether edited fields or original default values, it uploads totally blank fields and so overwrites existing data with blank data.
1. My form template coding:
Code: |
<h1>{L_ADMIN_OFFER}</h1>
<P>{L_ADMIN_OFFER_EXPLAIN}</p>
<br>
<br>
<table>
<tr>
<td>
<a href="{U_AUCTION_OFFER_SORT_JUST_NOT_PAID}" class="gensmall">{L_AUCTION_OFFER_SORT_JUST_NOT_PAID}</a><br>
<a href="{U_AUCTION_OFFER_SORT_JUST_PAID}" class="gensmall">{L_AUCTION_OFFER_SORT_JUST_PAID}</a><br>
</td>
</tr>
</table>
<br>
<form>
<table>
<tr>
<td>{L_AUCTION_OFFER_ID}</td>
<td><a href="{U_AUCTION_OFFER_SORT_TITLE}" class="gensmall">{L_AUCTION_OFFER_TITLE}</a></td>
<td>{L_AUCTION_OFFER_PRICE_START}</td>
<td>{L_AUCTION_OFFER_RESERVE_FACTOR}</td>
<td>{L_AUCTION_OFFER_DIRECT_SELL}</td>
<td>{L_AUCTION_OFFER_SHIPPING_PRICE}</td>
<td><a href="{U_AUCTION_OFFER_SORT_PAID}" class="gensmall">{L_AUCTION_OFFER_PAID}</a></td>
<td>{L_AUCTION_OFFER_MARK_PAID}</td>
<td><a href="{U_AUCTION_OFFER_SORT_USERNAME}" class="gensmall">{L_AUCTION_OFFER_OFFERER}</a></td>
<td>{L_AUCTION_OFFER_VIEWS}</td>
<td>{L_AUCTION_OFFER_PICTURE}</td>
<td>{L_AUCTION_OFFER_SPECIAL}</td>
<td>{L_AUCTION_OFFER_BOLD}</td>
<td>{L_AUCTION_OFFER_ON_TOP}</td>
<td>{L_AUCTION_OFFER_SELL_ON_FIRST}</td>
<td><a href="{U_AUCTION_OFFER_SORT_TIME}" class="gensmall">{L_AUCTION_OFFER_TIME_STOP}</a></td>
<td>{L_AUCTION_OFFER_DELETE}</td>
<td>{L_AUCTION_OFFER_TEXT}</td>
<td>{L_AUCTION_OFFER_ADMINS_UNCENSORED_TEXT}</td>
<td>{L_AUCTION_OFFER_COMMENT}</td>
<td>{L_ADMIN_AUCTION_OFFER_FIELD_EDIT}</td>
</tr>
<BEGIN>
<tr>
<td>{no_offer.L_NO_OFFER}</td>
</tr>
<END>
<BEGIN>
<tr>
<td><a href="{offer.U_AUCTION_OFFER_VIEW}" target="_blank" class="gensmall">{offer.AUCTION_OFFER_ID}</a></td>
<td><textarea>{offer.AUCTION_OFFER_TITLE}</textarea></td>
<td><input></td>
<td><input></td>
<td><input></td>
<td><input></td>
<td>{offer.AUCTION_OFFER_PAID}</td>
<td><a href="{offer.U_AUCTION_OFFER_MARK_PAID}" class="gensmall">{offer.L_AUCTION_OFFER_MARK_PAID}</a></td>
<td>{offer.AUCTION_OFFER_OFFERER}</td>
<td>{offer.AUCTION_OFFER_VIEWS}</td>
<td>{offer.AUCTION_OFFER_PICTURE}</td>
<td><input></td>
<td><input></td>
<td><input></td>
<td>{offer.AUCTION_OFFER_SELL_ON_FIRST}</td>
<td>{offer.AUCTION_OFFER_TIME_END}</td>
<td><a href="{offer.U_AUCTION_OFFER_DELETE}" class="gensmall">{L_AUCTION_OFFER_DELETE}</a></td>
<td><textarea>{offer.AUCTION_OFFER_TEXT}</textarea></td>
<td><textarea>{offer.AUCTION_OFFER_ADMINS_UNCENSORED_TEXT}</textarea></td>
<td><textarea>{offer.AUCTION_OFFER_COMMENT}</textarea></td>
<td><a href="{offer.U_ADMIN_OFFER_EDIT}" class="gensmall">{L_ADMIN_AUCTION_OFFER_FIELD_EDIT}</a></td>
</tr>
<END>
</table>
</form>
<br>
<br>
|
2. My PHP (shortened, to show how the data is SELECTed, displayed in template, and my attempt to get the data UPDATEd):
Code: |
// START Grab all the offer-data
$sql = "SELECT t.*,
u.username,
u.user_id,
u2.username as maxbidder_user_name,
u2.user_id as maxbidder_user_id,
i.pic_id,
acc.auction_account_auction_amount,
acc.auction_account_amount_paid
FROM (" . AUCTION_OFFER_TABLE . " t
LEFT JOIN " . USERS_TABLE . " u ON u.user_id = t.FK_auction_offer_user_id
LEFT JOIN " . USERS_TABLE . " u2 ON u2.user_id = t.FK_auction_offer_last_bid_user_id
LEFT JOIN " . AUCTION_IMAGE_TABLE . " i ON t.pk_auction_offer_id=i.pic_auction_id
LEFT JOIN " . AUCTION_ACCOUNT_TABLE . " acc ON t.pk_auction_offer_id=acc.fk_auction_offer_id)
ORDER BY t.auction_offer_time_stop;";
// MY ATTEMPTED UPDATE CYCLE
if ( $mode == "admin_offer_edit" )
{
$total_offers = 0;
while( $row = $db->sql_fetchrow($result) )
{
$offer_rowset[] = $row;
$total_offers++;
} // while
$db->sql_freeresult($result);
$offer_id = ( isset($HTTP_GET_VARS[POST_AUCTION_OFFER_URL]) ) ? $HTTP_GET_VARS[POST_AUCTION_OFFER_URL] : $HTTP_POST_VARS[POST_AUCTION_OFFER_URL];
$sql = "UPDATE " . AUCTION_OFFER_TABLE . "
SET auction_offer_title = " . $auction_offer_title . ",
auction_offer_text = " . $auction_offer_text . ",
auction_offer_admins_uncensored_text = " . $auction_offer_admins_uncensored_text . ",
auction_offer_comment = " . $auction_offer_comment . ",
auction_offer_price_start = " . $auction_offer_price_start . ", auction_offer_reserve_factor = " . $auction_offer_reserve_factor . ", auction_offer_direct_sell_price = " . $auction_offer_direct_sell_price . ",
auction_offer_shipping_price = " . $auction_offer_shipping_price . ",
auction_offer_special = " . $auction_offer_special . ",
auction_offer_on_top = " . $auction_offer_on_top . ",
auction_offer_bold = " . $auction_offer_bold . "
WHERE PK_auction_offer_id='" . $offer_id . "'";
//TEMPLATE DISPLAY:
$template->assign_block_vars('offer', array(
'L_AUCTION_OFFER_MARK_PAID' => $mark,
'U_AUCTION_OFFER_MARK_PAID' => $u_mark,
'AUCTION_OFFER_TITLE' => $offer_rowset[$i]['auction_offer_title'],
'AUCTION_OFFER_ID' => $offer_rowset[$i]['PK_auction_offer_id'],
'AUCTION_OFFER_OFFERER' => $offer_rowset[$i]['username'],
'AUCTION_OFFER_VIEWS' => $offer_rowset[$i]['auction_offer_views'],
'AUCTION_OFFER_PRICE_START' => $offer_rowset[$i]['auction_offer_price_start'],
'AUCTION_OFFER_RESERVE_FACTOR' => $offer_rowset[$i]['auction_offer_reserve_factor'],
'AUCTION_OFFER_DIRECT_SELL_PRICE' => $offer_rowset[$i]['auction_offer_direct_sell_price'],
'AUCTION_OFFER_SHIPPING_PRICE' => $offer_rowset[$i]['auction_offer_shipping_price'],
'U_ADMIN_OFFER_EDIT' => append_sid("admin_auction_offer.$phpEx?mode=admin_offer_edit&" . POST_AUCTION_OFFER_URL . "=" . $offer_rowset[$i]['PK_auction_offer_id'] . ""),
'AUCTION_OFFER_ON_TOP_CHECKED' => ( $offer_rowset[$i]['auction_offer_on_top']) ? "checked=\"checked\"" : "",
'AUCTION_OFFER_SPECIAL_CHECKED' => ( $offer_rowset[$i]['auction_offer_special']) ? "checked=\"checked\"" : "",
'AUCTION_OFFER_PICTURE' => ( $offer_rowset[$i]['pic_id'] ) ? "X" : "",
'AUCTION_OFFER_SELL_ON_FIRST' => ( $offer_rowset[$i]['auction_offer_direct_sell_price']<0> $paid,
'AUCTION_OFFER_TIME_END' => create_date("m/d/Y - h:i:s", $offer_rowset[$i]['auction_offer_time_stop'], $board_config['board_timezone']),
'AUCTION_OFFER_TEXT' => $offer_rowset[$i]['auction_offer_text'],
'AUCTION_OFFER_ADMINS_UNCENSORED_TEXT' => $offer_rowset[$i]['auction_offer_admins_uncensored_text'],
'AUCTION_OFFER_COMMENT' => $offer_rowset[$i]['auction_offer_comment'],
'COUPON_USER_CREATED' => $coupon_rowset[$i]['coupon_creator'],
'COUPON_DATE_USED' => ( $coupon_rowset[$i]['auction_coupon_date_used']>0 ) ? create_date("m/d/Y - h:i:s", $coupon_rowset[$i]['auction_coupon_date_used'], $board_config['board_timezone']) : $lang['coupon_not_used'],
'COUPON_USER_USED' => ( $coupon_rowset[$i]['coupon_user']<coupon_rowset> append_sid("../auction_offer_view.$phpEx?" . POST_AUCTION_OFFER_URL . "=" . $offer_rowset[$i]['PK_auction_offer_id']),
'U_AUCTION_OFFER_DELETE' => append_sid("admin_auction_offer.$phpEx?" . POST_AUCTION_OFFER_URL . "=" . $offer_rowset[$i]['PK_auction_offer_id'] . "&mode=delete")));
} // for
} // if
$template->assign_vars(array(
'L_ADMIN_OFFER' => $lang['offer_admin'],
'L_AUCTION_OFFER_ID' => $lang['auction_offer_id'],
'L_ADMIN_OFFER_EXPLAIN' => $lang['offer_admin_explain'],
'L_AUCTION_OFFER_TITLE' => $lang['auction_offer_title'],
'L_AUCTION_OFFER_TIME_STOP' => $lang['auction_offer_time_stop'],
'L_AUCTION_OFFER_PAID' => $lang['auction_offer_paid_status'],
'L_AUCTION_OFFER_ON_TOP' => $lang['auction_offer_on_top_short'],
'L_AUCTION_OFFER_PICTURE' => $lang['auction_offer_picture_short'],
'L_AUCTION_OFFER_PRICE_START' => $lang['auction_offer_price_start_short'],
'L_AUCTION_OFFER_RESERVE_FACTOR' => $lang['auction_offer_reserve_factor_short'],
'L_AUCTION_OFFER_DIRECT_SELL' => $lang['auction_offer_direct_sell_short'],
'L_AUCTION_OFFER_SHIPPING_PRICE' => $lang['auction_offer_shipping_price_short'],
'L_AUCTION_OFFER_VIEWS' => $lang['auction_offer_views_short'],
'L_AUCTION_OFFER_SPECIAL' => $lang['auction_offer_special_short'],
'L_AUCTION_OFFER_BOLD' => $lang['auction_offer_bold_short'],
'L_AUCTION_OFFER_SELL_ON_FIRST' => $lang['auction_offer_sell_on_comment_short'],
'L_AUCTION_OFFER_OFFERER' => $lang['auction_offer_offerer'],
'L_AUCTION_OFFER_DELETE' => $lang['auction_offer_delete'],
'L_AUCTION_OFFER_MARK_PAID' => $lang['auction_offer_function'],
'L_AUCTION_OFFER_DELETE' => $lang['auction_offer_delete'],
'L_AUCTION_OFFER_SORT_JUST_PAID' => $lang['auction_offer_sort_just_paid'],
'L_AUCTION_OFFER_SORT_JUST_NOT_PAID' => $lang['auction_offer_sort_just_not_paid'],
'L_ADMIN_AUCTION_OFFER_FIELD_EDIT' => $lang['admin_auction_offer_field_edit'],
'L_AUCTION_OFFER_TEXT' => $lang['auction_offer_text_short'],
'L_AUCTION_OFFER_ADMINS_UNCENSORED_TEXT' => $lang['auction_offer_admins_uncensored_text_short'],
'L_AUCTION_OFFER_COMMENT' => $lang['auction_offer_comment_short2'],
'L_COUPON_USER_CREATED' => $lang['coupon_user_created'],
'L_COUPON_DATE_USED' => $lang['coupon_date_used'],
'L_COUPNG_USER_USED'=> $lang['coupon_user_used'],
'L_COUPON_CREATE' => $lang['coupon_create'],
'L_CHOOSE_COUPON_TYPE' => $lang['coupon_choose_type'],
'S_AUCTION_COUPON_ACTION' => append_sid("admin_auction_coupon.$phpEx?mode=create"),
'COUPON_LIST_DD' => $coupon_list_dd,
'U_AUCTION_OFFER_SORT_TITLE' => append_sid("admin_auction_offer.$phpEx?sort=title"),
'U_AUCTION_OFFER_SORT_USERNAME' => append_sid("admin_auction_offer.$phpEx?sort=username"),
'U_AUCTION_OFFER_SORT_PAID' => append_sid("admin_auction_offer.$phpEx?sort=paid"),
'U_AUCTION_OFFER_SORT_JUST_PAID' => append_sid("admin_auction_offer.$phpEx?sort=just_paid"),
'U_AUCTION_OFFER_SORT_JUST_NOT_PAID' => append_sid("admin_auction_offer.$phpEx?sort=just_not_paid"),
'U_AUCTION_OFFER_SORT_TIME' => append_sid("admin_auction_offer.$phpEx")));
$template->pparse("body");
include('./page_footer_admin.'.$phpEx);
|
* the one thing that is ID'd fine when I try UPDATing is the "offer_id" (WHERE PK_auction_offer_id='" . $offer_id . "'"; ) - only that value gets passed. Any help would be greatly appreciated.
(my site: http://www.historama.com/forum2/auction.php) |
|
Back to top |
|
 |
FR Site Admin

Joined: 26 Jan 2004 Posts: 1764 Location: root directory
|
Posted: Sun Apr 26, 2009 4:00 am Post subject: |
|
|
dont know if I understood everything.
what is the error message you see ?
Is just the offer id not there or all values you wanted to update are blank ? _________________ Want to say thank you. Use my Amazon Wishlist
Meet the world on movie-on.com |
|
Back to top |
|
 |
guyb Small-Cap Auctioneer

Joined: 22 Oct 2008 Posts: 21
|
Posted: Wed May 13, 2009 8:45 pm Post subject: |
|
|
All the values I want to update get overwritten with blank fields.
I will see all the data initially in form fields, but the moment I click the mode-link to upload the related row of fields back into the table - whether edited fields or original default values, it uploads totally blank fields and so overwrites existing data with blank data.
In a separate forum (phpbbhacks) one poster asked if in the database the field "PK_auction_offer_id" is set as an int or var: he said that most ID's are set as int rather than var, and if so, then the code
Code: | WHERE PK_auction_offer_id='" . $offer_id . "'"; |
should be written instead as
Code: | WHERE PK_auction_offer_id=" . $offer_id; |
and strings should be written as
Code: | SET auction_offer_title = '" . $auction_offer_title . "', |
and integers as
Code: | WHERE PK_auction_offer_id=" . $offer_id; |
I checked the fields and saw that PK_auction_offer_id is a "mediumint" and auction_offer_title is a "varchar", to which the poster replied that
db var fields should be presented like
'" . $varvar . "'
db int fields should be presented like
" . $intvar . "
...but I don't really know which applies to "varchar"...
I haven't had a chance to test this yet, but does that all sound logical? Could that be the reason why my upload doesn't work?
our original thread (its short) is here: http://www.phpbbhacks.com/forums/need-help-updating-sql-from-form-vt74609.html?highlight=auction |
|
Back to top |
|
 |
FR Site Admin

Joined: 26 Jan 2004 Posts: 1764 Location: root directory
|
Posted: Sun Jun 07, 2009 10:16 am Post subject: |
|
|
If i remember correctly all primary keys in phpbb were mediumint. also in the phpbb-auction.
It should drop an error message if you try to insert a varchar into a mediumint field. _________________ Want to say thank you. Use my Amazon Wishlist
Meet the world on movie-on.com |
|
Back to top |
|
 |
guyb Small-Cap Auctioneer

Joined: 22 Oct 2008 Posts: 21
|
Posted: Tue Sep 29, 2009 11:18 pm Post subject: |
|
|
I took a break from the tinkering but I'm trying again now. Can anyone advise what I'm doing wrong:
in the original "admin_auction_offer.php" file, after this code:
Code: | // START Grab all the offer-data
$sql = "SELECT t.*,
u.username,
u.user_id,
u2.username as maxbidder_user_name,
u2.user_id as maxbidder_user_id,
i.pic_id,
acc.auction_account_auction_amount,
acc.auction_account_amount_paid
FROM (" . AUCTION_OFFER_TABLE . " t
LEFT JOIN " . USERS_TABLE . " u ON u.user_id = t.FK_auction_offer_user_id
LEFT JOIN " . USERS_TABLE . " u2 ON u2.user_id = t.FK_auction_offer_last_bid_user_id
LEFT JOIN " . AUCTION_IMAGE_TABLE . " i ON t.pk_auction_offer_id=i.pic_auction_id
LEFT JOIN " . AUCTION_ACCOUNT_TABLE . " acc ON t.pk_auction_offer_id=acc.fk_auction_offer_id)
ORDER BY t.auction_offer_time_stop;"; |
I created:
Code: | if ( $mode == "admin_offer_edit" )
{
$total_offers = 0;
while( $row = $db->sql_fetchrow($result) )
{
$offer_rowset[] = $row;
$total_offers++;
} // while
$db->sql_freeresult($result);
$offer_id = ( isset($HTTP_GET_VARS[POST_AUCTION_OFFER_URL]) ) ? $HTTP_GET_VARS[POST_AUCTION_OFFER_URL] : $HTTP_POST_VARS[POST_AUCTION_OFFER_URL]; |
and then tried creating these conditions (if a field received data from the form, that would be the variable's value, otherwise the default would be whatever was originally entered, i.e. probably nothing):
Code: | if ( empty($HTTP_POST_VARS['auction_offer_title']))
{
$auction_offer_title = $offer_rowset[$i]['auction_offer_title'];
}
else
{
$auction_offer_title = $HTTP_POST_VARS['auction_offer_title'];
}
if ( empty($HTTP_POST_VARS['auction_offer_text']))
{
$auction_offer_text = $offer_rowset[$i]['auction_offer_text'];
}
else
{
$auction_offer_text = $HTTP_POST_VARS['auction_offer_text'];
}
if ( empty($HTTP_POST_VARS['auction_offer_admins_uncensored_text']))
{
$auction_offer_admins_uncensored_text = $offer_rowset[$i]['auction_offer_admins_uncensored_text'];
}
else
{
$auction_offer_admins_uncensored_text = $HTTP_POST_VARS['auction_offer_admins_uncensored_text'];
}
if ( empty($HTTP_POST_VARS['auction_offer_comment']))
{
$auction_offer_comment = $offer_rowset[$i]['auction_offer_comment'];
}
else
{
$auction_offer_comment = $HTTP_POST_VARS['auction_offer_comment'];
}
if ( empty($HTTP_POST_VARS['auction_offer_price_start']))
{
$auction_offer_price_start = $offer_rowset[$i]['auction_offer_price_start'];
}
else
{
$auction_offer_price_start = $HTTP_POST_VARS['auction_offer_price_start'];
}
if ( empty($HTTP_POST_VARS['auction_offer_reserve_factor']))
{
$auction_offer_reserve_factor = $offer_rowset[$i]['auction_offer_reserve_factor'];
}
else
{
$auction_offer_reserve_factor = $HTTP_POST_VARS['auction_offer_reserve_factor'];
}
if ( empty($HTTP_POST_VARS['auction_offer_direct_sell_price']))
{
$auction_offer_direct_sell_price = $offer_rowset[$i]['auction_offer_direct_sell_price'];
}
else
{
$auction_offer_direct_sell_price = $HTTP_POST_VARS['auction_offer_direct_sell_price'];
}
if ( empty($HTTP_POST_VARS['auction_offer_shipping_price']))
{
$auction_offer_shipping_price = $offer_rowset[$i]['auction_offer_shipping_price'];
}
else
{
$auction_offer_shipping_price = $HTTP_POST_VARS['auction_offer_shipping_price'];
}
if (empty($HTTP_POST_VARS['offer_special']) )
{
$auction_offer_special = 0;
}
else
{
$auction_offer_special = 1;
}
if (empty($HTTP_POST_VARS['offer_on_top']) )
{
$auction_offer_on_top = 0;
}
else
{
$auction_offer_on_top = 1;
}
if (empty($HTTP_POST_VARS['offer_bold']) )
{
$auction_offer_bold = 0;
}
else
{
$auction_offer_bold = 1; |
I'm then trying to update the sql table like this:
Code: | $sql = "UPDATE " . AUCTION_OFFER_TABLE . "
SET auction_offer_title = '" . $auction_offer_title . "',
auction_offer_text = '" . $auction_offer_text . "',
auction_offer_admins_uncensored_text = '" . $auction_offer_admins_uncensored_text . "',
auction_offer_comment = '" . $auction_offer_comment . "',
auction_offer_price_start = " . $auction_offer_price_start . ",
auction_offer_reserve_factor = " . $auction_offer_reserve_factor . ",
auction_offer_direct_sell_price = " . $auction_offer_direct_sell_price . ",
auction_offer_shipping_price = " . $auction_offer_shipping_price . ",
auction_offer_special = " . $auction_offer_special . ",
auction_offer_on_top = " . $auction_offer_on_top . ",
auction_offer_bold = " . $auction_offer_bold . "
WHERE PK_auction_offer_id = " . $offer_id . ""; |
afterwards there are some IF statements regarding the sorting of the fields - original coding from this file, and after that is my tinkered command to populate the template:
Code: |
$template->assign_block_vars('offer', array(
'L_AUCTION_OFFER_MARK_PAID' => $mark,
'U_AUCTION_OFFER_MARK_PAID' => $u_mark,
'AUCTION_OFFER_TITLE' => $offer_rowset[$i]['auction_offer_title'],
'AUCTION_OFFER_ID' => $offer_rowset[$i]['PK_auction_offer_id'],
'AUCTION_OFFER_OFFERER' => $offer_rowset[$i]['username'],
'AUCTION_OFFER_VIEWS' => $offer_rowset[$i]['auction_offer_views'],
'AUCTION_OFFER_PRICE_START' => $offer_rowset[$i]['auction_offer_price_start'],
'AUCTION_OFFER_RESERVE_FACTOR' => $offer_rowset[$i]['auction_offer_reserve_factor'],
'AUCTION_OFFER_DIRECT_SELL_PRICE' => $offer_rowset[$i]['auction_offer_direct_sell_price'],
'AUCTION_OFFER_SHIPPING_PRICE' => $offer_rowset[$i]['auction_offer_shipping_price'],
// 'S_ADD_EDIT_SHIPPING_PRICE' => append_sid("../auction_offer.$phpEx?mode=edit_shipping_price&" . POST_AUCTION_OFFER_URL . "=" . $offer_rowset[$i]['PK_auction_offer_id'] . ""),
// REMOVED BECAUSE ADDED MY CASE INTO THIS FILE FROM AUCTION-OFFER.php 'S_ADMIN_OFFER_EDIT' => append_sid("../auction_offer.$phpEx?mode=admin_offer_edit&" . POST_AUCTION_OFFER_URL . "=" . $offer_rowset[$i]['PK_auction_offer_id'] . ""),
// LATEST VER of BUTTON 'S_ADMIN_OFFER_EDIT' => append_sid("../auction_offer.$phpEx?mode=admin_offer_edit&" . POST_AUCTION_OFFER_URL . "=" . $offer_rowset[$i]['PK_auction_offer_id'] . ""),
// IF CASE IS IN AUCTION_OFFER.php: 'U_ADMIN_OFFER_EDIT' => append_sid("../auction_offer.$phpEx?mode=admin_offer_edit&" . POST_AUCTION_OFFER_URL . "=" . $offer_rowset[$i]['PK_auction_offer_id'] . ""),
'U_ADMIN_OFFER_EDIT' => append_sid("admin_auction_offer.$phpEx?mode=admin_offer_edit&" . POST_AUCTION_OFFER_URL . "=" . $offer_rowset[$i]['PK_auction_offer_id'] . ""),
'AUCTION_OFFER_ON_TOP_CHECKED' => ( $offer_rowset[$i]['auction_offer_on_top']) ? "checked=\"checked\"" : "",
'AUCTION_OFFER_SPECIAL_CHECKED' => ( $offer_rowset[$i]['auction_offer_special']) ? "checked=\"checked\"" : "",
'AUCTION_OFFER_PICTURE' => ( $offer_rowset[$i]['pic_id'] ) ? "X" : "",
'AUCTION_OFFER_SELL_ON_FIRST' => ( $offer_rowset[$i]['auction_offer_direct_sell_price']<0> $paid,
'AUCTION_OFFER_TIME_END' => create_date("m/d/Y - h:i:s", $offer_rowset[$i]['auction_offer_time_stop'], $board_config['board_timezone']),
'AUCTION_OFFER_TEXT' => $offer_rowset[$i]['auction_offer_text'],
'AUCTION_OFFER_ADMINS_UNCENSORED_TEXT' => $offer_rowset[$i]['auction_offer_admins_uncensored_text'],
'AUCTION_OFFER_COMMENT' => $offer_rowset[$i]['auction_offer_comment'],
'COUPON_USER_CREATED' => $coupon_rowset[$i]['coupon_creator'],
'COUPON_DATE_USED' => ( $coupon_rowset[$i]['auction_coupon_date_used']>0 ) ? create_date("m/d/Y - h:i:s", $coupon_rowset[$i]['auction_coupon_date_used'], $board_config['board_timezone']) : $lang['coupon_not_used'],
'COUPON_USER_USED' => ( $coupon_rowset[$i]['coupon_user']<coupon_rowset> append_sid("../auction_offer_view.$phpEx?" . POST_AUCTION_OFFER_URL . "=" . $offer_rowset[$i]['PK_auction_offer_id']),
'U_AUCTION_OFFER_DELETE' => append_sid("admin_auction_offer.$phpEx?" . POST_AUCTION_OFFER_URL . "=" . $offer_rowset[$i]['PK_auction_offer_id'] . "&mode=delete")));
} // for
} // if
$template->assign_vars(array(
'L_ADMIN_OFFER' => $lang['offer_admin'],
'L_AUCTION_OFFER_ID' => $lang['auction_offer_id'],
'L_ADMIN_OFFER_EXPLAIN' => $lang['offer_admin_explain'],
'L_AUCTION_OFFER_TITLE' => $lang['auction_offer_title'],
'L_AUCTION_OFFER_TIME_STOP' => $lang['auction_offer_time_stop'],
'L_AUCTION_OFFER_PAID' => $lang['auction_offer_paid_status'],
'L_AUCTION_OFFER_ON_TOP' => $lang['auction_offer_on_top_short'],
'L_AUCTION_OFFER_PICTURE' => $lang['auction_offer_picture_short'],
'L_AUCTION_OFFER_PRICE_START' => $lang['auction_offer_price_start_short'],
'L_AUCTION_OFFER_RESERVE_FACTOR' => $lang['auction_offer_reserve_factor_short'],
'L_AUCTION_OFFER_DIRECT_SELL' => $lang['auction_offer_direct_sell_short'],
'L_AUCTION_OFFER_SHIPPING_PRICE' => $lang['auction_offer_shipping_price_short'],
'L_AUCTION_OFFER_VIEWS' => $lang['auction_offer_views_short'],
'L_AUCTION_OFFER_SPECIAL' => $lang['auction_offer_special_short'],
'L_AUCTION_OFFER_BOLD' => $lang['auction_offer_bold_short'],
'L_AUCTION_OFFER_SELL_ON_FIRST' => $lang['auction_offer_sell_on_comment_short'],
// 'L_AUCTION_OFFER_COMMENT' => $lang['auction_offer_comment_short'],
'L_AUCTION_OFFER_OFFERER' => $lang['auction_offer_offerer'],
'L_AUCTION_OFFER_DELETE' => $lang['auction_offer_delete'],
'L_AUCTION_OFFER_MARK_PAID' => $lang['auction_offer_function'],
'L_AUCTION_OFFER_DELETE' => $lang['auction_offer_delete'],
'L_AUCTION_OFFER_SORT_JUST_PAID' => $lang['auction_offer_sort_just_paid'],
'L_AUCTION_OFFER_SORT_JUST_NOT_PAID' => $lang['auction_offer_sort_just_not_paid'],
'L_ADMIN_AUCTION_OFFER_FIELD_EDIT' => $lang['admin_auction_offer_field_edit'],
'L_AUCTION_OFFER_TEXT' => $lang['auction_offer_text_short'],
'L_AUCTION_OFFER_ADMINS_UNCENSORED_TEXT' => $lang['auction_offer_admins_uncensored_text_short'],
'L_AUCTION_OFFER_COMMENT' => $lang['auction_offer_comment_short2'],
'L_COUPON_USER_CREATED' => $lang['coupon_user_created'],
'L_COUPON_DATE_USED' => $lang['coupon_date_used'],
'L_COUPNG_USER_USED'=> $lang['coupon_user_used'],
'L_COUPON_CREATE' => $lang['coupon_create'],
'L_CHOOSE_COUPON_TYPE' => $lang['coupon_choose_type'],
'S_AUCTION_COUPON_ACTION' => append_sid("admin_auction_coupon.$phpEx?mode=create"),
'COUPON_LIST_DD' => $coupon_list_dd,
'U_AUCTION_OFFER_SORT_TITLE' => append_sid("admin_auction_offer.$phpEx?sort=title"),
'U_AUCTION_OFFER_SORT_USERNAME' => append_sid("admin_auction_offer.$phpEx?sort=username"),
'U_AUCTION_OFFER_SORT_PAID' => append_sid("admin_auction_offer.$phpEx?sort=paid"),
'U_AUCTION_OFFER_SORT_JUST_PAID' => append_sid("admin_auction_offer.$phpEx?sort=just_paid"),
'U_AUCTION_OFFER_SORT_JUST_NOT_PAID' => append_sid("admin_auction_offer.$phpEx?sort=just_not_paid"),
'U_AUCTION_OFFER_SORT_TIME' => append_sid("admin_auction_offer.$phpEx")));
$template->pparse("body");
|
The end result is that I can get an offer's original data to populate a form field, but if I try to edit/update the form with a new value (or just delete an existing value), I get this:
Couldn't update Admin's account changes. Please try again.
DEBUG MODE
SQL Error : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' auction_offer_reserve_factor = ,
UPDATE phpbb_auction_offer SET auction_offer_title = '', auction_offer_text = '', auction_offer_admins_uncensored_text = '', auction_offer_comment = '', auction_offer_price_start = , auction_offer_reserve_factor = , auction_offer_direct_sell_price = , auction_offer_shipping_price = , auction_offer_special = 0, auction_offer_on_top = 0, auction_offer_bold = 0 WHERE PK_auction_offer_id = 333
Line : 451
File : admin_auction_offer.php
I can see that 4 values are being received, but the 3 zeros for the special, bold, on-top are actually non-responsive: even if I click them and try uploading, the 0 value gets passed.
One of my concerns is, have I placed the order of all these commands okay, or is my problem that the coding so far does not allow for an "upload" of data following its initial display? |
|
Back to top |
|
 |
guyb Small-Cap Auctioneer

Joined: 22 Oct 2008 Posts: 21
|
Posted: Thu Oct 01, 2009 9:08 am Post subject: |
|
|
I had a thought yesterday that perhaps my problem is with where I am trying to execute the sql UPDATE:
since I'm activating the process from the ACP side, I thought maybe the UPDATE should be in "admin_auction_offer.php", but now I'm wondering if the mode and sql callup should really be done in "auction_offer.php", which is the main offer creation file.... |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|