Click to See Complete Forum and Search --> : help!


s33n
08-14-2004, 07:50 AM
im working on a login script where the user logs in and the script displays the values from the database.
I am then connecting to another database and using details from both databases.
i keep getting this error:
mysql_result(): Unable to jump to row 0 on MySQL result index 3 on line 16

line 16 is

$title = mysql_result($result, 0, 'Title');



The full code is

<?php

#connect
$conn = mysql_connect('localhost', 'k0m0d0', 'ragnarok') or die(mysql_error());
mysql_select_db("ebay", $conn);

#sql query
$sql = "select WinnerUserID, eBayItemNumber from itemswon where WinnerUserID = '$_POST[eBayUserID]'
AND eBayItemNumber = '$_POST[eBayItemNumber]'";
$sqlid = "select Title, SubTitle from auctions where ID='$AuctionID'";

#result
$result = mysql_query($sqlid, $conn) or die(mysql_error());

#if get values
$title = mysql_result($result, 0, 'Title');
$subtitle = mysql_result($result, 0, ');

if (mysql_query($sql, $conn)) {
echo "congrats you have won<br><h1>$title</h1><br>$subtitle";
} else {
echo "sorry try again". mysql_error();
};
?>


cheeres :)

jacen6678
09-08-2004, 11:42 AM
Are you sure that the query is returning anything at all? And that the query return contains data in a field 'Title'?

For debugging, you might want to use mysql_fetch_array() to see what is in row 0.

Also, I think there is an error in line 17... you have one single quote as your third parameter.