View Full Version : Cannot understand why this not work
BulliM
02-02-2019, 12:05 PM
Can anyone explain, why this works:
$info = vB::getDbAssertor()->getRow('user', array("userid" => $row['userid']), false, 'username');
and this not:
$info = vB::getDbAssertor()->getRow('anothertableindatabase', array("userid" => $row['userid']), false, 'username');
nor:
$info = vB::getDbAssertor()->getRow('vBForum:anothertableindatabase', array("userid" => $row['userid']), false, 'username');
nor:
$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
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
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
global $vbulletin;
$pageuser = 1 // 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
Enable debug mode in the root config and core config to see the error stack trace.
Result:
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 => '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 1549284087 at 1549284087 ---------------
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?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.