Created
February 17, 2013 04:00
-
-
Save AstDerek/4970078 to your computer and use it in GitHub Desktop.
Comparison between original code, and ORM code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Without ORM | |
$forum_id = 0; | |
$query = "select id from imas_forums where courseid = ".$_GET['courseid']; | |
$result = mysql_query($query) or die("Query failed: ".mysql_error()); | |
$foro = mysql_fetch_row($result); | |
if(count($foro)>0) | |
$forum_id = $foro[0]; | |
// With ORM | |
$forum = ORM::for_table('imas_forums')->where('courseid',$_GET['courseid'])->find_one(); | |
$forum_id = $forum ? $forum->id : 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment