Re: SQL Function works in 5.0, not 4.4.1
- From: Dikkie Dik <nospam@xxxxxxxxxx>
- Date: Fri, 30 Dec 2005 23:22:43 +0100
After calling the mysql_query function, you can call the mysql_errno and/or mysql_error to see what errors are returned by the database server. Personally, I log all errors: storing them in an errorlog table or (if there is no database connection) sending them by e-mail.
Best regards
byrd.48@xxxxxxxxxxxxxx wrote:
Hi, I have the following functions which work on my home server (IIS 5.0, PHP5.1, MySQL 5) but not on the production server (Linux Apache Zend, PHP 4.4.1, MySQL 4.1.13). From what I can see, I'm connecting to the database, but the sql passed to it is not working on the prod server. Any help would be much appreciated, I'm a newbie from .NET. It may be difficult to read from the code below, but when I'm inserting the variables into the sql string, I'm using double quotes then single quotes as in:
' INSERT INTO ... " ' . $VARIABLE . ' "
Thank you in advance.
Jon
// test.php include('users4x.php'); $users = new users(); $users->User_InsertNew('Jon', 'byrd', 'jb@xxxxxxxxxx', 'byrd', '0');
// users4x.php class users{
function User_InsertNew($UserFirstName, $UserLastName, $UserEmail, $UserPassword,$ActInact){ global $dbuser, $dbuserpass, $dbserver, $db; $sql='INSERT INTO `Users`(`UserFirstName`, `UserLastName`, `UserEmail`, `UserPassword`, `ActInact`) VALUES("'.$UserFirstName.'","'.$UserLastName.'","'.$UserEmail.'","'.$UserPassword.'","'.$ActInact.'");'; $connection = mysql_connect($dbserver, $dbuser, $dbuserpass) or die ("Could not connect to server"); $catalog = mysql_select_db($db); $result = mysql_query($sql); mysql_close(); }
}
.
- References:
- SQL Function works in 5.0, not 4.4.1
- From: byrd . 48
- SQL Function works in 5.0, not 4.4.1
- Prev by Date: Late Christmas present for some ng posters
- Next by Date: Re: SQL Function works in 5.0, not 4.4.1
- Previous by thread: SQL Function works in 5.0, not 4.4.1
- Next by thread: Re: SQL Function works in 5.0, not 4.4.1
- Index(es):