Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

problem with value
The problem is like this, There are a number of $rows resulting from the
query described below. There is a variable named payment, this has for
example the vualue 2. lets say the query had 5 results, the i want to do a
compare that it shows only 2, depending on the value of $payment

Can someone help me?

$query = "SELECT a.oproep,b.oproep, a.react, b.react, a.logid, b.logid,
a.persid,b.persid, a.logemail, b.logemail,a.persemail,b.persemail

FROM reactie a, reactie b
WHERE a.logid = b.persid AND b.logid = a.persid AND a.logid='$logid' ";


$result = mysql_query($query);

$query_data = mysql_fetch_row($result);//     Haal de gegevens uit de tabel
if($result = mysql_query($query)){
$rows = mysql_num_rows($result);

if($rows<1){
echo "<p>You have no Matches";

} else {


echo "<p>You have $rows Match(es)<p><p>";
}}
while($query_data = mysql_fetch_array($result)){


$oproep   = $query_data["oproep"];
$persid    = $query_data["logid"];
$reactie   = $query_data["react"];
$logemail   = $query_data["logemail"];

echo "  <tr>\n";
echo "             <td align=center bgcolor=FFECC4 ><font
color=black><a
href=\"java script:Pop550Picture('../pic/klanten/gegevens.php?id=$persid')\">
<p>$oproep</a></td>\n";//

echo "             <td align=center bgcolor=FFECC4 ><font
color=black><p>".$reactie."</td>\n";
echo "             <td align=center bgcolor=FFECC4 ><font
color=black><p>".$reactie."</td>\n";
echo "             <td align=center bgcolor=FFECC4 ><font
color=black><p><a href=\"mailto:".$logemail."\">".$logemail."</a></td>\n";


echo "  </tr>\n";//

}



Report this thread to moderator Post Follow-up to this message
Old Post
Irlan agous
03-28-05 08:57 PM


Re: problem with value
Irlan agous wrote:
> The problem is like this, There are a number of $rows resulting from the
> query described below. There is a variable named payment, this has for
> example the vualue 2. lets say the query had 5 results, the i want to do a
> compare that it shows only 2, depending on the value of $payment

not sure I follwo what you mean,

If you want results where the column a.payment is 2, then add that to your q
uery

> $query = "SELECT a.oproep,b.oproep, a.react, b.react, a.logid, b.logid,
> a.persid,b.persid, a.logemail, b.logemail,a.persemail,b.persemail
>
> FROM reactie a, reactie b
>  WHERE a.logid = b.persid AND b.logid = a.persid AND a.logid='$logid' AND a.paymen
t=2";

If you just want the two first results from the database, then use

> $query = "SELECT a.oproep,b.oproep, a.react, b.react, a.logid, b.logid,
> a.persid,b.persid, a.logemail, b.logemail,a.persemail,b.persemail
>
> FROM reactie a, reactie b
>  WHERE a.logid = b.persid AND b.logid = a.persid AND a.logid='$logid' LIMIT 2";[/c
olor]

If you want only those results where a.payment is 2 and only show the two
frist, then use

> $query = "SELECT a.oproep,b.oproep, a.react, b.react, a.logid, b.logid,
> a.persid,b.persid, a.logemail, b.logemail,a.persemail,b.persemail
>
> FROM reactie a, reactie b
>  WHERE a.logid = b.persid AND b.logid = a.persid AND a.logid='$logid' AND
a.payment=2 LIMIT 2";


If you want something else, then please try to describe your problem differe
ntly.


//Aho

Report this thread to moderator Post Follow-up to this message
Old Post
J.O. Aho
03-28-05 08:57 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP SQL archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:53 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.