By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,521 Members | 1,447 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,521 IT Pros & Developers. It's quick & easy.

showing results of query with right join

P: 2
Hallo,
I am beginner,
I want to show on page results of this query: $query="SELECT mr_prehlad.mr_id, mr_kontakt.nazov_mr FROM mr_prehlad RIGHT JOIN mr_kontakt ON mr_kontakt.id_mr=mr_prehlad.mr_id WHERE mr_prehlad.'$co'='1' ORDER BY mr_prehlad.mr_id ";

But this while ( $row = MySQL_Fetch_Field( $result ) ) {
echo "<tr>\n";
foreach( $row as $hodnota ) {
echo "<td>\n";
echo $hodnota;
echo "</td>\n";
}
echo "</tr>\n";
}

is not function.

How to show with php in html pages query with left or right join?

Thanks for answer.
Feb 19 '07 #1
Share this Question
Share on Google+
4 Replies


tolkienarda
100+
P: 316
Hallo,
I am beginner,
I want to show on page results of this query: $query="SELECT mr_prehlad.mr_id, mr_kontakt.nazov_mr FROM mr_prehlad RIGHT JOIN mr_kontakt ON mr_kontakt.id_mr=mr_prehlad.mr_id WHERE mr_prehlad.'$co'='1' ORDER BY mr_prehlad.mr_id ";

But this while ( $row = MySQL_Fetch_Field( $result ) ) {
echo "<tr>\n";
foreach( $row as $hodnota ) {
echo "<td>\n";
echo $hodnota;
echo "</td>\n";
}
echo "</tr>\n";
}

is not function.

How to show with php in html pages query with left or right join?

Thanks for answer.

ok first off you never define $result
second i am not sure if the \n shoud be inside your " i think they should be outside or just to be safe replace them with a <br /> tag.

eric
Feb 19 '07 #2

P: 2
ok first off you never define $result
second i am not sure if the \n shoud be inside your " i think they should be outside or just to be safe replace them with a <br /> tag.

eric
Of course I have implemented
$result=mysql_query($query);
but I get this answer from mySQL
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in
Warning: mysql_fetch_field(): supplied argument is not a valid MySQL result resource in

So it is nothing with <br /> tag.
Feb 20 '07 #3

tolkienarda
100+
P: 316
if you could post your entire script it would help me follow it and if it wouldn't be a security problem a link to the page where this is active always helps

eric
Feb 20 '07 #4

ronverdonk
Expert 2.5K+
P: 4,258
Take the single quotes out of the statement's WHERE clause
Expand|Select|Wrap|Line Numbers
  1. mr_prehlad.'$co'
Ronald :cool:
Feb 20 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.