Jump to content

PHP Code Problem


pommi

Recommended Posts

Can some one please help, I have a problem with my code which I believe I have isolated to some where here.  The code seems to stop after "print "<p><img src='../font/images/divider.jpg' /></p>";"

 

Any ideas???

 

$x = 5;
$row = 0;
array_multisort($card, SORT_DESC); //Sort Array
while ($row < $x)
{
//Divider
print "<p><img src='../font/images/divider.jpg' /></p>";
//table results	
print $query;
print "<p><a href='../creditcard_features.php?id=" . $card[$row]["id"] . "'>" . $card[$row]["bank"] . " "  . $card[$row]["name"] . " - More Details</a></p>";
print "<table>";
//Interest Rate, Fee and Score
print "<tr><td class='tbl_title'>Interest Rate</td><td class='tbl_title'>Annual Fee</td><td class='tbl_title'>Score</td><td></td></tr>";
print "<tr><td class='tbl_text'>" . $card[$row]["rate"] . "%</td>";
print "<td class='tbl_text'>$" . $card[$row]["fee"] . "</td>";	
print "<td class='tbl_score'>" . $card[$row]["score"] . "</td></tr>";
print "<tr><td class='tbl_text'><a href=../creditcard_features.php?id=" . $card[$row]["id"] . "><img class=img src=../images/cards/" . $card[$row]["image"] . " /></a></td>";
print "<td class='tbl_text'><p>" . $card[$row]["interest_free"] . " days interest free</p>";
	//Balance Tranfer
	if($card[$row]["balance_transfer"] == "Yes")
		{
		print $card[$row]["transfer_rate"] . "% balance transfer";
			if(!empty($card[$row]["bt_period"])) 
			{ print " for " . $card[$row]["bt_period"] ;}
		print "</td>";
		}
//Apply
session_start();
$campaign = $_SESSION['campaign'];
print "<td class='tbl_text'><a href='../tracking.php?id=" . $card[$row]["id"] . "&campaign=" . $campaign . "'  target='_blank'><img src='../font/images/appy_now.jpg' class='img' alt='Apply Online' /></a></td></tr>";
//Obtain Card Ranking Result
print "<tr><td class=main colspan='3'  class='tbl_text'>";
require'../search_rank_script.php';
//Rank Card
print "<a href='../rank_menu?cr=" . $card[$row]["id"] . "#' class=menuLink2>Rate the " . $card[$row]["bank"] . " "  . $card[$row]["name"] . "card</a></td></tr></table>";
$row++;
}

Link to comment
https://forums.phpfreaks.com/topic/133562-php-code-problem/
Share on other sites

seems to be a problem with my query / mysql database....  but the strange thing is it works perfeclty on my test server but not the prod server.

 

They both are running PHP 5 and

 

MySQL client version: 5.0.22 (test)

MySQL client version: 5.0.45 (prod)

 

can anyone tell me why I may get a different result from the two machines??

Link to comment
https://forums.phpfreaks.com/topic/133562-php-code-problem/#findComment-694828
Share on other sites

Ok, the error I am receiving is:

"Fatal error: Cannot use string offset as an array in"

 

I know the database query is working and passing a value.... I believe its some issue with PHP5 but I can't find the answer anywhere....  and anyone help??

 

	$card[] = array(  
				id => $row['id'],
				name => $row['name'],
				bt_period => $row['bt_period'],
				transfer_rate => $row['transfer_rate'],
				fee => ($row['fee'] + $row['reward_fee']),
				rewards => $row['rewards'],
				interest_free => $row['interest_free'],
				image => $row['img'],
				url => $row['link']
				);

Link to comment
https://forums.phpfreaks.com/topic/133562-php-code-problem/#findComment-695237
Share on other sites

Just tried declaring the $row, no luck sadly...  $row is the variable storing the results of my sql call "$row = mysql_fetch_array( $mysql )"

 

So I know the the values are passing into the variable $row, but they don't seem to be feeding into the cost in my previous comment, and I am receiving the error msg i posted  :(

Link to comment
https://forums.phpfreaks.com/topic/133562-php-code-problem/#findComment-695270
Share on other sites

try this

 

$card[] = array(  
                'id' => $row['id'],
                'name' => $row['name'],
                'bt_period' => $row['bt_period'],
                'transfer_rate' => $row['transfer_rate'],
                'fee' => ($row['fee'] + $row['reward_fee']),
                'rewards' => $row['rewards'],
                'interest_free' => $row['interest_free'],
                'image' => $row['img'],
                'url' => $row['link']
                );

Link to comment
https://forums.phpfreaks.com/topic/133562-php-code-problem/#findComment-695274
Share on other sites

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.