dsgtew3241 2010-10-14 10:11
浏览 57

救命! 显示phpbb3来自SQlite 2数据库的最新帖子

I need help fast, instead of using mySQL my phpbb3 forum uses SQlite 2, a normal "database.db file that was manually created from a notepad.txt file then populated by phpbb3" I need help Accessing the data within that SQlite 2 database instead of MySQL.

when I run this Script I get echo: Recent Posts (located on line3) but nothing else

I'm a complete noob with PHP so Plz Help, I have been at it for 1 week now with no Luck

Ultimately I wanna Display the 15 most recent posts in a Adobe Flash Dynamic txt box with html support outside of Phpbb3 on my website

enter code here
  <?php
  $db = sqlite_open("Mydatabasenamehere.db", 0666, $sqliteerror);
  echo "Recent Posts<p />";
  $recent = sqlite_query($db, "SELECT * FROM * phpbb_posts ORDER BY post_time DESC LIMIT 15");
  while ($recent_row = sqlite_fetch_all($recent, SQLITE_ASSOC))
  {

// get data
$post_id = $recent_row['post_id'];
$topic_id = $recent_row['topic_id'];
$forum_id = $recent_row['forum_id'];    
$poster_id = $recent_row['poster_id'];
$post_time = $recent_row['post_time'];

// get topic name
$topic_name = sqlite_query($db, "SELECT topic_title FROM phpbb_topics WHERE topic_id='$topic_id'");
$topic_name = sqlite_fetch_all($topic_name);
$topic_name = $topic_name('topic_title');

// get username 
$username = sqlite_query($db, "SELECT username FROM phpbb_users WHERE user_id='$poster_id'");
$username = sqlite_fetch_all($username);
$username = $username['username'];

//var for flash
//$toflash = "<b><a href='http://microfusion.mine.nu/forums/memberlist.php?mode=viewprofile&u=$poster_id'></a>$username</b> Posted in \"<a href='http://microfusion.mine.nu/forums/viewtopic.php?$forum_id1&t=$topic_id&p=post_id#p$post_id'>$topic_name\"</a><br />";
//echo "RecPos.$toflash";

    //to test first before flash integration
echo "$username Posted in $topic_name<br />";

    }

    ?>
  • 写回答

2条回答 默认 最新

  • dtsps00544 2010-10-14 10:42
    关注
    error_reporting(E_ALL);
    ini_set('display_errors', 'on');
    $db = sqlite_open("Mydatabasenamehere.db", 0666, $sqliteerror)
       or die($sqliteerror);
    echo "<p>Recent Posts</p>";
    $sql = "SELECT * FROM phpbb_posts ORDER BY post_time DESC LIMIT 15";
    echo "<p>Query: " . $sql . "</p>";
    $recent = sqlite_query($db, $sql)
       or die(sqlite_error_string(sqlite_last_error()));
    
    1. enable error reporting (on top of the script, just after <?php)
    2. if there is still an white page check if you have access to error-log file
    3. check if sqlite_open was successful or die($sqliteerror);
    4. debug query
    5. call sqlite_error_string after every sqlite_query
    评论

报告相同问题?

悬赏问题

  • ¥15 制裁名单20240508芯片厂商
  • ¥20 易康econgnition精度验证
  • ¥15 线程问题判断多次进入
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接