Im giving PHP my first whirl, and have been working on a script that I found to display the 4 most recent forum topics. I would like to put each result into a cell of a 2x2 table but don't know how. Can someone give me a general idea of where to start? Thanks.
echo '<table><tr><td align="right">' . $var1 . '</td><td align="left">' . $var1desc . '</td></tr><tr><td align="right">' . $var2 . '</td><td align="left">' . $var2desc . '</td></tr></table>'; PHP: There's one way.
There is a better thing to do. Just search for "phplib" in google and u will get a library set which inlcuded virtually everything u need to code. the database connections are made as simple like this, $db = new DB(); $db->query(query string); etc. and there is a table class too, which allows you to creat tables by just calling a function with certain arguments. also it can create a table from an sql query result set. then if u wish to create a template based site there are funsctions for this too. if u think seriously of php, phplib is not the thing u wish to forget. I am not in anyway related to phplib's development, i am just a very much satisfied downloader. i guarentee you, you can save half time u spend on coding from now on if u spend one hr to read and experiment the different classes and functions available.
i agree phplib is pretty good until you are good enough to code your own class / functions. good way to get into php.
While I agree that this is probably good. We do have a new programmer here. I wonder if classes are really the direction to go? I believe that he should know what the functions in the class do. ie. Know html and how to create a 2 row 2 column table. :/
Carawan, you should probably try nail this for sake of experience, but once you pass the beginner stage you need to try separate application code from presentation code entirely (using the smarty engine for example).
I am not saying that he must not go for basic php than to jump to classes. But as the phplib guys say u need not be an expert to code with phplib. You can code if u know the basic syntax of php. Also the built in classes (no need to worry hearing the word class) are so well documented that u can find what u r looking for in matter of seconds. You just think of some functions wih which u can get a thing done and the function will b there. You can ask me for any help regarding phplib.
Thank you everyone for your input! I have gotten noppid's suggestion to work, so will use this for now, and crack open the PHP bible to learn more about classes when I start becoming more proficient. King Cobra and Nulbit, I did take a look at both Smarty and PHPlib, both of which I was not aware of. Excellent resources