darkfreaks Posted March 21, 2010 Share Posted March 21, 2010 so im trying to make a modification to a script to add reserve_price how would i add it into my select statement i have currently to select it so i can compare? $domain = $this->dbh->getRow("select " . TABLE_PREFIX . "domains.id, " . TABLE_PREFIX . "domains.owner, " . TABLE_PREFIX . "domains.domain, " . TABLE_PREFIX . "auctions.end_date, " . TABLE_PREFIX . "auctions.starting_price, " . TABLE_PREFIX . "auctions.id as auctionid, " . TABLE_PREFIX . "auctions.high_bid from " . TABLE_PREFIX . "domains left join " . TABLE_PREFIX . "auctions on " . TABLE_PREFIX . "auctions.domain_id = " . TABLE_PREFIX . "domains.id left join " . TABLE_PREFIX . "bids on " . TABLE_PREFIX . "bids.auction_id = " . TABLE_PREFIX . "auctions.id where " . TABLE_PREFIX . "domains.id='" . $_POST['domainid'] . "' group by " . TABLE_PREFIX . "domains.id limit 1", DB_FETCHMODE_ASSOC); $highbid = $this->dbh->getRow("select " . TABLE_PREFIX . "bids.maximum_bid as high_bid, " . TABLE_PREFIX . "bids.bidder_id, " . TABLE_PREFIX . "users.username, " . TABLE_PREFIX . "users.email_address from " . TABLE_PREFIX . "bids left join " . TABLE_PREFIX . "users on " . TABLE_PREFIX . "users.id = " . TABLE_PREFIX . "bids.bidder_id where " . TABLE_PREFIX . "bids.auction_id='" . $domain['auctionid'] . "' order by " . TABLE_PREFIX . "bids.maximum_bid desc limit 1", DB_FETCHMODE_ASSOC); $mymaxbid = $this->dbh->getRow("select maximum_bid as my_maximum_bid from " . TABLE_PREFIX . "bids where auction_id='" . $domain['auctionid'] . "' and bidder_id='" . $Userid . "' order by maximum_bid desc limit 1", DB_FETCHMODE_ASSOC); Quote Link to comment https://forums.phpfreaks.com/topic/195970-select-help-phpmysql/ Share on other sites More sharing options...
trq Posted March 21, 2010 Share Posted March 21, 2010 Why is your code spread out so much it is unreadable? Quote Link to comment https://forums.phpfreaks.com/topic/195970-select-help-phpmysql/#findComment-1029412 Share on other sites More sharing options...
TeddyKiller Posted March 21, 2010 Share Posted March 21, 2010 These are his queries in a more.. tidier way. Although looking at it, he may of spread them out for a reason! $domain = $this->dbh->getRow("select " . TABLE_PREFIX . "domains.id, " . TABLE_PREFIX . "domains.owner, " . TABLE_PREFIX . "domains.domain, " . TABLE_PREFIX . "auctions.end_date, " . TABLE_PREFIX . "auctions.starting_price, " . TABLE_PREFIX . "auctions.id as auctionid, " . TABLE_PREFIX . "auctions.high_bid from " . TABLE_PREFIX . "domains left join " . TABLE_PREFIX . "auctions on " . TABLE_PREFIX . "auctions.domain_id = " . TABLE_PREFIX . "domains.id left join " . TABLE_PREFIX . "bids on " . TABLE_PREFIX . "bids.auction_id = " . TABLE_PREFIX . "auctions.id where " . TABLE_PREFIX . "domains.id='" . $_POST['domainid'] . "' group by " . TABLE_PREFIX . "domains.id limit 1", DB_FETCHMODE_ASSOC); $highbid = $this->dbh->getRow("select " . TABLE_PREFIX . "bids.maximum_bid as high_bid, " . TABLE_PREFIX . "bids.bidder_id, " . TABLE_PREFIX . "users.username, " . TABLE_PREFIX . "users.email_address from " . TABLE_PREFIX . "bids left join " . TABLE_PREFIX . "users on " . TABLE_PREFIX . "users.id = " . TABLE_PREFIX . "bids.bidder_id where " . TABLE_PREFIX . "bids.auction_id='" . $domain['auctionid'] . "' order by " . TABLE_PREFIX . "bids.maximum_bid desc limit 1", DB_FETCHMODE_ASSOC); $mymaxbid = $this->dbh->getRow("select maximum_bid as my_maximum_bid from " . TABLE_PREFIX . "bids where auction_id='" . $domain['auctionid'] . "' and bidder_id='" . $Userid . "' order by maximum_bid desc limit 1", DB_FETCHMODE_ASSOC); Quote Link to comment https://forums.phpfreaks.com/topic/195970-select-help-phpmysql/#findComment-1029417 Share on other sites More sharing options...
darkfreaks Posted March 21, 2010 Author Share Posted March 21, 2010 sorry i spaced them out to make sense of the code i organized and tidied it better now but this is what i have for reserve would someone tell me if it would select properly and do i really need a where clause for it $reserve = $this->dbh->getRow("select reserve_bid as my_reserve_bid from" . TABLE_PREFIX . ""); Quote Link to comment https://forums.phpfreaks.com/topic/195970-select-help-phpmysql/#findComment-1029422 Share on other sites More sharing options...
fenway Posted March 22, 2010 Share Posted March 22, 2010 Then type a where clause -- I don't see the issue. Quote Link to comment https://forums.phpfreaks.com/topic/195970-select-help-phpmysql/#findComment-1030188 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.