ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
@ $db = msql_pconnect("localhost", "root", "password");
if(!$db) {
echo "Error: could not connect to the msql database<br>";
exit;
}
echo "connection to the database was a success<br>";
?>
i know i shouldnt use the root for access to mysql, this is only to see if i can get a connection. i get no errors just a blank page. is this something in my configuring of LAMP or my programming. thanks
i was just wondering, i use slackware 9.0 do i have to open any ports for this. i use mysql and apache that came with the slack install cd. i dont know why i use the @ before i connect the dastabase but i get an error that php does not recognise the function if i dont use it. my ip address of my comp is assisgned through dhcp from my router. if that helps. thanks
I don't know if this will help but this is the function that I use to open our mysql database:
<?php
function opendatabase(){
global $connection;
$connection = mysql_connect("localhost", "uniforms", "password" or die(mysql_error());
mysql_select_db("siegels", $connection) or die(mysql_error());
}
?>
thanks i got it working and i dont understand why? i used your code
$connection = mysql_connect("localhost", "uniforms", "password") or die(mysql_error());
it worked with the or die(mysql_error()); at the end of the connection function, and i dont know why thanks for helping me patpawlowski. if anyone knows why this is could you share it with me.
yeah i found the answer and its simple as. i feel like the newest newbie of newbies from newbieville. it was a simple syntax error. i spent 3 days looking for the answer doing alot of reading (which wasnt a waste of time) looking for some config problem. sorry for wasting space on your server / with such a simple question
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.