Newbie

From: Date: Thu, 13 Oct 2005 20:25:24 +0000
Subject: Newbie
Groups: php.windows 
Request: Send a blank email to php-windows+get-26407@lists.php.net to get a copy of this message
Greetings All I am very new to PHP and have so far been using Dreamweaver MX to generate the PHP code for me, please do not stone me :) My current problem is this. Above the DOCTYPE of my document I have the following lines to connect to the database and retrieve the results: <?php require_once('../../Connections/jpa.php'); ?> <?php $colname_side_content = "-1"; if (isset($_GET['side_content'])) { $colname_side_content = (get_magic_quotes_gpc()) ? $_GET['side_content'] : addslashes($_GET['side_content']); } mysql_select_db($database_jpa, $jpa); $query_side_content = sprintf("SELECT content_type, page_heading, content FROM ab_side_content WHERE content_type = '%s'", $colname_side_content); $side_content = mysql_query($query_side_content, $jpa) or die(mysql_error()); $row_side_content = mysql_fetch_assoc($side_content); $totalRows_side_content = mysql_num_rows($side_content); mysql_select_db($database_jpa, $jpa); $query_general_clients = "SELECT id, client_name, category FROM ab_client_list WHERE category = 'general' ORDER BY client_name ASC"; $general_clients = mysql_query($query_general_clients, $jpa) or die(mysql_error()); $row_general_clients = mysql_fetch_assoc($general_clients); $totalRows_general_clients = mysql_num_rows($general_clients); mysql_select_db($database_jpa, $jpa); $query_specialist_clients = "SELECT id, client_name, category FROM ab_client_list WHERE category = 'Public Policy' ORDER BY client_name ASC"; $specialist_clients = mysql_query($query_specialist_clients, $jpa) or die(mysql_error()); $row_specialist_clients = mysql_fetch_assoc($specialist_clients); $totalRows_specialist_clients = mysql_num_rows($specialist_clients); mysql_free_result($side_content); mysql_free_result($general_clients); mysql_free_result($specialist_clients); ?> Then in my document body I have the following: <div id="content-left-frame1">
       <?php do { ?>
       <?php echo $row_general_clients['client_name']; ?>
       <?php } while ($row_general_clients = mysql_fetch_assoc($general_clients)); ?>
       </div>
             <div id="content-left-frame2">
       <h3>Public Policy &amp; Research</h3>
       <?php do { ?>
       <?php echo $row_specialist_clients['client_name']; ?>
       <?php } while ($row_specialist_clients = mysql_fetch_assoc($specialist_clients)); ?>
       </div>
Now, when I remove the code that is supposed to create a repeat region everything is fine and the first result of each are printed out however, when including the lines as above I get the following errors generated: <div id="content-left-frame1">
		        42nd Street Development Corporation        <br />
<b>Warning</b>: mysql_fetch_assoc(): 5 is not a valid MySQL result resource in <b>C:\Program Files\Apache Group\Apache2\htdocs\japarker\about_us\client_list\index.php</b> on line <b>52</b><br /> </div>
	    <div id="content-left-frame2">
<h3>Public Policy &amp; Research</h3> American Public Transportation Association <br /> <b>Warning</b>: mysql_fetch_assoc(): 6 is not a valid MySQL result resource in <b>C:\Program Files\Apache Group\Apache2\htdocs\japarker\about_us\client_list\index.php</b> on line <b>59</b><br /> </div> Also on the a side bar, does not get affected by the code mentioned above, it generates: <a href="..//japarker<br /> <b>Notice</b>: Undefined variable: row_content in <b>C:\Program Files\Apache Group\Apache2\htdocs\japarker\about_us\client_list\index.php</b> on line <b>65</b><br /> " title="<br /> <b>Notice</b>: Undefined variable: row_content in <b>C:\Program Files\Apache Group\Apache2\htdocs\japarker\about_us\client_list\index.php</b> on line <b>65</b><br /> "> My apologies for all of the code I just wanted to be as clear as possible. I am not so much worried about the sidebar problem, my main issue is the main content. Can anyone see where this is going wrong? I would appreciate any help, thank you in advance. -- Kind Regards Schalk Neethling Web Developer.Designer.Programmer.President Volume4.Business.Solution.Developers

« previous php.windows (#26407) next »