vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB5 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=263)
-   -   Cannot understand why this not work (https://vborg.vbsupport.ru/showthread.php?t=327072)

BulliM 02-02-2019 12:05 PM

Cannot understand why this not work
 
Can anyone explain, why this works:

PHP Code:

$info vB::getDbAssertor()->getRow('user', array("userid" => $row['userid']), false'username'); 

and this not:


PHP Code:

$info vB::getDbAssertor()->getRow('anothertableindatabase', array("userid" => $row['userid']), false'username'); 

nor:

PHP Code:

$info vB::getDbAssertor()->getRow('vBForum:anothertableindatabase', array("userid" => $row['userid']), false'username'); 

nor:

PHP Code:

$info vB::getDbAssertor()->getRow('realdatabasename:anothertableindatabase', array("userid" => $row['userid']), false'username'); 

Going crazy with vB5 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

noypiscripter 02-03-2019 03:52 AM

What table did you specify? Not all tables have a column named "userid".

BulliM 02-03-2019 06:40 AM

Quote:

Originally Posted by noypiscripter (Post 2598350)
What table did you specify? Not all tables have a column named "userid".

My table has. userid is the primary key in an added table (same database!). Different is, the searched column wasn't username but user_name. Surely I used that, too. Still cannot understand, why this won't work.

noypiscripter 02-03-2019 05:10 PM

What is the SQL error? You would get an email with the SQL error if you've added your email in the dbtechnicalemail (or something like that) in the core config.

BulliM 02-03-2019 05:40 PM

Quote:

Originally Posted by noypiscripter (Post 2598364)
What is the SQL error? You would get an email with the SQL error if you've added your email in the dbtechnicalemail (or something like that) in the core config.

I get no email, because development server has no access to email services.

I get "That action could not be completed. Please try again, and if this occurs again please contact the system administrator and tell them how you got this message. "

This works:

PHP Code:

<?php
global $vbulletin;
$pageuser // Row exists
$result $vbulletin->db->query_read('SELECT * FROM database.tablename WHERE userid ='.$pageuser);
$row $vbulletin->db->fetch_array($result);


noypiscripter 02-03-2019 08:03 PM

Enable debug mode in the root config and core config to see the error stack trace.

BulliM 02-03-2019 08:10 PM

Quote:

Originally Posted by noypiscripter (Post 2598368)
Enable debug mode in the root config and core config to see the error stack trace.

Result:

HTML Code:

Debug: Error
<b>API Error</b><br><b>Error:</b> invalid_query_definition_x<br><b>Args:</b><br><pre style="font-family:Lucida Console,Monaco5,monospace;font-size:small;overflow:auto;border:1px solid #CCC;">array ( 0 =&gt; 'tablename', )</pre>
occurred in file /var/www/xxxxxxx.xx/core/vb/db/query.php on line 298
Trace

    Function getQuery in file /var/www/xxxxxx.xx/core/vb/db/assertor.php line 225

--------------- Added [DATE]1549284087[/DATE] at [TIME]1549284087[/TIME] ---------------

I know now, why this not work. User delicjous helps me to found out. My table was not defined in querydefs.php. Since it is defined in, I get no errors anymore by using function getDbAssertor().

How should anyone know this?


All times are GMT. The time now is 03:08 AM.

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.01072 seconds
  • Memory Usage 1,740KB
  • 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_html_printable
  • (5)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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