Phenomena Posted November 3, 2006 Share Posted November 3, 2006 Though this is my first time trying to create a whole new page with php, i do have a bit of experience through installing mods on my phpBB forums.Ive managed to get it so that im connected to the same database my phpBB forums are installed on. Now what I'm trying to do i get it so that the text from each post in a specific forum is displayed on the page. I can't seem to figure this out. Any help would be greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/25996-php-and-mysql/ Share on other sites More sharing options...
trq Posted November 3, 2006 Share Posted November 3, 2006 Select the data you want using a SELECT sql statement and [url=http://php.net/mysql_query]mysql_query[/url], then loop through the result using [url=http://php.net/mysql_fetch_assoc]mysql_fetch_assoc[/url] to grab each row. Link to comment https://forums.phpfreaks.com/topic/25996-php-and-mysql/#findComment-118814 Share on other sites More sharing options...
jsladek Posted November 3, 2006 Share Posted November 3, 2006 This is a shameless plug....Check out http://www.iobe.net/proj/I have a program I'm working on and I have some "beta versions" available for download. There are two choices application builder and script builder. The appbuilder builds what I like to call and application and script builder builds individual scripts. The only real difference is that application builder calls index.php passing its name to it and the script builder scripts call themeselves so they are stand alone.The result is 1 php script per table in your database. It really only fully works for tables with 1 primary key but you can go in and edit the files easily. They are pretty simple. I'm working on having it work with multiple keys or no keys at all and I should have it done soon.Sounds to me that script builder will work for your purposes....At minimum, it will make a script that you can look at and see what is going on.Feedback would also be kool. Regards,John Sladek Link to comment https://forums.phpfreaks.com/topic/25996-php-and-mysql/#findComment-118820 Share on other sites More sharing options...
JustinK101 Posted November 3, 2006 Share Posted November 3, 2006 jsladek:Invest in some better hosting, your slow is horribly slow. :) LOL Link to comment https://forums.phpfreaks.com/topic/25996-php-and-mysql/#findComment-118828 Share on other sites More sharing options...
Phenomena Posted November 3, 2006 Author Share Posted November 3, 2006 ugh, ive managed to compile a test script but its not working properly, i dont get any php errors but It doesnt display the rank title[code]$username="********";$password="********";$database="********";mysql_connect(localhost,$username,$password);@mysql_connect_db($database) or die ("Unable to connect to the database.");$query="SELECT * FROM phpbb_ranks";$result=mysql_query($query);$num=mysql_numrows($result);mysql_close();$i=0;while ($i < $num) {$first=mysql_result($result,$i,"rank_title");echo "rank_title";$i++;}[/code] Link to comment https://forums.phpfreaks.com/topic/25996-php-and-mysql/#findComment-118836 Share on other sites More sharing options...
jsladek Posted November 3, 2006 Share Posted November 3, 2006 shouldecho "rank_title";beecho "$first"; Link to comment https://forums.phpfreaks.com/topic/25996-php-and-mysql/#findComment-118842 Share on other sites More sharing options...
Phenomena Posted November 3, 2006 Author Share Posted November 3, 2006 just tried it and it still doesn't show up =\ Link to comment https://forums.phpfreaks.com/topic/25996-php-and-mysql/#findComment-118847 Share on other sites More sharing options...
jsladek Posted November 3, 2006 Share Posted November 3, 2006 try this...<?$username="********";$password="********";$database="********";mysql_connect(localhost,$username,$password);@mysql_connect_db($database) or die ("Unable to connect to the database.");$query="SELECT * FROM phpbb_ranks";$result=mysql_query($query);while($row = mysql_fetch_array($result)) {print("$row[rank_title]<br>");}mysql_close();?> Link to comment https://forums.phpfreaks.com/topic/25996-php-and-mysql/#findComment-118848 Share on other sites More sharing options...
jsladek Posted November 3, 2006 Share Posted November 3, 2006 Just figured out I can edit my posts.... This is cool Link to comment https://forums.phpfreaks.com/topic/25996-php-and-mysql/#findComment-118849 Share on other sites More sharing options...
jsladek Posted November 3, 2006 Share Posted November 3, 2006 see above :0) Link to comment https://forums.phpfreaks.com/topic/25996-php-and-mysql/#findComment-118851 Share on other sites More sharing options...
rab Posted November 3, 2006 Share Posted November 3, 2006 You might want to go over your code for security holes seeing as I found a few MAJOR ones. Link to comment https://forums.phpfreaks.com/topic/25996-php-and-mysql/#findComment-118852 Share on other sites More sharing options...
jsladek Posted November 3, 2006 Share Posted November 3, 2006 I'm sure there are, I'm trying to get it to do what I want it to first. I am thinking about security too, just back burnered it for now. Did you actually try running the program against a database? If so, besides the obvious security issues, what do you think? Link to comment https://forums.phpfreaks.com/topic/25996-php-and-mysql/#findComment-118859 Share on other sites More sharing options...
rab Posted November 3, 2006 Share Posted November 3, 2006 Evil remote file: http://rafb.net/paste/results/cR9oDf18.txtHorrible vulnerable file: http://www.iobe.net/proj/index.php?pg=http://rafb.net/paste/results/cR9oDf18.txt%00poison NULL byte strikes again! Link to comment https://forums.phpfreaks.com/topic/25996-php-and-mysql/#findComment-118863 Share on other sites More sharing options...
jsladek Posted November 3, 2006 Share Posted November 3, 2006 Believe it or not, I have read about that very thing. Just wasn't my first concern. I guess now I'll have to address it since it is posted here :0) Link to comment https://forums.phpfreaks.com/topic/25996-php-and-mysql/#findComment-118869 Share on other sites More sharing options...
jsladek Posted November 3, 2006 Share Posted November 3, 2006 Ok, Thanks rab for showing me the error in my ways. I made a quick fix to validate someone sneaking in a link like that and I'll have to fix the other issues before allowing a live demo. I think I was just a little over excited about the program I'm working on..... to me it's cool.........anyhow, Phenomena, did you ever get your program to work? Link to comment https://forums.phpfreaks.com/topic/25996-php-and-mysql/#findComment-118914 Share on other sites More sharing options...
Phenomena Posted November 3, 2006 Author Share Posted November 3, 2006 sorry for late reply, i did... well almost. Since i dont have enough knowledge of php to make my own, safe page. I decided to download a phpBB mod and change it around to work on my main pagehttp://modhalotrial.com/test.phponly problem is i need to read it from a certain forum, right now it just reads from every forum. There is something in the orginal phpBB mod to do this but you need to be able to create arrays.[code]// exclude forums from fetching// can be left blank to disable it, can contain a single forum id or an array// with multiple id's//$CFG['posts_exclude_forums'] = '';[/code]i dont know how to turn that into an array loledit: never mind i got it :) Link to comment https://forums.phpfreaks.com/topic/25996-php-and-mysql/#findComment-119359 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.