Code1: Source code for the latest blogs related to a specific username
PHP Code:
ob_start();
$blog_get = vB::$db->query_read("
SELECT * from " . TABLE_PREFIX . " blog where username='omardealo' order by dateline DESC LIMIT 20");
$output_bits = '';
while($blog = vB::$db->fetch_array($blog_get))
{
$output_bits .= '<font color="#ff0000"><b>?</b></font><a href="blog.php?b='.$blog[blogid].'">'.$blog[title].'</a></br />
<a href="member.php?u='.$blog[userid].'"><b>'.$blog[username].'</b><br />';
}
$output = $output_bits;
ob_end_clean();
- with the replacement of the number of articles blogs that you want to appear
PHP Code:
LIMIT 20
- With the replacement of the name of the selected username
PHP Code:
omardealo
Code2: Source code for the latest articles blogs for all user
PHP Code:
ob_start();
$blog_get = vB::$db->query_read("
SELECT * from " . TABLE_PREFIX . " blog order by dateline DESC LIMIT 20");
$output_bits = '';
while($blog = vB::$db->fetch_array($blog_get))
{
$output_bits .= '<font color="#ff0000"><b>?</b></font><a href="blog.php?b='.$blog[blogid].'">'.$blog[title].'</a></br />
<a href="member.php?u='.$blog[userid].'"><b>'.$blog[username].'</b><br />';
}
$output = $output_bits;
ob_end_clean();
- with the replacement of the number of articles blogs that you want to appear
PHP Code:
LIMIT 20
Composition:
Goto Admincp->vBullietin CMS->Widgets->Create New Widget
Choose PHP Direct Execution as Widget's Type
Place a Title. last articles blogs
Click Save
Click Configure on the right of the new created widget.
Remove the default code that appears. Be sure to not leave behind even a single letter.
Copy and Paste the code that you can find below.
Leave the template name as is (vbcms_widget_execphp_page)
Click Save
Goto Admincp->vBullietin CMS->Layout Manager
Click Go on the Default Layout
Add the Widget to your Layout
Click Save
SELECT * from vb blog order by dateline DESC LIMIT 20;
MySQL Error : Table 'xxxx.vb' doesn't exist Error Number : 1146 Request Date : Tuesday, March 30th 2010 @ 06:55:21 PM Error Date : Tuesday, March 30th 2010 @ 06:55:22 PM Script : http://antimisandry.com/content.php Referrer : http://antimisandry.com/members/marx/ IP Address : xx.xx.xx.xx Username : Marx Classname : vB_Database MySQL Version : 5.0.90
XXXX = My databasename, but I don't see where the .vb got added?
IOW, it's asking for a table called "mydatabasename.vb" which doesn't exist - the only reference to 'mydatabasename' is the database itself, not one of the tables within the database.
XXXX = My databasename, but I don't see where the .vb got added?
IOW, it's asking for a table called "mydatabasename.vb" which doesn't exist - the only reference to 'mydatabasename' is the database itself, not one of the tables within the database.
Quote:
Originally Posted by kho91
i have the same problem
code 2 working good in my cms
try this
PHP Code:
ob_start(); $blog_get = vB::$db->query_read(" SELECT * from blog order by dateline DESC LIMIT 20"); $output_bits = ''; while($blog = vB::$db->fetch_array($blog_get)) { $output_bits .= '<font color="#ff0000"><b>?</b></font><a href="blog.php?b='.$blog[blogid].'">'.$blog[title].'</a></br /> <a href="member.php?u='.$blog[userid].'"><b>'.$blog[username].'</b><br />'; } $output = $output_bits; ob_end_clean();
ob_start(); $blog_get = vB::$db->query_read(" SELECT * from blog order by dateline DESC LIMIT 20"); $output_bits = ''; while($blog = vB::$db->fetch_array($blog_get)) { $output_bits .= '<font color="#ff0000"><b>?</b></font><a href="blog.php?b='.$blog[blogid].'">'.$blog[title].'</a></br /> <a href="member.php?u='.$blog[userid].'"><b>'.$blog[username].'</b><br />'; } $output = $output_bits; ob_end_clean();
This code still causes a d/b error.
PHP Code:
Database error in vBulletin 4.0.2:
Invalid SQL:
SELECT * from blog order by dateline DESC LIMIT 20;
MySQL Error : Table 'my_database_name.blog' doesn't exist Error Number : 1146 Request Date : Wednesday, March 31st 2010 @ 03:18:47 PM Error Date : Wednesday, March 31st 2010 @ 03:18:50 PM Script : http://antimisandry.com/content/ Referrer : http://antimisandry.com/australian-mens-news/dysfunctional-feminism-strikes-again-29377.html IP Address : xxxxxxxxxx Username : xxxxxxxx Classname : vB_Database MySQL Version :
For some reason, and I'm no coder so can't say why, it is still trying to look up a table called my_database_name instead of an existing table within the database. It makes no sense.
Whereas previously (using code2) it would ask for a table called "my_database_name.vb" it now asks for a table, which also does not exist, called "my_database_name.blog"
This code still causes a d/b error.
For some reason, and I'm no coder so can't say why, it is still trying to look up a table called my_database_name instead of an existing table within the database. It makes no sense.
Whereas previously (using code2) it would ask for a table called "my_database_name.vb" it now asks for a table, which also does not exist, called "my_database_name.blog"
sir , my code Queries from table blog
PHP Code:
SELECT * from blog order by dateline DESC LIMIT 20;
not from table my_database_name.blog
so I do not know from where comes the name of the table "my_database_name.blog"
if u use tableprefix in config.php this code will work with u well
PHP Code:
ob_start();
$blog_get = vB::$db->query_read("
SELECT * from " . TABLE_PREFIX . " blog order by dateline DESC LIMIT 20");
$output_bits = '';
while($blog = vB::$db->fetch_array($blog_get))
{
$output_bits .= '<font color="#ff0000"><b>?</b></font><a href="blog.php?b='.$blog[blogid].'">'.$blog[title].'</a></br />
<a href="member.php?u='.$blog[userid].'"><b>'.$blog[username].'</b><br />';
}
$output = $output_bits;
ob_end_clean();
Well I do appreciate your efforts, but even a direct copy & paste still kills my d/b, resulting in errors when using this widget.
PHP Code:
Database error in vBulletin 4.0.2:
Invalid SQL:
SELECT * from vb blog order by dateline DESC LIMIT 20;
MySQL Error : Table 'XXXX.vb' doesn't exist Error Number : 1146 Request Date : Thursday, April 1st 2010 @ 02:59:33 AM Error Date : Thursday, April 1st 2010 @ 02:59:43 AM Script : http://antimisandry.com/content/ Referrer : http://antimisandry.com/members/yan-yan/ IP Address : **.**.**.** Username : ---------- Classname : vB_Database MySQL Version :
I don't understand code too well, so can't really comment on why this is happening... but again, if you note the above error message (received via email moments after testing your latest code offering) - it still claims to be trying to read a table with the name of my database.