Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,977 members, 7,817,876 topics. Date: Saturday, 04 May 2024 at 09:53 PM

Updating Issue Need Help Thanks - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Updating Issue Need Help Thanks (768 Views)

Entity Framework Vs Ado.net With TVP Updating Multiple Rows / Updating Issue Need Help Thanks / Updating A Users Row (2) (3) (4)

(1) (Reply)

Updating Issue Need Help Thanks by skyhighweb(m): 11:35am On Jul 19, 2017
ok

hi am having an update issue problem, i have two tables

table 1
users
column id balance
...........3 ......675
...........6 ......400
...........8.......900
...........2.......450
...........5.......200


table 2
bids
column auction bidder
...........90.......3
...........90.......6
...........90.......8

...........95.......2
...........95.......5

for now i have this code (below) that display users with selected auction works fine

// Retrieve users that bids

$query = "SELECT b.*, u.name, u.nick, u.balance, s.team_id, s.teams, uu.nick AS nick_tag FROM " . $DBPrefix . "bids b
LEFT JOIN " . $DBPrefix . "users u ON (u.id = b.bidder)
LEFT JOIN " . $DBPrefix . "users uu ON (uu.id = b.tagged)
LEFT JOIN " . $DBPrefix . "sports s ON (s.team_id = b.willwin)
WHERE b.auction = :user_id order by b.tagged desc";
$params = array();
$params[] = array(':user_id', $id, 'int');
$db->query($query, $params);



And i have this code (below) that update users balance but it update all users cause it not connected to bids, trying to update column balance in "users" based on the auction id in "bids" being equal to auction id

if (isset($_POST['action']) && $_POST['action'] == 'update')
{
$query = "UPDATE " . $DBPrefix . "users SET balance = :balance";
$params = array();
$params[] = array(':balance', $system->input_money($_POST['balance']), 'float');
$db->query($query, $params);

header('location: listusers.php?PAGE=' . intval($_POST['offset']));
exit;
}

hope u understand

(1) (Reply)

Learn Programming / Become A Professional Web Developer / Develop Yourself Professionally With 100% Free Training

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 9
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.