PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 14th, 2004, 09:55 AM
turing turing is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 1 turing User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
pear db::connect problem

I have successfully installed pear but it is not connecting to my mysql database and it is not giving an error.
The first script doesnt go beyond DB::Connect and doesnt display hello 1.
The second script(pure php) displays both hello1 and results of the query.
what could be the problem

<?php
require_once 'DB.php';
$uname = 'root';
$hostn = 'localhost';
$db_name = 'employees';
$connection ="mysql://$uname:@$hostn/$db_name";
$db =& DB::connect($connection);
echo "hello1";
if (DB::isError($db))
{ echo $db->getDebugInfo();
}
echo "hello2";
?>

<?php
$uname = "root";
$hostn = "localhost";
$db_name = "employees";
$db = mysql_connect($hostn,$uname);
mysql_select_db($db_name,$db);
$result = mysql_query("SELECT * FROM employees",$db);
echo "hello1\n";
printf("First Name: %s<br>\n", mysql_result($result,0,"first"));
printf("Last Name: %s<br>\n", mysql_result($result,0,"last"));
printf("Address: %s<br>\n", mysql_result($result,0,"address"));
printf("Position: %s<br>\n", mysql_result($result,0,"position"));
?>

Reply With Quote
  #2  
Old January 9th, 2005, 02:10 PM
marianna marianna is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 1 marianna User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile same problem

I have the same problem... Did you resolve it? thanks

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > pear db::connect problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT