Jump to content

accessing MySQL from cake php


hsekar

Recommended Posts

Hi All......

i wanted to know if there is a way of accessing the results of a query from Cake PHP.

 

This is my code

$query = $this->Webapp->query("SELECT count(*) as count from webapps where mutId='$jobid'");

$cleaned_query = escapeshellcmd($query);

$query_out = mysql_query($cleaned_query);

 

How do I know what the count is now .

How can I store the count in another variable.

 

Need Help....its urgent !

 

Link to comment
Share on other sites

Theres a findCount function, I think it would look something like this

$count = $this->Webapp->findCount(array("mutId"=>$jobid));

 

Your 2nd and 3rd lines of code baffle me though. You should read the manual page for escapeshellcmd(), since it's for an entirely different purpose than the one you're using it for.

 

Go through the cake tutorials also.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.