PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
i'm new to php and i'm currently working with some php codes. i'm trying to make a connection to mysql with the codes below but was given an error "Unknown MySQL server host 'DB_HOST' (11001)". if i replace $rst with "$rst = @mysql_connect("11.22.333.44", "username", "password");", it works fine. any help will be much appreciated. tia
db.conf probably did not load. You shouldn't leave your connection details in the open. .conf is not normally processed by php; if someone requests db.conf they will be able to see your connection information.
Also, since you are new to PHP, here's a few things: "<?" (and "<?=") shouldn't be used. Opt for "<?php" instead. Using constants for your database connection information is almost as bad as leaving them in the open. This is due to the inability to destroy constants. It is suggested to use variables (at most) which you can unset() after use.