PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingPHP Development

Closed Thread
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 1st, 2011, 09:01 PM
mlmpros mlmpros is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Location: East Texas
Posts: 39 mlmpros User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 59 m 14 sec
Reputation Power: 14
General - Displaying results from multiple field query

Here's the scenario. I have numerous affiliate programs I promote through affiliate networks such as Commission Junction, Cleverbridge and LinkShare. Some of those affiliate programs list with more than one affiliate network.



I list the individual program in my database as "progname" and the associated affiliate network(s) as "netname1", "netname2" and "netname3" with corresponding referral urls for the associated affiliate program as "netnameurl1", "netnameurl2" and "netnameurl3."



My desired output is a list of affiliate programs and their matching referral url where the affiliate network name matches the search criteria.



For example, let's say affiliate program "freelancer.com" is listed with both Commission Junction and LinkShare and my search term is Commission Junction. For that particular program, LinkShare is entered as "netname1" and Commission Junction is entered as "netname2" (network listing order may vary for other programs). My desired output would be:



freelancer.com http://www.cj.com/?id=jwg



If my search term was LinkShare, the desired output would be:



freelancer.com http://www.ls.com/?id=gra



Here's what I have so far, but it won't list the url.



Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" >

<head>

<meta name="robots" content="noindex, nofollow"/>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<link rel="stylesheet" type="text/css" href="http://www.jwgmg.com/styles/style2.css"/>

<title>Search Results for Affiliate Program Database</title>

<base target="_blank" />

</head> 

<body>

<div style="width: 100%; padding: 1em; text-align: center; margin: auto">

<p class="center bold lg em">Program by Network Search Results</p>

<?

include("dbinfo.inc.php");

 

$search="".$search."";

 

$query = "SELECT * FROM programs WHERE netname1 LIKE '$search' OR netname2 LIKE '$search' OR netname3 LIKE '$search' ORDER BY progname ASC";

$result=mysql_query($query)or die(mysql_error());

 

$num=mysql_num_rows($result);

$i=0;

 

 

?>

<h1><?echo $search;?></h1>

<table style="border: 1px solid black; text-align: center; margin: auto">

<thead style="background-color: #369; color: white">

<tr>

<th>Program Name</th>

<th>Referral URL</th>

</tr>

</thead> 

 

<?

while($i< $num){

$progname=mysql_result($result,$i,"progname");

if($netname1=="$search"){$neturl=mysql_result($result,$i,"netnameurl1");}

elseif($netname2=="$search"){$neturl=mysql_result($result,$i,"netnameurl2");}

elseif($netname3=="$search"){$neturl=mysql_result($result,$i,"netnameurl3");}

?>

 

<tbody class="left">

<tr>

<td><?echo $progname;?></td>

<td><?echo $neturl;?></td>

</tr>

 

<?

++$i;

}

?>

</tbody> 

</table>

<table style="margin-left: 12em; border: 2px solid red">

<tr><td style="background-color: #369; color: white"><?echo $num;?></td></tr>

</table>

</div> 

</body>

</html>

 

Reply With Quote
Closed Thread

Viewing: Dev Articles Community ForumsProgrammingPHP Development > General - Displaying results from multiple field query


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap