Ronghua | 1 Jan 03:17 2012
Picon

Re: Cake is NOT able to connect to the database.

I tried this as well, created database as you mentioned below with
testuser, change the configure file as below. But the result is same
as below, still can't connect to DB.
<?php
class DATABASE_CONFIG {
        public $default = array(
            'datasource' => 'Database/Mysql',
            'persistent' => false,
            'host' => 'localhost',
            'login' => 'testuser',
            'password' => '123456',
            'database' => 'cake_testing',
            'prefix' => '',
            'encoding' => ''
        );
}

On 1月1日, 上午1时49分, Sam Sherlock <sam.sherl... <at> gmail.com> wrote:
> because this is blank
>
>  'database' => '',
>
> what is the name of the mysql database your connecting to?
>
> mysql -u testuser -p123456 -h localhost
> mysql>CREATE DATABASE cake_testing;
> mysql>exit;
>
> then use  'database' => 'cake_testing',

(Continue reading)

Ronghua | 1 Jan 03:19 2012
Picon

Re: Cake is NOT able to connect to the database.

I also tried my root login configuration, but it doesn't work as well.

On 1月1日, 上午1时51分, "Timothy O'Reilly" <timothy.john.orei...@...>
wrote:
> I'm sure you have tried it, but have you tried Login "Root" and Password
> "Root"?
> Regards,
> Tim
>
>
>
>
>
>
>
> On Sat, Dec 31, 2011 at 2:59 AM, Ronghua <ronghuaz...@...> wrote:
> > Hi, today is first day I'm using cake. I have setup CakePHP 2.0.4. In
> > \app\Config\database.php, the configuration is as below
> > <?php
>
> > class DATABASE_CONFIG {
> >        public $default = array(
> >            'datasource' => 'Database/Mysql',
> >            'persistent' => false,
> >            'host' => 'localhost',
> >            'login' => 'testuser',
> >            'password' => '123456',
> >            'database' => '',
> >            'prefix' => '',
> >            'encoding' => ''
(Continue reading)

清水紘己 | 1 Jan 03:39 2012
Picon

Re: Cake is NOT able to connect to the database.

Did you have done GRANT it?

2012/1/1 Ronghua <ronghuazhao@...>:
> I also tried my root login configuration, but it doesn't work as well.
>
> On 1月1日, 上午1时51分, "Timothy O'Reilly" <timothy.john.orei...@...>
> wrote:
>> I'm sure you have tried it, but have you tried Login "Root" and Password
>> "Root"?
>> Regards,
>> Tim
>>
>>
>>
>>
>>
>>
>>
>> On Sat, Dec 31, 2011 at 2:59 AM, Ronghua <ronghuaz...@...> wrote:
>> > Hi, today is first day I'm using cake. I have setup CakePHP 2.0.4. In
>> > \app\Config\database.php, the configuration is as below
>> > <?php
>>
>> > class DATABASE_CONFIG {
>> >        public $default = array(
>> >            'datasource' => 'Database/Mysql',
>> >            'persistent' => false,
>> >            'host' => 'localhost',
>> >            'login' => 'testuser',
>> >            'password' => '123456',
(Continue reading)

Ronghua | 1 Jan 06:38 2012
Picon

Re: Cake is NOT able to connect to the database.

Yes, I grant all privileges to the user. Actually, if I write a php
file to connect to mysql directly, I can query the result from table.

<?php
$host='localhost';
$user_name='testuser';
$password='123456'; //这里****是你设置的密码

$conn=mysql_connect($host,$user_name,$password);
if (!$conn)
{
die('connect fail:'.mysql_error());
}
echo 'connect success!<br/>';
mysql_select_db("cake_testing", $conn);
$result = mysql_query("SELECT * FROM test");
while($row = mysql_fetch_array($result))
{
echo $row['ref']." ".$row['content'];
echo "<br />";
}
if (mysql_close($conn))
{
echo '<br/>...<br/>';
echo '到数据库的连接已经成功关闭';
}
?>

On 1月1日, 上午10时39分, 清水紘己
<hiromi2...@...> wrote:
(Continue reading)

Renato de Freitas Freire | 1 Jan 07:43 2012
Picon

Re: Cake is NOT able to connect to the database.

I had the same problem when start using cake 2.0.4 on my work, but I tried it on my pc and it work fine.

It might be something with your server configuration.

I will doble check it on monday on my work.
Any news I tell you.

But you can try it on other server, or try to upgrade your mysql, or something like that.

--
Renato Freire




2012/1/1 Ronghua <ronghuazhao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Yes, I grant all privileges to the user. Actually, if I write a php
file to connect to mysql directly, I can query the result from table.

<?php
$host='localhost';
$user_name='testuser';
$password='123456'; //这里****是你设置的密码

$conn=mysql_connect($host,$user_name,$password);
if (!$conn)
{
die('connect fail:'.mysql_error());
}
echo 'connect success!<br/>';
mysql_select_db("cake_testing", $conn);
$result = mysql_query("SELECT * FROM test");
while($row = mysql_fetch_array($result))
{
echo $row['ref']." ".$row['content'];
echo "<br />";
}
if (mysql_close($conn))
{
echo '<br/>...<br/>';
echo '到数据库的连接已经成功关闭';
}
?>

On 1月1日, 上午10时39分, 清水紘己 <hiromi2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Did you have done GRANT it?
>
> 2012/1/1 Ronghua <ronghuaz...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
>
>
>
>
>
>
>
> > I also tried my root login configuration, but it doesn't work as well.
>
> > On 1月1日, 上午1时51分, "Timothy O'Reilly" <timothy.john.orei...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > wrote:
> >> I'm sure you have tried it, but have you tried Login "Root" and Password
> >> "Root"?
> >> Regards,
> >> Tim
>
> >> On Sat, Dec 31, 2011 at 2:59 AM, Ronghua <ronghuaz...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >> > Hi, today is first day I'm using cake. I have setup CakePHP 2.0.4. In
> >> > \app\Config\database.php, the configuration is as below
> >> > <?php
>
> >> > class DATABASE_CONFIG {
> >> >        public $default = array(
> >> >            'datasource' => 'Database/Mysql',
> >> >            'persistent' => false,
> >> >            'host' => 'localhost',
> >> >            'login' => 'testuser',
> >> >            'password' => '123456',
> >> >            'database' => '',
> >> >            'prefix' => '',
> >> >            'encoding' => ''
> >> >        );
> >> > }
>
> >> > I can connect to mysql with MySQLQueryBrowser by testuser and pwd
> >> > 123456, but I can't connect to database through Cake. Here is the
> >> > description in the website. Can someone help me here? From the website
> >> > reference, seems nothing else need to change.
>
> >> > Your version of PHP is 5.2.6 or higher.
>
> >> > Your tmp directory is writable.
>
> >> > The FileEngine is being used for caching. To change the config edit
> >> > APP/Config/core.php
>
> >> > Your database configuration file is present.
>
> >> > Cake is NOT able to connect to the database.
>
> >> > --
> >> > Our newest site for the community: CakePHP Video Tutorials
> >> >http://tv.cakephp.org
> >> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> >> > others with their CakePHP related questions.
>
> >> > To unsubscribe from this group, send email to
> >> > cake-php+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group
> >> > athttp://groups.google.com/group/cake-php
>
> > --
> > Our newest site for the community: CakePHP Video Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group athttp://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/cake-php
清水紘己 | 1 Jan 08:08 2012
Picon

Re: Cake is NOT able to connect to the database.

My last guess is pdo mysql is not enabled.

2012/1/1 Renato de Freitas Freire <renatoff@...>:
> I had the same problem when start using cake 2.0.4 on my work, but I tried
> it on my pc and it work fine.
>
> It might be something with your server configuration.
>
> I will doble check it on monday on my work.
> Any news I tell you.
>
> But you can try it on other server, or try to upgrade your mysql, or
> something like that.
>
> --
> Renato Freire
>
>
>
>
> 2012/1/1 Ronghua <ronghuazhao@...>
>>
>> Yes, I grant all privileges to the user. Actually, if I write a php
>> file to connect to mysql directly, I can query the result from table.
>>
>> <?php
>> $host='localhost';
>> $user_name='testuser';
>> $password='123456'; //这里****是你设置的密码
>>
>> $conn=mysql_connect($host,$user_name,$password);
>> if (!$conn)
>> {
>> die('connect fail:'.mysql_error());
>> }
>> echo 'connect success!<br/>';
>> mysql_select_db("cake_testing", $conn);
>> $result = mysql_query("SELECT * FROM test");
>> while($row = mysql_fetch_array($result))
>> {
>> echo $row['ref']." ".$row['content'];
>> echo "<br />";
>> }
>> if (mysql_close($conn))
>> {
>> echo '<br/>...<br/>';
>> echo '到数据库的连接已经成功关闭';
>> }
>> ?>
>>
>> On 1月1日, 上午10时39分, 清水紘己
<hiromi2...@...> wrote:
>> > Did you have done GRANT it?
>> >
>> > 2012/1/1 Ronghua <ronghuaz...@...>:
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > > I also tried my root login configuration, but it doesn't work as well.
>> >
>> > > On 1月1日, 上午1时51分, "Timothy O'Reilly" <timothy.john.orei...@...>
>> > > wrote:
>> > >> I'm sure you have tried it, but have you tried Login "Root" and
>> > >> Password
>> > >> "Root"?
>> > >> Regards,
>> > >> Tim
>> >
>> > >> On Sat, Dec 31, 2011 at 2:59 AM, Ronghua <ronghuaz...@...>
>> > >> wrote:
>> > >> > Hi, today is first day I'm using cake. I have setup CakePHP 2.0.4.
>> > >> > In
>> > >> > \app\Config\database.php, the configuration is as below
>> > >> > <?php
>> >
>> > >> > class DATABASE_CONFIG {
>> > >> >        public $default = array(
>> > >> >            'datasource' => 'Database/Mysql',
>> > >> >            'persistent' => false,
>> > >> >            'host' => 'localhost',
>> > >> >            'login' => 'testuser',
>> > >> >            'password' => '123456',
>> > >> >            'database' => '',
>> > >> >            'prefix' => '',
>> > >> >            'encoding' => ''
>> > >> >        );
>> > >> > }
>> >
>> > >> > I can connect to mysql with MySQLQueryBrowser by testuser and pwd
>> > >> > 123456, but I can't connect to database through Cake. Here is the
>> > >> > description in the website. Can someone help me here? From the
>> > >> > website
>> > >> > reference, seems nothing else need to change.
>> >
>> > >> > Your version of PHP is 5.2.6 or higher.
>> >
>> > >> > Your tmp directory is writable.
>> >
>> > >> > The FileEngine is being used for caching. To change the config edit
>> > >> > APP/Config/core.php
>> >
>> > >> > Your database configuration file is present.
>> >
>> > >> > Cake is NOT able to connect to the database.
>> >
>> > >> > --
>> > >> > Our newest site for the community: CakePHP Video Tutorials
>> > >> >http://tv.cakephp.org
>> > >> > Check out the new CakePHP Questions
>> > >> > sitehttp://ask.cakephp.organdhelp
>> > >> > others with their CakePHP related questions.
>> >
>> > >> > To unsubscribe from this group, send email to
>> > >> > cake-php+unsubscribe@... For more options, visit this
>> > >> > group
>> > >> > athttp://groups.google.com/group/cake-php
>> >
>> > > --
>> > > Our newest site for the community: CakePHP Video
>> > > Tutorialshttp://tv.cakephp.org
>> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
>> > > others with their CakePHP related questions.
>> >
>> > > To unsubscribe from this group, send email to
>> > > cake-php+unsubscribe@... For more options, visit this
>> > > group athttp://groups.google.com/group/cake-php
>>
>> --
>> Our newest site for the community: CakePHP Video Tutorials
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
>> others with their CakePHP related questions.
>>
>>
>> To unsubscribe from this group, send email to
>> cake-php+unsubscribe@... For more options, visit this group
>> at http://groups.google.com/group/cake-php
>
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscribe@... For more options, visit this group at
> http://groups.google.com/group/cake-php

--

-- 
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP
related questions.

To unsubscribe from this group, send email to
cake-php+unsubscribe@... For more options, visit this group
at http://groups.google.com/group/cake-php

Geoff Douglas | 1 Jan 08:33 2012
Picon

Re: Multiple Businesses in one database

I do a very similar thing to allow users multiple profiles. So they can segregate their data by company, or family, or team.


Here is the basic logic.

In the appController beforeFilter() method set the logged in user to the appModel class that you are fetching. Such as...
AppModel::setActiveUser($this->Auth->user());

Of course you will need to set up a static property in the AppModel. Such as...
public static $activeUser;
public static function setActiveUser($appUser){
self::$activeUser = $appUser;
}

Once you do this, any model that is based on multi-business logic, will have access to the current logged in user.

Now, in your Events model, you could add the following code... (or something similar)
function beforeFind($qd){
if(isset(parent::$activeUser['User']['business_id'])){
$qd['conditions'][] = array(
'Event.business_id '=> parent::$activeUser['User']['business_id']
 );
}
return $qd;
}


If you want to do a much simpler method...
You can simply add a condition to the paginate options in the controller index method.
$appUser = $this->Auth->user();
$this->paginate['conditions'][] = array('Event.business_id' => $appUser['User']['business_id']);

Happy Coding!

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/cake-php
Geoff Douglas | 1 Jan 08:42 2012
Picon

Re: How to "custom belongsto" in CakePHP 2?

BelongsTo is simply a left join, (on the retrieval side)...


I think what you are looking for is the Relationship conditions option. (Which will create the ON statement in SQL)

So what you want is something that looks like...

Radpostauth Model...

var $belongsTo = array(
'Wdevice' => array(
'className' => 'Wdevice',
'foreignKey' => false,
'conditions' => array(
 Wdevice.device_mac = radpostauth.username
)
);

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/cake-php
Geoff Douglas | 1 Jan 08:53 2012
Picon

Re: Year range 1991-2031

I am not sure if I understand your question exactly, but it looks like the date range for the select list allow for the dates that you need.



If this is the problem, then you can controller the date range by specifying a mindate, or maxdate in the Form select options 

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/cake-php
Daniel | 1 Jan 19:41 2012
Picon

How to add varied content in posts?

I see on some websites that there are user posts containing images,
links and code blocks.  What is a good way to add this kind of
functionality to an app?

--

-- 
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP
related questions.

To unsubscribe from this group, send email to
cake-php+unsubscribe@... For more options, visit this group
at http://groups.google.com/group/cake-php


Gmane