| 
	
 | 
 Posted by Jerry Stuckle on 06/13/25 11:40 
coder wrote: 
> I am new to programming in PHP however, this should be a pretty 
> straight forward answer. I have three queries that I am pulling for a 
> content form page. 
>  
> 1) The Author List 
> 2) The Content Page (pulls the PK, Title and the Description of the 
> content. 
> 3) The Category List 
>  
> When I attempt to pull the data the only result set I get back is from 
> the Item #1 query above. Now, I made sure that there is data in the 
> tables, but I still get no data back for the other two queries(????) 
>  
> Is there something that I missing when connecting to PHP/MYSQL? Do I 
> need to take some additional steps?? 
>  
> Any help would be greatly appreciated. I've been struggling with this 
> problem for several hours now scratching my head why this is. 
>  
> :-) 
>  
> // here is the PHP Code I am using 
>  
> <?php 
> 	$db = mysql_connect("$DB_SERVER", "$DB_SERVER_USERNAME", 
> "$DB_SERVER_PASSWORD"); 
> 	mysql_select_db("$DB_DATABASE",$db); 
> 	//result set 1 - get members 
> 	$result_M=mysql_query("SELECT * FROM tblMembers",$db); 
> 	$myrow_M=mysql_fetch_assoc($result_M); 
> 	//result set 2 - get content ID 
> 	$result_C=mysql_query("SELECT * FROM tblContent WHERE 
> contentID=1",$db); 
> 	$myrow_C=mysql_query($result_C); 
> 	//result set 3 - get categories 
> 	$result_Cat=mysql_query("SELECT * FROM tblCat",$db); 
> 	$myrow_Cat=mysql_query($result_Cat); 
>  
>  
> 	//result set 1 - output 
> 	$memID =$myrow_M['memberID']; 
> 	$fname =$myrow_M['fname']; 
> 	$lname =$myrow_M['lname']; 
> 	//result set 2 - output 
> 	$contentID =$myrow_C['contentID']; 
> 	$Title =$myrow_C['Title']; 
> 	$e1m1 =$myrow_C['Descr']; 
> 	//result set 3 - output 
> 	$CatID = $myrow_Cat['CatID']; 
> 	$CatName = $myrow_Cat['CatName']; 
>  
>  
> 	echo ($memID); 
> 	echo ($fname); 
> 	echo ($lname); 
> 	echo ($contentID); 
> 	echo ($Title); 
> 	echo ($e1m1); 
> 	echo ($CatID); 
> 	echo ($CatName); 
> 	 
> 	return false; 
> 	 
> ?> 
>  
 
Check the results from your queries.  If FALSE is returned, you have an  
error.  Call mysql_errno() and mysql_error() to find out what it is, i.e. 
 
$result_C=mysql_query("SELECT * FROM tblContent WHERE contentID=1",$db); 
if ($result_C) ( 
   $myrow_C=mysql_query($result_C); 
} 
else { 
   echo {"MySQL Error detected: " . mysql_error() . "<br>\n"); 
} 
 
ALWAYS check the results of ANY call to MySQL! 
 
 
--  
================== 
Remove the "x" from my email address 
Jerry Stuckle 
JDS Computer Training Corp. 
jstucklex@attglobal.net 
==================
 
  
Navigation:
[Reply to this message] 
 |