CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Parsing values in a field into links in a grid

Print topic Send  topic

Author Message
mcouvillon

Posts: 1
Posted: 05/08/2008, 3:55 PM

I am having some problems with adding custom code to codecharge's grid. I have a database with 4 tables, two of which I am using in the grid. The two tables are websites and niches. The websites table has a field named associated_niches_lnk which contains semicolon delimited numeric values which relate to the id (primary key) of the field on the websites table. This is used to show what niches (content) each website contains. Some of the websites only contain a single niche and others many. I am trying to make a link with the niche_name as the linking text and the id of the niche as a parameter at the end of the link to a page named niche_detail.php. This is what I have come up with as cusom code:

$niches_websites1_associated_niches_lnk = explode(";", $niches_websites1_associated_niches_lnk);  
	foreach($niches_websites1_associated_niches_lnk as $nid) {  
	mysql_query(SELECT * FROM niches WHERE niches.id = "$nid");  
	echo "<a href=\"./niche_detail.php?id=$nid\">$niche_name</a>";  
	}

The error I receive is
"Parse error: syntax error, unexpected T_STRING in C:\sokkit4\site\reviews\index_events.php on line 43"

Line 43 is the mysql_query line. Does anyone see what is wrong with the code? Am I supposed to re-connect to mysql? I think the connection is still open. My php is not great but I have used this code before and had success. I guess where I am most confused is with the naming used by codecharge for the functions, columns, and fields in the code. It is very confusing.

Any help anyone can give is appreciated.

Thank you,
Mike Couvillon
View profile  Send private message
wkempees


Posts: 1679
Posted: 05/08/2008, 5:58 PM

  
$niches_websites1_associated_niches_lnk = explode(";", $niches_websites1_associated_niches_lnk);    
foreach($niches_websites1_associated_niches_lnk as $nid) {    
    mysql_query("SELECT * FROM niches WHERE niches.id = " . $nid );    
    echo "<a href=\"./niche_detail.php?id=$nid\">$niche_name</a>";    
}  

Just responding to the posted code.

Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.