Here is the full error message:
Fatal error: Call to undefined function: array() in /www/www.sailinganarchy.com/htdocs/classified/ad_display.php on line 40

Which is the line: while ($row = mysql_fetch_array($result, MYSQL_NUM)) from the code below. According to all the books I have it would work. I have one record in the table and the connectin seems to work so any thoughts would be great.

ad_display.php

<?
	/*
	$Ad = Null;
	$msg = Null;
	$id = 0;
	$user = Null;
	$password = Null;
	$ad_type = Null;
	$item_type = Null;
	$year = Null;
	$make = Null;
	$length = Null;
	$price = Null;
	$contact_name = Null;
	$contact_email = Null;
	$contact_phone = Null;
	$location = Null;
	$description = Null;
	*/

$db = "foo";
$tablename = "tblSA_ClassifiedAd";

$connection = mysql_connect("foo_server", "foo", "foo1")or die("Could not connect");

$dbs = @mysql_select_db ($db,$connection);

$sql = "Select * From tblSA_ClassifiedAd Order By id";


$result = @mysql_query($sql, $connection)or die("Could not Excute Query");
mysql_close();
if ($result)
	{
		$Ad .= "<table width=\"500\" align=\"center\" cellpadding=\"5\" cellspacing=\"5\">";
		//$msg = $result;

		while ($row = mysql_fetch_array($result, MYSQL_NUM))
		{
			$id = $row('0');
			$user = $row('1');
			$password = $row('2');
			$ad_type = $row('3');
			$item_type = $row('4');
			$year = $row('5');
			$make = $row('6');
			$length = $row('7');
			$price = $row('8');
			$contact_name = $row('9');
			$contact_email = $row('10');
			$contact_phone = $row('11');
			$location = $row('12');
			$description = $row('13');

			$Ad .= "					
				  <tr>
					<td>&nbsp;$id</td>
					<td>&nbsp$user;</td>
					<td>&nbsp$password;</td>
					<td>&nbsp$item_type;</td>
					<td>&nbsp$ad_type;</td>
					<td>&nbsp;$year</td>
					<td>&nbsp;$make</td>
				  </tr>
				  <tr>
					<td>&nbsp;$length</td>
					<td>&nbsp;$price</td>
					<td>&nbsp;$contact_name</td>
					<td>&nbsp;$contact_email</td>
					<td>&nbsp;$contact_phone</td>
					<td>&nbsp;$location</td>
					<td>&nbsp;$description</td>
				  </tr>";
			$Ad .= "</table>";				
		}
		mysql_free_result ($result);
	}
else
	{
		$msg .= "No Data to display.";
	}

?>
<html>
<head>
<title>Ad Display</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p></p>
<p></p>
<p></p>
<? echo "$msg"; ?>
<? echo "$Ad"; ?>
</body>
</html>

    Add

    # DEBUG START
    print_r($result);
    exit;
    #DEBUG END
    

    just before the "while" clause, and see if it's not an array??

      I get "Resource id #2" as a result, whatever that means.

      I thought the output of the query was an array that was put into the $result variable. According to everything I read that is how the mysql_query() worked

        Nah, resource ID is correct.

        Think I see the problem, though. row("0") should be row["0"] ... try square brackets instead of parentheses . . . 🙂

        Good luck ...

        BTW, welcome to the boards.

        If you've not noticed, it's a Good Thing(TM) to enclose your code in

         tags ...

          Yep, I can't believe I missed that. I looked in the books and it should have been [] instead of().

          If you mean <?PHP Code Here ?> rather than <? Code Here ?> you are right. I just saw that you could do it either way. But the proper way is <?PHP ?>.

          I am currently working on making our site Sailing Anarchy have a little bit of dynamic-ness. We have become the most trafficed sailing site in the world according to Alexa and it has taken us 4 years to do it. What I am doing is adding functionality for users to post their classified ads automaticly after they pay at paypal. Then of course I have to create the search/display (doing that now) and a user edit page for their ad. I need to add a way for them to upload a photo of their boat too (found some examples).

          I am sure I will have more questions to ask as I work this through. By the way I do VB6.0/MSSQL at work 3 years now. SO it is quite a change to go from the MS hand holding interface of VB to programming like this.

          Thanks
          Dave T

            No, I'm talking about "on the forum, when you quote PHP code, use the vB tag

            " (can be either case).  This provides syntax highlighting, which when combined with well formatted code to begin with, makes it easier to debug.  AAMOF, in this case it would probably have helped, because the syntax highlighter would have treated the parenthesis differently than the square bracket, methinks...
            
            As for the PHP long tag vs the short tag, we argued about that, in the classic PHPBuilder Echo Lounge style, for quite a while back in the day, but I can't find that thread now via the search function nor Google to save my neck, besides, do you really want to read the goofiness of the "regs" here?  
            
            In the end most of us "short taggers" had to acquiese, what with the arrival of XML and all ... so <?php it is .... :D

              Yes, I see. that is very nice. I went back and edited it and it sure makes a difference.

              Anyway I got it working pretty good. display classified Ad

              Thanks a ton

              Dave T

                Write a Reply...