/    Sign up×
Community /Pin to ProfileBookmark

Basic error but cant find it

Hi, can someone please tell me why when i echo out the AuctionID from the database it doesn’t show. where i got “Your Auction ID is $AuctionID” the AuctionID is a field in the table i need it to show the value.

[code=php]
<?PHP

//conn
$conn = mysql_connect(“localhost”, “k0m0d0”, “ragnarok”) or die(mysql_error());

//select table
mysql_select_db(“ebay”,$conn) or die(mysql_error());

//statement
$sql = “select AuctionID from itemswon where WinnerUserID =
‘$_POST[eBayUserID]’ AND eBayItemNumber = ‘$_POST[eBayItemNumber]'”;

//if script
$result = mysql_query($sql, $conn) or die(mysql_error());
if (mysql_num_rows($result) ==1) {
echo “Your Auction ID is $AuctionID”;
} else {
echo “Your ID does not exist”;
}
?>
[/code]

Thanks
Adam

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@pyroAug 12.2004 — You never returned the results of the query. Try this:

[code=php]<?PHP

//conn
$conn = mysql_connect("localhost", "k0m0d0", "ragnarok") or die(mysql_error());

//select table
mysql_select_db("ebay",$conn) or die(mysql_error());

//statement
$sql = "SELECT AuctionID FROM itemswon WHERE WinnerUserID =
'$_POST[eBayUserID]' AND eBayItemNumber = '$_POST[eBayItemNumber]'";

//if script
$result = mysql_query($sql, $conn) or die(mysql_error());
if (mysql_num_rows($result) == 1) {
$row = mysql_fetch_array($result); # fetch the results
echo "Your Auction ID is ".$row['AuctionID'];
}
else {
echo "Your ID does not exist";
}
?>[/code]
×

Success!

Help @k0r54 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...