Jump to content

Recommended Posts

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);

Link to comment
https://forums.phpfreaks.com/topic/195970-select-help-phpmysql/
Share on other sites

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);

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 :confused:

 

$reserve = $this->dbh->getRow("select reserve_bid as my_reserve_bid from" . TABLE_PREFIX . "");

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.