Hi folks.
I have a php/mysql problem I hope you can help with.
I am trying to connect to a database to pass some values to a mysql database. The problem sits with my function making a connection.
This may have something to do with global variables but I can’t seem to make it work.
Here is the code for the funtion…
function insert_handicap_event( ) {
include_once("Connections/conn.php");
mysql_select_db($database_conn, $conn);
$query = "CALL insert_handicap_event('$event_date', '$league)";
$do_query = mysql_query($query, $conn) or die(mysql_error());
}
here is conn.php
$hostname_conn = "localhost";
$database_conn = "arb";
$username_conn = "root";
$password_conn = "";
$conn = mysql_pconnect($hostname_conn, $username_conn, $password_conn) or trigger_error(mysql_error(),E_USER_ERROR);
I am getting the following errors echoed out to the screen.
Notice: Undefined variable: database_conn in C:\wamp\www\functions.php on line 164
Notice: Undefined variable: conn in C:\wamp\www\functions.php on line 164
Warning: mysql_select_db() expects parameter 2 to be resource, null given in C:\wamp\www\functions.php on line 164
Notice: Undefined variable: arb_conn in C:\wamp\www\functions.php on line 166
Warning: mysql_query() expects parameter 2 to be resource, null given in C:\wamp\www\functions.php on line 166
Can anyone shed any light on what I should try please?
Thanks in advance.