vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   Using the vBulletin Database Class (https://vborg.vbsupport.ru/showthread.php?t=119350)

cellarius 09-14-2013 08:05 AM

Deleting is writing. Just use the accoring mysql statement (DELETE). Had you read or searched the thread, you would have found an example just five posts above yours...

aminp30 09-10-2015 10:25 AM

thanks for excellent article.

I used $db->query_read .it worked but I received question sign "?" instead of words.
I use non-English language .
what should I do?

cellarius 09-10-2015 10:32 AM

What's the exact code you're using?

aminp30 09-10-2015 10:39 AM

Quote:

Originally Posted by cellarius (Post 2554729)
What's the exact code you're using?


I use two table so my code is something like this:

PHP Code:

$result $db->query_read("SELECT * FROM " TABLE_PREFIX "questions");
$i=0;
    while ( 
$db_field mysql_fetch_assoc($result) ) {
        
$i=$i+1;
        
$ID=$db_field['ID'];
        
$resulta $db->query_read("SELECT * FROM " TABLE_PREFIX "answers WHERE question_ID = $ID ");
        
//mysql_set_charset('utf8');
        
$j=0;
        while ( 
$db_fielda mysql_fetch_assoc($resulta) ) {
            
$j=$j+1;
            
$answer[$j] = $db_fielda['answer'];
        }

        echo 
'<tr '. (($i 2) == 'class="alt"' '').'><td>'.$i.'</td><td>'.$vbulletin->userinfo['username'].'</td><td>'.$db_field['text'].'</td><td>
            <input type="radio" name="q'
.$i.'" value="'.$answer[1].'"'.($answer[1] == $db_field['answer']? ' checked ' '').'disabled> '$answer[1].'  |  
            <input type="radio" name="q'
.$i.'" value="'.$answer[2].'"'.($answer[2] == $db_field['answer']? ' checked ' '').'disabled> '$answer[2].'  |  
            <input type="radio" name="q'
.$i.'" value="'.$answer[3].'"'.($answer[3] == $db_field['answer']? ' checked ' '').'disabled> '$answer[3].'  |  
            <input type="radio" name="q'
.$i.'" value="'.$answer[4].'"'.($answer[4] == $db_field['answer']? ' checked ' '').'disabled> '$answer[4].'
            </td><td>'
.$db_field['score'].'</td></tr>';
        
$answer = array();
    }

    
mysql_close($db_handle); 


cellarius 09-10-2015 10:58 AM

Hm, hard to say. And all you get is a "?"? At this point I can just suggest basic debugging strategies: Try to simplyfy your operations as much as possible - start out with a simple query for a simple value and try to print it, then see what happens. Then go on step by step from there. Tedious work, but often worth it...

aminp30 09-10-2015 11:42 AM

Quote:

Originally Posted by cellarius (Post 2554732)
Hm, hard to say. And all you get is a "?"? At this point I can just suggest basic debugging strategies: Try to simplyfy your operations as much as possible - start out with a simple query for a simple value and try to print it, then see what happens. Then go on step by step from there. Tedious work, but often worth it...

no. numbers are ok. I think it depends on my language. I used
Code:

mysql_set_charset('utf8');
but it doesn't work.

is there any way to set charset on read or write?


All times are GMT. The time now is 01:52 PM.

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

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01185 seconds
  • Memory Usage 1,751KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete