how to fetch data in cake php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Harsh kumar
    New Member
    • Nov 2012
    • 2

    #1

    how to fetch data in cake php

    I am new in cake php please help
    I am passing a value using query string and trying to fetch data from database table i.e which is passed in query string. here is my index.php code.
    Code:
    <?php echo "<a class='user' href='interview.php?category= PHP'>";?><li> PHP Programming</li></a>
    
    <?php echo "<a class='user' href='interview.php?category= JAVA'>";?><li> Java Programming</li></a>
    i have two table in my database with same name I passed in query string i.e PHP and JAVA.

    now my interview.php code is here.
    Code:
     
    $_SESSION['d']=$_GET['category'];
    $uid =$_SESSION['d']; 
    // some html code here....//
    $query=mysql_query("select * from .$uid ");
    if(mysql_num_rows($query)>0){
    while($data=mysql_fetch_array($query,1)){
    echo $data['Q_Id'];
    echo $data['Question'];
    }}
    ?>
    now i want to achieve this in cake php using one action how i can do this i am using cake2.5.5
Working...