When I installed Moodle, I had to set it up with a completely different host than I usually use. To save a few bucks(I was just "testing" moodle, I use the MySql db on another, remote website.
I got moodle to work and I'm sold.
I'm trying to code some features to it but I can't get connected to the db in my usual method
My usual connect-to-db syntax is
>$server = "localhost"; // often localhost
>$username = "blah"; // your MySQL server username
>$password = "blah_blah"; // your MySQL server password
> $conn = mysql_connect($server,$username,$password) or die ("Could not connect MySQL"); }
$conn gets used in db queries like this
$sql13 = "INSERT INTO blah, blah values blah, blah
$result13 = @mysql_query($sql13, $conn) or die("Couldn't execute 'Update line 90' query ".$sql13);
One problem is that while $server is "localhost" when on the same server, coming in from a remote isn't connecting. I think I've tried every combo for a path I can think of so if someone has ideas on path syntax (there isn't much at php.net).
I couldn't figure out a workaround using moodle's config. I see it uses
$CFG->dbname $CFG->dbuser $CFG->dbpass to carry the path, but I couldn't find any place in the script where it inserts into the db to check the path used (I couldn't find anything like
$sql13 = "INSERT INTO blah, blah values blah, blah
$result13 = @mysql_query($sql13, $conn) or die("Couldn't execute 'Update line 90' query ".$sql13);
)
What kind of coding does Moodle use to connect to db
Thanks