From: "Frank Tudor" <[EMAIL PROTECTED]> > The problem I am having is that when I try to pass values to the > database the php fails. > > I think I have singled it down to the connection string but I am > not sure. [snip] > function db_connect() { > global $dbhost, $dbusername, $dbuserpassword, > $default_dbname; > global $MYSQL_ERRNO, $MYSQL_ERROR; > > $link_id = mysql_connect($dbhost, $dbusername, > $dbuserpassword); > if(!$link_id) { > $MYSQL_ERRNO = 0; > $MYSQL_ERROR = "Connection failed to the host $dbhost."; > return 0; > } > else if(empty($dbname) && !mysql_select_db($default_dbname)) > { > $MYSQL_ERRNO = mysql_errno(); > $MYSQL_ERROR = mysql_error(); > return 0; > } > else return $link_id; > } > > function sql_error() { > global $MYSQL_ERRNO, $MYSQL_ERROR; > > if(empty($MYSQL_ERROR)) { > $MYSQL_ERRNO = mysql_errno(); > $MYSQL_ERROR = mysql_error(); > } > return "$MYSQL_ERRNO: $MYSQL_ERROR"; > } > ?> > > My php sample code::::::: > > <?php > //db_connect.php > include "common_db.inc"; > error_reporting(0);
Take this out or set it to E_ALL while debugging. > $link_id = db_connect(); > if(!$link_id) die(sql_error()); Use $link_id = db_connect() or die(sql_error()); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php