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

Matching problem
Hello all, i have this matching story. What i want to do, is to check the
variable $betaling if this is 0 or 1. But the id from the tabel form have to
be compared with $persid from the table reactie. thats not the problem, the
problem is i am not able to make 2 queries in one while statement, does
anyone knows how to solve this?

Irlan


$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);//

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"];


$sql= "SELECT betaling from form where id='$persid'";
$res = mysql_query($sql);
$query_data = mysql_fetch_row($res);
while($query_data = mysql_fetch_array($result)){
$betaling= $query_data["betaling"]

}
if ($betaling="0"){
echo "your contact did not pay for this service yet, he will be notified,
you dont have to pay for this service";
} else {

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 01:56 PM


Re: Matching problem
Irlan agous wrote:
>
> What i want to do, is to check the variable $betaling if this
> is 0 or 1. But the id from the tabel form have to be compared
> with $persid from the table reactie. thats not the problem,
> the problem is i am not able to make 2 queries in one while
> statement

You don't have to.  Everything you are trying to do can be
done in one query, something like this:

$query = <<<EOQ

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,
c.betaling
FROM
(reactie AS a LEFT JOIN reactie AS b ON a.logid = b.persid)
LEFT JOIN form AS c ON a.logid = c.id
WHERE
a.logid='$logid' AND b.logid = a.persid

EOQ;

Obviously, this query may not be exactly what you need because
you didn't explain what you wanted, but the general idea is
to join `form` to the two instances of `reactie` instead of
making the second query...

Cheers,
NC


Report this thread to moderator Post Follow-up to this message
Old Post
NC
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:52 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.