User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,588 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,677 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 3195 | Replies: 1
Reply
Join Date: Jan 2005
Posts: 1
Reputation: ringworm is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ringworm ringworm is offline Offline
Newbie Poster

connecting to DB

  #1  
Jan 10th, 2005
Sorry very new to PHP I am currently working through a book and I am working on connect to a DB I use this command:

$db = new mysqli('localhost', 'bookorama', 'bookorama123', 'books');

and I get this error

Fatal error: Class 'mysqli' not found in c:\Inetpub\wwwroot\mystuff\chap11\results.php on line 26

from what i understand mysqli is a comman command so i would of though the clas would be standard. I presume my config is wrong. please can someone help me where have I gone wrong
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Location: Fort Bragg, NC
Posts: 189
Reputation: mikeSQL is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 2
mikeSQL's Avatar
mikeSQL mikeSQL is offline Offline
Junior Poster

Solution Re: connecting to DB

  #2  
Jan 11th, 2005
I love this question, heres your answer below:
[PHP]<?php
$MySQL=mysql_connect("localhost","YOUR_USER","YOUR_PASS");
mysql_select_db("YOUR_DATABASE",$MySQL);
?>[/PHP]

Heres another Example:
[PHP]
$dbhost = "localhost"; // SQL Database Hostname
$dbuname = "mikemsql_theman"; // SQL Username
$dbpass = "imcool"; // SQL Password
$dbname = "mikesql_num1"; // SQL Database Name
$prefix = "profile"; // Your Database table's prefix
$user_prefix = "profile"; // Your Users' Database table's prefix (To share it)
$dbtype = "MySQL"; // Your Database Server type. Supported servers are:
// MySQL, mysql4, postgres, mssql, oracle, msaccess, db2 and mssql-odbc
// Be sure to write it exactly as above, case SeNsItIvE![/PHP]

I hope this will help. If you need further assistance, visit back here.
dynastyCODERS#1 when it comes to Programming Tutorials, Database designs and discussions, Operating Systems, you name it, check us out and drop us a line to tell us your opinions on any and everything in mind!;)
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 11:06 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC