PDA

View Full Version : is this query right?


AN-net
07-04-2004, 07:03 PM
i was wondering if this query was right:)


$getentries= $DB_site->query("SELECT journal_entries.entrytext,journal_entries.entrytit le,journal_entries.entrydate,journal_entries.entry _totalrating AS totalrating,journal_entries.entry_totalvotes AS totalvotes,journal_entries.entry_id,journal_entrie s.journal_id,journals.journalist,journals.journali st_id,journals.journalname FROM ".TABLE_PREFIX."journal_entries LEFT JOIN ".TABLE_PREFIX."journals ON (journal_entries.journal_id=journals.journal_id) WHERE journal_entries.entry_active=1,journal_entries.pri vate!=1,journal_entries.entrytext LIKE '%".$searchterm."%',journal_entries.entrytitle LIKE '%".$searchterm."%'");

Modin
07-04-2004, 10:17 PM
Looks ok to me, though I don't believe you need to explicitly specify the join in mysql...though specifying it doesn't do any harm

ie. you could do something similar to...

SELECT * FROM journal_entries, journal WHERE journal_entries.journal_id = journal.journal_id etc....


Your query looks fine, mine is just easier to write ;)