Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

When moving from mysql to PDO should I move one page at a time or try for a big bang?

This is a complicated site that has many features and functionality. My thinking is that I should run mysql and PDO concurrently and phase out mysql as I get the PDO pages working. As an example of mysql elements on the index.php page see below: Line 68: $sqlvtime="select value from settings where key='videorefresh'"; Line 69: $resultvideo = mysql_query($sqlvtime); Line 71: while ($rowvideo = mysql_fetch_array($resultvideo))
Line 89: $sql_clicks = "SELECT * FROM $tbl_clicks WHERE advert = ".$params[1]." AND affiliate_id=".$params[2]." AND affiliate_type='".$params[3]."'"; Line 90: $sql_clicks = mysql_query($sql_clicks); Line 90: $sql_clicks = mysql_query($sql_clicks); Line 90: $sql_clicks = mysql_query($sql_clicks); Line 91: //secho $sql_clicks; Line 92: if(mysql_num_rows($sql_clicks) > 0){ Line 92: if(mysql_num_rows($sql_clicks) > 0){ Line 93: $array_clicks = mysql_fetch_array($sql_clicks); Line 93: $array_clicks = mysql_fetch_array($sql_clicks); Line 94: $sql_clicks = "UPDATE $tbl_clicks SET clicks = clicks + 1,last_update='".date("Y-m-d H:i:s")."' WHERE advert = ".$params[1]." AND affiliate_id=".$params[2]." AND affiliate_type='".$params[3]."'"; Line 95: mysql_query($sql_clicks); Line 95: mysql_query($sql_clicks); Line 97: $sql_clicks = "INSERT INTO $tbl_clicks(advert,affiliate_id,affiliate_type,last_update,clicks,active_clicks,status) Line 99: mysql_query($sql_clicks); Line 99: mysql_query($sql_clicks); Line 213: $sql_query = "SELECT * from video where status='active' order by priority " ; Line 214: $result = mysql_query($sql_query); Line 214: $result = mysql_query($sql_query); Line 215: while ($row = mysql_fetch_array($result)){ ?> Line 225: $sql_query = "SELECT * from video where status='active' order by priority " ; Line 226: $result = mysql_query($sql_query); Line 226: $result = mysql_query($sql_query); Line 229: while ($row = mysql_fetch_array($result)){ ?> Line 232: $sql_query1 = "SELECT * from image where video_id=".$imgId ; Line 233: $result1 = mysql_query($sql_query1); Line 233: $result1 = mysql_query($sql_query1); Line 234: while ($row1 = mysql_fetch_array($result1)){

2 Answers

jamesjones21
jamesjones21
9,260 Points

I take this is not done in OOP and more procedural? As with OOP its all in one place etc.

I would say that the site is a mix of procedural and OOP. I have several objectives for the site at the moment: first is to change depreciated code; second fix warnings and errors; refactor code and make it more usable i.e. adopt best practices such as OOP. Mysql to PDO is the most glaring example of depreciated code that I would like to fix. BTW, the site is working from a functional point of view despite errors and warnings that appear when error reporting on.