j'ai une requête qui fonctionne (elle m'affiche bien les résultats souhaitées) mais si je la print_r elle me retourne RESSOURCE id#
Je ne trouve pas grand chose à ce sujet... voici la requête et la structure :
Code : Tout sélectionner
--
-- Structure de la table 'annonces_regions'
--
CREATE TABLE annonces_regions (
msgid int(11) NOT NULL,
idregion int(11) NOT NULL,
main int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table 'annonces_secteurs'
--
CREATE TABLE annonces_secteurs (
msgid int(11) NOT NULL,
idsecteur int(11) NOT NULL,
main int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table 'annonces_xml'
--
CREATE TABLE annonces_xml (
id int(11) NOT NULL auto_increment,
site varchar(250) NOT NULL,
ref varchar(255) NOT NULL,
`date` date NOT NULL,
email varchar(255) NOT NULL,
poste varchar(255) NOT NULL,
contrat varchar(100) NOT NULL,
description text NOT NULL,
secteur int(11) NOT NULL,
entreprise varchar(255) NOT NULL,
region int(11) NOT NULL,
visuel varchar(250) NOT NULL,
annonce_pj varchar(255) NOT NULL,
statut int(11) NOT NULL default '0',
KEY id (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table 'metier'
--
CREATE TABLE metier (
id int(11) NOT NULL auto_increment,
nom varchar(255) character set utf8 NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Structure de la table 'region'
--
CREATE TABLE region (
id int(11) NOT NULL auto_increment,
nom varchar(100) character set utf8 NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Structure de la table 'secteur'
--
CREATE TABLE secteur (
id int(11) NOT NULL auto_increment,
nom varchar(100) NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;Code : Tout sélectionner
SELECT COUNT(*) AS total
FROM annonces_xml
LEFT JOIN annonces_secteurs s ON annonces_xml.id = s.msgid
LEFT JOIN secteur se ON se.id = s.idsecteur
LEFT JOIN metier m ON m.id = s.idsecteur
LEFT JOIN annonces_regions r ON annonces_xml.id = r.msgid
LEFT JOIN region re ON re.id = r.idregion
LEFT JOIN region_m rm ON rm.id = r.idregion
WHERE (poste LIKE '%".$poste."%'
OR annonces_xml.description LIKE '%".$poste."%')
AND statut = 0
" . $secteur_sql . "
" . $region_sql . "
GROUP BY annonces_xml.id