Re: php PDO does not work [message #177287 is a reply to message #177285] |
Sun, 04 March 2012 01:08 |
test japan
Messages: 2 Registered: March 2012
Karma:
|
Junior Member |
|
|
thanks for your help!
On Sunday, March 4, 2012 1:59:26 AM UTC+8, Jerry Stuckle wrote:
> On 3/3/2012 10:10 AM, test japan wrote:
>> i installed php and mysql on archlinux by pacman,
>> and in phpinfo page, i can see the infomation about mysql& pdo_mysql
>>
>> in php.ini, i uncommented the following lines:
>> extension=mysqli.so
>> extension=mysql.so
>> extension=pdo_mysql.so
>>
>> but when running the code below, the browser shows a blank page
>> no result, even no error message.
>>
>> try {
>> $dbh = new PDO("mysql:host=192.168.0.1;dbname=testdb", "username", "password");
>> echo 'Connected to database!!';
>> } catch (PDOException ex) {
>> echo $ex->getMessage();
>>
>>
>> anyone can help me?
>> thanks!
>
> On your development system, enable error reporting and display the
> errors. In your php.ini file you should have:
>
> error_reporting = E_ALL
> display_errors = on
>
> Note you do NOT want to have display_errors=on in a production
> environment, and should log the errors instead.
>
> Once you fix the syntax error(s) (Luuk found one - don't know if you
> have any others), you shouldn't get a blank page.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstucklex(at)attglobal(dot)net
> ==================
On Sunday, March 4, 2012 1:59:26 AM UTC+8, Jerry Stuckle wrote:
> On 3/3/2012 10:10 AM, test japan wrote:
>> i installed php and mysql on archlinux by pacman,
>> and in phpinfo page, i can see the infomation about mysql& pdo_mysql
>>
>> in php.ini, i uncommented the following lines:
>> extension=mysqli.so
>> extension=mysql.so
>> extension=pdo_mysql.so
>>
>> but when running the code below, the browser shows a blank page
>> no result, even no error message.
>>
>> try {
>> $dbh = new PDO("mysql:host=192.168.0.1;dbname=testdb", "username", "password");
>> echo 'Connected to database!!';
>> } catch (PDOException ex) {
>> echo $ex->getMessage();
>>
>>
>> anyone can help me?
>> thanks!
>
> On your development system, enable error reporting and display the
> errors. In your php.ini file you should have:
>
> error_reporting = E_ALL
> display_errors = on
>
> Note you do NOT want to have display_errors=on in a production
> environment, and should log the errors instead.
>
> Once you fix the syntax error(s) (Luuk found one - don't know if you
> have any others), you shouldn't get a blank page.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstucklex(at)attglobal(dot)net
> ==================
|
|
|