Jump to content

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
Link to comment
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.
Link to comment
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
Link to comment
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.
Link to comment
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)?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.