vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   mysql woes (https://vborg.vbsupport.ru/showthread.php?t=67018)

AN-net 07-09-2004 11:53 PM

mysql woes
 
ok im getting an mysql syntax error as usual when ever i build a search engine:(

heres the error
Quote:

Originally Posted by mysql
Invalid SQL: 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 journal_entries LEFT JOIN journals ON (journal_entries.journal_id=journals.journal_id) WHERE journal_entries.entry_active=1,journal_entries.pri vate!=1,journal_entries.entrytext LIKE '%test%'
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'journal_entries.private!=1,journal_entries.entryt ext LIKE '%tes

my code is:
PHP Code:

        if($_REQUEST['do']=="searchresults")
        {
            
$getentries$DB_site->query("SELECT journal_entries.entrytext,journal_entries.entrytitle,
            journal_entries.entrydate,journal_entries.entry_totalrating AS totalrating,journal_entries.entry_totalvotes AS totalvotes,
            journal_entries.entry_id,journal_entries.journal_id,journals.journalist,journals.journalist_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.private!='1',journal_entries.entrytext LIKE '%"
.$sk."%'
            "
);
            while(
$entry$DB_site->fetch_array($getentries))
            {
                eval(
'$resultbits .= "' fetch_template('journal_searchresults') . '";');
            }
            eval(
'print_output("' fetch_template('journal_search') . '");');
        } 

thanks in advance:)

Xenon 07-10-2004 12:12 AM

Code:

journal_entries.entry_active='1',journal_entries.private!='1',journal_entries.en  trytext LIKE '%".$sk."%'
should be
Code:

journal_entries.entry_active='1' AND journal_entries.private!='1' AND journal_entries.en  trytext LIKE '%".$sk."%'

AN-net 07-10-2004 02:58 AM

thanks that worked xenon


All times are GMT. The time now is 03:17 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01088 seconds
  • Memory Usage 1,723KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete