Combiner 2 tables BDD en 1 seule
caraibeslt
Messages postés
3
Date d'inscription
Statut
Membre
Dernière intervention
-
caraibeslt Messages postés 3 Date d'inscription Statut Membre Dernière intervention -
caraibeslt Messages postés 3 Date d'inscription Statut Membre Dernière intervention -
Bonjour, comment faire pour couplet 2 tables d'une même BDD pour faire un total 'num' unique sur :
<?=$num_general_7?>
Explication :
- table 1 = public_ven
- table 2 = public_loc
- statut = '1' (actif) ou '0' (inactif)
- location = 7 (ville n°7)
<?php
$queryV=tep_db_query("select count(id) as num from public_ven where status='1' and location='7'");
$queryL=tep_db_query("select count(id) as num from public_loc where status='1' and location='7'");
$data=tep_db_fetch_array($queryV);
$data=tep_db_fetch_array($queryL);
$num_general_7=$data['num'];
?>
Merci de m'aider car je bloque
<?=$num_general_7?>
Explication :
- table 1 = public_ven
- table 2 = public_loc
- statut = '1' (actif) ou '0' (inactif)
- location = 7 (ville n°7)
<?php
$queryV=tep_db_query("select count(id) as num from public_ven where status='1' and location='7'");
$queryL=tep_db_query("select count(id) as num from public_loc where status='1' and location='7'");
$data=tep_db_fetch_array($queryV);
$data=tep_db_fetch_array($queryL);
$num_general_7=$data['num'];
?>
Merci de m'aider car je bloque
A voir également:
- Combiner 2 tables BDD en 1 seule
- Supercopier 2 - Télécharger - Gestion de fichiers
- Comment imprimer un tableau excel sur une seule page - Guide
- Tables des matières word - Guide
- Word numéro de page 1/2 - Guide
- 2 ecran pc - Guide
1 réponse
Je crois que je me suis mal expliqué.
J'ai 2 tables indépendantes dans une BDD :
Sur mon site :
<?php
$query=tep_db_query("select count(id) as num from public_ven where status='1' and location='7'");
$data=tep_db_fetch_array($query);
$num_general_V=$data['num'];
$query=tep_db_query("select count(id) as num from public_loc where status='1' and location='7'");
$data=tep_db_fetch_array($query);
$num_general_L=$data['num'];
?>
Aujourd'hui ca donne ceci :
Ville : (<?=$num_general_V?>) et (<?=$num_general_L?>)
donc
Ville : (15) et (20)
Comment faire une requete des 2 pour que cela marque un total : Ville : (35)
J'ai essayé ceci mais ca marche pas
<?php
$queryV=tep_db_query("select count(id) as num from public_ven where status='1' and location='7'");
$queryL=tep_db_query("select count(id) as num from public_loc where status='1' and location='7'");
$data=tep_db_fetch_array($queryV);
$data=tep_db_fetch_array($queryL);
$num_general_7=$data['num'];
?>
Merci pour votre aide
J'ai 2 tables indépendantes dans une BDD :
Sur mon site :
<?php
$query=tep_db_query("select count(id) as num from public_ven where status='1' and location='7'");
$data=tep_db_fetch_array($query);
$num_general_V=$data['num'];
$query=tep_db_query("select count(id) as num from public_loc where status='1' and location='7'");
$data=tep_db_fetch_array($query);
$num_general_L=$data['num'];
?>
Aujourd'hui ca donne ceci :
Ville : (<?=$num_general_V?>) et (<?=$num_general_L?>)
donc
Ville : (15) et (20)
Comment faire une requete des 2 pour que cela marque un total : Ville : (35)
J'ai essayé ceci mais ca marche pas
<?php
$queryV=tep_db_query("select count(id) as num from public_ven where status='1' and location='7'");
$queryL=tep_db_query("select count(id) as num from public_loc where status='1' and location='7'");
$data=tep_db_fetch_array($queryV);
$data=tep_db_fetch_array($queryL);
$num_general_7=$data['num'];
?>
Merci pour votre aide