Jump to content

[SOLVED] mysql - why this doesn't work!


receiver

Recommended Posts

Hello,

 

I am working on a php script, but I have a problem with the script that I can't understand.

 

I inserted new 3 fields to that mysql table, settings were like other working tables.

First script step, inserts these values to DB, and I can see them with phpmyadmin they are there:

 

$upd = mysql_query("INSERT INTO other_history (usrid, amount, package, nr_cred, processor, is_from, adate, descr) VALUES ('$userac', '$amount', '$package', '$nr_cred', 'Credit/Debit Card', '$order_id', '$date_now', 'Complete')") or die (mysql_error());

Now I get these values:

 

$get_other = mysql_query("SELECT * FROM other_history WHERE usrid=$usrid ORDER BY adate");
echo("<b>Purchased</b>");
if (mysql_num_rows($get_other) != 0) {
echo("<table width='95%' border='0' cellspacing='1' cellpadding='2'>
<tr>
    <td width='11%'><strong>ID</strong></td>
    <td width='12%'><strong>Date</strong></td>
    <td width='11%'><strong>Amount</strong></td>
<td width='15%'><strong>Package</strong></td>
    <td width='15%'><strong>Credits</strong></td>
    <td width='11%'><strong>Processor</strong></td>
<td width='11%'><strong>Transaction ID</strong></td>
 <td width='15%'><strong>Status</strong></td>
</tr>");
for ($v = 0; $v < mysql_num_rows($get_other); $v++) {
$oth_id = mysql_result($get_other, $v, "id");
$othamount = mysql_result($get_other, $v, "amount");
$other_descr = mysql_result($get_other, $v, "descr");
$oadate = mysql_result($get_other, $v, "adate");
$isfrm = mysql_result($get_other, $v, "is_from");
[b]$processor = mysql_result($get_other, $v, "$processor");
$package = mysql_result($get_other, $v, "$package");
$nr_cred = mysql_result($get_other, $v, "$nr_cred");[/b]
echo("<tr>
    <td><div align='center'>$oth_id</div></td>
    <td><div align='center'>$oadate</div></td>
    <td><div align='center'>\$$othamount</div></td>
    <td><div align='center'>$package</div></td>
<td><div align='center'>$nr_cred</div></td>
<td><div align='center'>$processor</div></td>
    <td><div align='center'>$isfrm</div></td>
 <td><div align='center'>$other_descr</div></td></tr>");
}
echo("</table>");
} else {
echo("<b>No transactions found</b>");
}
mysql_close;
exit;

 

 

I GET THIS ERROR, this error is for these 3 bold mysql results, I dont know why he can't get these like other:

Warning: mysql_result() [function.mysql-result]: 0 not found in MySQL result index 9 in /test.php on line 139

Warning: mysql_result() [function.mysql-result]: not found in MySQL result index 9 in /test.php on line 140

Warning: mysql_result() [function.mysql-result]: not found in MySQL result index 9 in /test.php on line 141

 

 

I hope someone can help me with this!

Thank you!!

Link to comment
https://forums.phpfreaks.com/topic/163941-solved-mysql-why-this-doesnt-work/
Share on other sites

1. Don't color your code. Use


instead. It's a giant pain in the ass to read code that's all in one static color, especially in red.

 

As for your issue, remove the $ in $processor, $package and $nr_cred in the 3 lines you bolded.

 

Thank you so much, why didn't I see that, I spent like 3 hours looking at the code and finding an answer, lol

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.