Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > HOWTO-Related Questions

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 21st May 2007, 17:11
Ghose Sumon Ghose Sumon is offline
Junior Member
 
Join Date: May 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How To ACCESS MySQL DATABASE FROM PHP CODE FOR SQUIRRELMAIL SERVER

Hi Everyone,

My Organization is currently using Squirrelmail server. Now We are having some requirement of adding some additional info to the existing MySql database but in separate table.Now we r trying to customise some part of the code but facing the database connectivity problem. we r not able to access the database from the PHP code using Mysql_connect() function as the current system hides the database n connects using some different configuration.so please anyone help us to solve this issue..if possible provide the code also for the same.

Thanking You,
Sumon Ghose
Reply With Quote
Sponsored Links
  #2  
Old 21st May 2007, 21:41
sjau sjau is offline
Local Meanie
 
Join Date: Apr 2006
Location: Switzerland
Posts: 1,146
Thanks: 4
Thanked 55 Times in 51 Posts
 
Default

Please do not use CAPITALS in the topic header. This is considered as shouting and it's not polite.

A very simple code snippet of accessing a mysql-db through php is this:

Code:
<?php

$username = ""; // Username for database here
$password = ""; // Password for database here
$db_host = "localhost"; // DB Server
$db_name =  ""; //name of your database here

// Connect to DB
mysql_connect("$db_host","$username","$password")
        or die("Unable to connect to SQL server!");
mysql_select_db("$db_name")
        or die("Unable to select database!");

?>
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to configure PHP with MySQL ???? lipp9000 Installation/Configuration 12 8th April 2010 14:39
Problems with Postfix Mysql Courier PatrickAdrichem Installation/Configuration 3 13th April 2007 15:44
virtual mail boxes setup satimis Server Operation 3 25th January 2007 18:32
ubuntu ispconfig joomla .htaccess steve1084 General 8 6th January 2007 15:55
PHP & MySQL working, but AREN'T WORKING???? lipp9000 Installation/Configuration 4 21st July 2006 17:01


All times are GMT +2. The time now is 09:26.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.