473,406 Members | 2,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Query on MSQL

Im trying to use the mysql_connect command to connect to the mysql
server from a php file.

What is the HOST name I should use?

The tutorial book I have uses "localhost" but Im installing the file
live on the internet, not on a local host machine on pc.

(There are 3 parameters given --- hostname, username, userpassword.).

thank you for any help.

May 16 '06 #1
11 1503
re**************@yahoo.co.in wrote:
Im trying to use the mysql_connect command to connect to the mysql
server from a php file.

What is the HOST name I should use?


Usually it is localhost. If it is something else, it is something like
server.address.com or 192.168.0.1. But if your service provider didn't
provide you any host address, then it is most likely localhost. If it
isn't, then we have no way knowing what it is and you need to ask that
from your service provider.
May 16 '06 #2
re**************@yahoo.co.in wrote:
Im trying to use the mysql_connect command to connect to the mysql
server from a php file.

What is the HOST name I should use?


Oh, and in case that wasn't obvious to you, the host name is the address
of the machine where MySQL server is running (as you might know you can
contact to server that is located on another computer than where your
php script is running).
May 16 '06 #3
re**************@yahoo.co.in wrote:
Im trying to use the mysql_connect command to connect to the mysql
server from a php file.

What is the HOST name I should use?

The tutorial book I have uses "localhost" but Im installing the file
live on the internet, not on a local host machine on pc.


Use the hostname (or IP address) of the host running MySQL.

If MySQL and your PHP scripts run on the same host, you can use the
conventional alias "localhost".

The alias "localhost" means the same host which is initiating the
connection. Not necessarily the host that is local to _you_.

Regards,
Bill K.
May 16 '06 #4
Thank you.

Ive tried 'localhost' and the address of the web site. The php program
still comes up with message "cant connect to server"

you cant write a meaningfull php program wo access to mysql.

May 16 '06 #5
re**************@yahoo.co.in wrote:
Im trying to use the mysql_connect command to connect to the mysql
server from a php file.


Are you sure that there even is a mysql server? Where did you find out
that there is one and what the username and password and database name
are for it? The page/mail that claims there is one, should have more
info about what parameters to use to connect it.
May 16 '06 #6
:-0)

well I setup the database myself -- thats kind of how I know the
username password.

Not sure what variable to put for parameter "host".

Much more difficult to work in isolation than as a member of a team.

May 16 '06 #7
re**************@yahoo.co.in wrote:
Ive tried 'localhost' and the address of the web site. The php program
still comes up with message "cant connect to server"


I agree with Aggro -- find out from whomever manages the server host in
question if MySQL is actually running. This is the first
troubleshooting step.

Regards,
Bill K.
May 16 '06 #8
re**************@yahoo.co.in wrote:
well I setup the database myself -- thats kind of how I know the
username password.

Not sure what variable to put for parameter "host".


In that case you should know the answer. Is the database server and php
files on the same computer or on two different computers?
May 17 '06 #9
problem sorted. Problem with programming is usually the manual is
arcane, and you can go round and round for hours trying to sort a
simple problem -- easier to get help from your peers :0==)

May 18 '06 #10
re**************@yahoo.co.in wrote:
problem sorted. Problem with programming is usually the manual is
arcane, and you can go round and round for hours trying to sort a
simple problem -- easier to get help from your peers :0==)


I'm curious, what was wrong and what was the solution?
May 18 '06 #11
I was using the username for the php server rather than the username
for the mysql server. You can spend hours and hours going round a
problem like this.

May 19 '06 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: jaysonsch | last post by:
Hello! I am having some problems with a database query that I am trying to do. I am trying to develop a way to search a database for an entry and then edit the existing values. Upon submit, the...
29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
9
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only, discarding the product code - I use...
3
by: Harvey | last post by:
Hi, I try to write an asp query form that lets client search any text-string and display all pages in my web server that contain the text. I have IIS 6.0 on a server 2003. The MSDN site says...
4
by: Diamondback | last post by:
I have two tables, WIDGETS and VERSIONS. The WIDGETS table has descriptive information about the widgets while the VERSIONS table contains IDs relating to different iterations of those widgets...
2
by: SheryMich | last post by:
Hi - I am having a bit of a problem with the insert into a database. When I go to insert a record into an un-keyed, single table Access database, I get the aforementioned ''Operation Must Use an...
0
by: anthony | last post by:
Hi. I am attempting to get msql3 installed with php. Using php version php5.1-200604070430 and msql-3.7. I am getting the following error on compile. ...
0
by: MatchSQL | last post by:
When we want to save the database schema and SQL statement , we use the backup of SQLServer provide, but it always content the running data, now a new tool named MatchSQL, it can just save...
1
by: ABITECH | last post by:
hi guys I am working on a project in databases using the wamp software. So how do i connect msql to php. Pliz help mi Because i badly nid the code for my project. bye
2
by: chazzy69 | last post by:
Ok this may seem a little strange but what i Im trying to add an altered version of information already stored in my database. Basically i have a colum that has strings of numbers and characters,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.