Error on loop[SOLVED]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
schwarzerosen
Forum Newbie
Posts: 3
Joined: Fri Jun 26, 2009 10:45 pm

Error on loop[SOLVED]

Post by schwarzerosen »

Hello.

I am in a bit of a hurry on this site, and I seem to have run into a little snag. When I open the page, I get the error

Code: Select all

Fatal error: Function name must be a string in /home/a********/public_html/index.html on line 72
I have never encountered this error. I have searched google, and tried a few things I saw(with no luck). Any help will be appreciated. Here are all relevant snippets.

lines 1-14:

Code: Select all

<?php
require "config.php";
mysql_connect($dbserv, $dbuser, $dbpass);
@mysql_select_db($dbmain) or die( "Unable to select database");
$post = mysql_query("SELECT * FROM homepage");
$zero = 0;
$title = mysql_result($post, $zero, 'val1');
$cont = mysql_result($post, $zero, 'val2');
$poster = mysql_result($post, $zero, 'val3');
$prod = mysql_query("SELECT href, name FROM products WHERE sixnew=1");
$news = mysql_query("SELECT href, name FROM news WHERE sixnew=1");
$afil = mysql_query("SELECT href, name FROM afiliates");
mysql_close();
?>
lines 69-76:

Code: Select all

<?php
$cx = 6;
while ($cx > 0) {
$cx = $cx - 1;
$phref = $mysql_result($prod, $cx, 'href');
$pnm = $mysql_result($prod, $cx, 'name');
echo "<li><a href=\"$phref\">$pnm</a></li>";
}?>
Thank you.
Last edited by schwarzerosen on Fri Jun 26, 2009 11:18 pm, edited 1 time in total.
Eric!
DevNet Resident
Posts: 1146
Joined: Sun Jun 14, 2009 3:13 pm

Re: Error on loop

Post by Eric! »

schwarzerosen wrote:Hello.

I am in a bit of a hurry on this site, and I seem to have run into a little snag.

Code: Select all

 $phref = $mysql_result($prod, $cx, 'href');
$pnm = $mysql_result($prod, $cx, 'name'); 
Can you see it? hint=$$$$
Last edited by Eric! on Fri Jun 26, 2009 11:17 pm, edited 1 time in total.
schwarzerosen
Forum Newbie
Posts: 3
Joined: Fri Jun 26, 2009 10:45 pm

Re: Error on loop

Post by schwarzerosen »

It is amazing how I do not notice things until others point them out. Thank you for your help, and your quick reply
Post Reply