Please solve this
am 25.01.2005 07:43:51 von kunal Aggarwal
------=_NextPart_000_0019_01C502D7.54E364E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Dear Friend,
This is Aggarwal Kunal.
Please guide me I have a problem which is as follow.
Suppose I have two servers.
On server A i am running mysql and on server B i have hosted PHP page.
then what should be the connection string and how to implement the
connection and handles database
Please solve this.
With regards
Kunal
------=_NextPart_000_0019_01C502D7.54E364E0--
Re: Please solve this
am 25.01.2005 14:06:36 von Daniel da Veiga
Dear friend,
You don't have a problem. :) Its common to have separated servers, and
you should refer to the manual for PHP, as MySQL has nothing to do
with the way you'll connect to it (except for privileges and user/host
configuration). Download the PHP manual and take a look at the syntax
for mysql_connect() function and for mysql_select_db().
After you connect, you use the queries (mysql_query function) to
handle your data the same way you do while dealing locally with the
database. Take a look at the MySQL functions for PHP (there is a whole
section for this at the manual) to see how you handle the data. If you
wanna use a database administrator, you must configure it (like
PhpMyAdmin for example) to connect to your remote host, and that is
pretty easy.
A small code as an example:
$db = mysql_connect("localhost", "root", "");
// You replace localhost for your server name or IP to make the
connection remote, not local
mysql_select_db("test", $db); //select database
if (!$db) {
echo("Could not connect: " . mysql_error()); //connection error
}
$query = "select * from person where name like '%".$name."%'";
$result = mysql_query($query);
if ( mysql_num_rows($result) > 0)
{
while ($data = mysql_fetch_assoc($result))
{
echo "First value: ".$data[0]." - Second value: ".$data[1];
}
}
?>
On Tue, 25 Jan 2005 12:13:51 +0530, Kunal Aggarwal wrote:
> Dear Friend,
>
> This is Aggarwal Kunal.
> Please guide me I have a problem which is as follow.
>
> Suppose I have two servers.
> On server A i am running mysql and on server B i have hosted PHP page.
>
> then what should be the connection string and how to implement the
> connection and handles database
>
> Please solve this.
>
> With regards
>
> Kunal
>
>
--
Daniel da Veiga
Computer Operator - RS - Brazil
--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org