T4VN is an online PHP Help community that provides PHP Tutorials, PHP Examples, PHP Scripts, PHP Support
    HOME  |  HOSTING COUPON  |  TEMPLATE  |  PHP SCRIPTS  |  LINK TO US  |  LINK  |  REGISTER | CONTACT
::: Member Login :::
 Username
 Password
 
Forgot your password ?
::: PHP Tutotal :::
  PHP Basic (7)
  PHP Advanced (4)
  PHP Database (2)
  Coding Step By Step (8)
  PHP and AJAX (0)
::: PHP Example :::
  Arrays (1)
  Code Highlighters (3)
  Database Functions (12)
  Date & Time (5)
  E-Mail (6)
  Forms (5)
  Guestbooks (1)
  Logging (2)
  Miscellaneous (10)
  Password Generators (3)
  Randomizers (3)
  String Manipulation (10)
  User Authentication (6)
::: Search On T4VN :::
::: T4VN Statistics :::
  PHP Scripts : 64
  PHP Example : 67
  PHP Tutorials : 21
  PHP News : 93
  Total Coupon : 36
  Other Tutorials :
  Member : 215
  Visitor Online : 3
  Today Visit: 266
  Total Visitor : 301288
  Most Online : 41
::: Sponsored Links :::

PR 4 For This Webpage

Vinaora Logo
Home Today :

Count Rows From 2 Tables

Author : jbullard

This code will allow you to select a field from one table and get how many rows are affected by the query in the second table.

PHP Example :

<?
$goSQL1 
"SELECT your_field1 FROM your_table";
$res1 = @mysql_query($goSQL1,$conn) or die(mysql_error());
while (
$row mysql_fetch_array($res1)) {
$your_field1 $row['your_field1'];
$goSQL2 "SELECT your_field2 FROM your_table2 WHERE your_field2 = your_field1";
$res2 = @mysql_query($goSQL2,$conn) or die(mysql_error());
$count1 mysql_num_rows($res2);
echo 
"".$your_field1." (".$count1.")";
}
?>


Other Example
mysql syntax error reporting
Count Rows From 2 Tables
Anti SQL Injection Login Filter


::: Resources :::
  Links Directory
  Programming 2 3
  Webmaster 2 3
  Web Design 2 3
  Web Hosting 2 3
  Other Links 2 3
  Asian ShowBiz News
  Teach Seo For You
::: New Templates :::




::: Other Tutorials :::
 Program Design

  Powered By T4VN.NET - Version 2.0 - CopyRight © T4VN.NET 2005-2007