php connecting to mysql

help!!!

Just teaching myself php and mysql I have a vb and msSql background

I have installed mysql and can connect to it though ODBC with user name and password blank

I have created a user called phpUser with the same password. I believe I have set permissions but I must have missed something but I can’t see

I have also written a php script but after priniting my name twice it does nothing I was hoping to see something from the Die statement. If anyone could point me in the right direction that would be greatly appreciated

thanks jasemilly

<?php print "Hello Web! jasemilly"; print "Hello Web! jasemilly"; $link = mysql_connect('localhost',phpUser,phpUser); print "Hello Web! jason2"; if (!$link) { die('Could not connect: ' . mysql_error()); } print "Hello Web! jason2"; echo 'Connected successfully'; mysql_close($link); ?>

mysql_connect(‘localhost’,‘phpUser’,‘phpUser’);

Username and Password must be in ’

hi have included the ’ but still getting the problem also wondering why the die statement isn’t displaying a message,
thanks

<?php $link = mysql_connect("localhost","phpUser","phpUser"); if (!$link) { die('Could not connect: ' . mysql_error()); } // some code mysql_close($like); ?>

Try that… Also, most people in php from what I understand use echo instead of print… May want to replace print with echo in the future :slight_smile:

I have changed the ’ to " and prints to echo, I have tried logging on with “” for both username and password I can attach to Mysql through odbc with these settings.

Is their a log in mysql I can check to see if mysql is at least getting the request?

I believe I have everything correct on php??

were should I look next??

thanks

I am using php5.2.2 what do I need to check exists in php.ini and which dll’s exist, I read that perhaps some dll’s aren’t included with this version of PHP out of the box, is this so?

thanks

Sponsor our Newsletter | Privacy Policy | Terms of Service