[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/wsr/ - Worksafe Requests


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


Can a PHP genus check if this code could be improved?
It's just your basic structure for a site that pulls content from the database and prints it, with pagination in the mix.
I got this from some online tutorial and have been using it, but I don't know how much it makes sense.

The "no results" thing was added by me. The original code didn't have any way to handle a situation where there's no row in the database.
>>
Another php question...

When building a site with php, should I have all the sub pages just included to index.php or not?
Currently my site is basically just
>index.php?page=posts
>index.php?page=threads
>index.php?page=profile
instead of
>profile.php
>threads.php

This is so that I can use just one main loop (in the op pic)



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.