/    Sign up×
Community /Pin to ProfileBookmark

Ive Problem With This Code.

[code=php]

<?
session_start();
header(“Content-control: private”);
if($_SESSION[‘user’]==””)

include ‘dbase.php’;

$id = $_GET[‘id’];
$query = “SELECT * FROM stok WHERE id =’$id’ limit 1″;
$result = mysql_db_query($dbname,$query);

$namaproduk = mysql_result($result,0,”namaProduk”);
$hargaseunit = mysql_result($result,0,”hargaSeunit”);
$peratuskeuntungan = mysql_result($result,0,”peratusKeuntungan”);
$hargajualan = mysql_result($result,0,”hargaJualan”);
$bilstok = mysql_result($result,0,”bilStok”);
$tarikh = mysql_result($result,0,”tarikh”);

@mysql_free_result($result);
?>
<html>
<head>
<title>Terminal Computer Services :: Stok</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
</head>

<script type=”text/javascript”>
function CalcPercnt(val, f) {
//val: Percentage Field value
//f: form which percent1 is in

if (!val == “”){
f.hargajualan.value = (f.hargaseunit.value * (val / 100 + 1)).toFixed(2)
}
}
</script>

<body>
<form action=”updatestok.php” method=”POST”>
<table width=”87%” height=”292″ border=”0″ align=”center” bgcolor=”#000000″>
<tr>
<td width=”41%”><font color=”#FFFFFF”><h3>Nama Produk:</h3></font></td>
<td width=”29%”> <input name=”namaproduk” type=”text” size=”25″value=”<? echo $namaproduk;?>”></td>
</tr>

<tr>
<td width=”29%”><font color=”#FFFFFF”><h3>Harga seunit:</h3><td width=”71%”><input name=”hargaseunit” type=”text” size=”25″ value=”<? echo $hargaseunit;?>”></td>
</tr>
<tr>

<td width=”29%”><font color=”#FFFFFF”><h3>Peratus Keuntungan:</h3></td><td><select name=”peratuskeuntungan” onBlur=”CalcPercnt(this.value, this.form)” value= “<? echo $peratuskeuntungan;?>”>
<option>5</option>
<option>10</option>
<option>15</option>
<option>20</option>
<option>25</option>
<option>30</option>
</select></td>
</tr>
<tr>
<td width=”41%”><font color=”#FFFFFF”><h3>Harga Jualan:</h3><td width=”30%”><input name=”hargajualan” type=”text” size=”25″ value=”<? echo $hargajualan;?>”></td>
</tr>

<tr><td width=”29%”><font color=”#FFFFFF”>
<h3>Bil Stok:</h3></font></td>
<td width=”71%”><input name=”bilstok” type=”text” size=”25″ value=”<? echo $bilstok;?>”></td>
</tr>

<td><font color=”#FFFFFF”><h3>Tarikh<em>(dd/mm/yy)</em>:</h3></font></td><td>
<input name=”tarikh” type=”text” size=”25″ value=”<? echo $tarikh;?>”></td>
<input type=”hidden” name=”id” id=”id” value=”<? echo $id; ?>”></td>
</tr>
<tr> <br><br><br>

</table>

<td>
<br><br><br>

<input type=”submit” name=”Submit” value=”Ubah”>
<input type=”reset” name=”Submit2″ value=”Reset”>
</td>
</form>
</body>
</html>

[/code]

WHEN I RUN THIS CODE,I GOT THIS MESSAGE::I HOPE SOMEONE CAN HELP ME TO SOLVE THIS PROBLEM.

Warning: Unable to jump to row 0 on MySQL result index 2 in c:phpdevwwwtcsubahstok.php on line 12

Warning: Unable to jump to row 0 on MySQL result index 2 in c:phpdevwwwtcsubahstok.php on line 13

Warning: Unable to jump to row 0 on MySQL result index 2 in c:phpdevwwwtcsubahstok.php on line 14

Warning: Unable to jump to row 0 on MySQL result index 2 in c:phpdevwwwtcsubahstok.php on line 15

Warning: Unable to jump to row 0 on MySQL result index 2 in c:phpdevwwwtcsubahstok.php on line 16

Warning: Unable to jump to row 0 on MySQL result index 2 in c:phpdevwwwtcsubahstok.php on line 17

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMay 17.2005 — I'm guessing your query is not returning any rows. For a quick check, put these lines after the call to mysql_query():
[code=php]
if(!$result)
{
die ("MySQL error " . mysql_errno() . ": " mysql_error());
}
elseif(mysql_num_rows($result) == 0)
{
die("ERROR: query returned 0 rows of data.");
}
[/code]
×

Success!

Help @inventive 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.8,
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,
)...