Jump to content

Archived

This topic is now archived and is closed to further replies.

alkhatareykha

plz i have a strange error

Recommended Posts

good night

when i try to connect to my sql from php showing to me this error

FATAL ERROR mysql_connect undifined

i write my code like any one connect to mysql from php

$host="localhost";
$user="root";
$pass="";

$link=mysql_connect($host,$user,$pass) or die ('connection failed');

notice: i changed windows
changed mysql virgin
changed php virgin
please help me
send me at this email
ah_forislam@yahoo.com

Share this post


Link to post
Share on other sites
Do you get this type of error:
[b]Fatal error: Call to undefined function mysql_connect() in [path of script here] on line [line number here][/b]
if you do and you have PHP5 installed on a Windows server, have a read of [url=http://www.phpfreaks.com/forums/index.php/topic,95378.0.html]this FAQ[/url]

if you are on a *unix box you'll want to recompile PHP5 with the --with-mysql command option.

Share this post


Link to post
Share on other sites
Okay could you provide the following information:
1. What Operating System does your server run on
2. What is your server running, Apache or IIS

Also could you provide information about how you have setup PHP, and post here any tutorials you have followed to install PHP

Share this post


Link to post
Share on other sites
I have no experience with IIS, but this isnt the problem.

Could you post what you used to install PHP. Did you use the installer or the zipped bineries package? If you used the installer then that has a few files missing from it. Instead download the Zipped Bineries and extract the contents of the zip file to where you have installed PHP to, overwritting any existing files.

Also make sure PHP is using the correct php.ini file by creating a  file called info.php and add this init:
[code=php:0]<?php
phpinfo();
?>[/code]

Now run that file, look for the [b]Configuration File (php.ini) Path[/b]. Look to the right of that and it should state the full path to your php.ini. Is that path correct?

I dont know whether this applies to IIS, but when modify the php.ini restart the server.

Share this post


Link to post
Share on other sites
[quote author=alkhatareykha link=topic=103577.msg412518#msg412518 date=1155138536]
good night

when i try to connect to my sql from php showing to me this error

FATAL ERROR mysql_connect undifined

i write my code like any one connect to mysql from php

$host="localhost";
$user="root";
$pass="";

$link=mysql_connect($host,$user,$pass) or die ('connection failed');

notice: i changed windows
changed mysql virgin
changed php virgin
please help me
send me at this email
ah_forislam@yahoo.com
[/quote]

are you trying to connect to a database within MySQL? If so, you need:

[code]
$hostname = 'localhost';
$dbname = 'your_db_name_here';
$dbuser = 'root';
$dbpass = '';
[/code]

Also, what is the location that you are hosting from (e.g. paid hosting or hosting from home)?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.