alkhatareykha Posted August 9, 2006 Share Posted August 9, 2006 good night when i try to connect to my sql from php showing to me this errorFATAL 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 windowschanged mysql virginchanged php virgin please help mesend me at this email ah_forislam@yahoo.com Quote Link to comment https://forums.phpfreaks.com/topic/17030-plz-i-have-a-strange-error/ Share on other sites More sharing options...
wildteen88 Posted August 9, 2006 Share Posted August 9, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/17030-plz-i-have-a-strange-error/#findComment-71872 Share on other sites More sharing options...
alkhatareykha Posted August 10, 2006 Author Share Posted August 10, 2006 thank u man i will tray it now thanks alot Quote Link to comment https://forums.phpfreaks.com/topic/17030-plz-i-have-a-strange-error/#findComment-72433 Share on other sites More sharing options...
alkhatareykha Posted August 10, 2006 Author Share Posted August 10, 2006 i traied as u told me but didn,t work please send me Quote Link to comment https://forums.phpfreaks.com/topic/17030-plz-i-have-a-strange-error/#findComment-72562 Share on other sites More sharing options...
wildteen88 Posted August 10, 2006 Share Posted August 10, 2006 Okay could you provide the following information:1. What Operating System does your server run on2. What is your server running, Apache or IISAlso could you provide information about how you have setup PHP, and post here any tutorials you have followed to install PHP Quote Link to comment https://forums.phpfreaks.com/topic/17030-plz-i-have-a-strange-error/#findComment-72573 Share on other sites More sharing options...
alkhatareykha Posted August 10, 2006 Author Share Posted August 10, 2006 i,m working at windows xp sp1iis 4php5mysql 5please send me Quote Link to comment https://forums.phpfreaks.com/topic/17030-plz-i-have-a-strange-error/#findComment-72576 Share on other sites More sharing options...
wildteen88 Posted August 10, 2006 Share Posted August 10, 2006 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]<?phpphpinfo();?>[/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. Quote Link to comment https://forums.phpfreaks.com/topic/17030-plz-i-have-a-strange-error/#findComment-72590 Share on other sites More sharing options...
xAtlas Posted August 11, 2006 Share Posted August 11, 2006 [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 errorFATAL 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 windowschanged mysql virginchanged php virgin please help mesend 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)? Quote Link to comment https://forums.phpfreaks.com/topic/17030-plz-i-have-a-strange-error/#findComment-73318 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.