Ok, so I am redoing Roboto's system for events listings, and I am running into a really weird issue. Basically, there are four files involved: db2.php, config2.php, backend.php and newadd.php. newadd is the one with the actual user interface. The following code is in it:
It all looks cool, right? So it calls addInfo, which is in backend.php:
db2.php has the following relevant stuff:
And config2.php is pretty basic:
The problem is, when I try to run it... Nothing happens. No error messages. No nothing. After some testing (mostly by adding random echo statements), I have determined that the call to newDbConn() isn't going through properly at all. Specificially, the call enters db2.php, but gets nowhere. At least, that is what I think is going on. Any ideas?
It all looks cool, right? So it calls addInfo, which is in backend.php:
function addInfo($date, $time, $ampm, $cost, $rawinfo, $ip)
{
$info = trim(addslashes(htmlentities($rawinfo)));
// get DB connection
$myConn = newDbConn();
$query = "INSERT INTO events (date, time, ampm, cost, info, ip)
VALUES ('$date', '$time', '$ampm', '$cost', '$info', '$ip')";
// Now let's try to insert it
$res = mysql_query($query);
if(!($res))
{
echo "DB Insert Error: " . mysql_error();
return 1;
}
echo "Event added.\n";
terminateConn($myConn);
}
db2.php has the following relevant stuff:
function newDbConn()
{
include ("config2.php");
$data = mysql_connect ($host, $username, $DBpass) or die ("Can't connect!");
mysql_select_db ($database, $data) or die ("Can't select DB: " . mysql_error());
return $data;
}
And config2.php is pretty basic:
The problem is, when I try to run it... Nothing happens. No error messages. No nothing. After some testing (mostly by adding random echo statements), I have determined that the call to newDbConn() isn't going through properly at all. Specificially, the call enters db2.php, but gets nowhere. At least, that is what I think is going on. Any ideas?
