Jump to content

kwilder

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kwilder's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Good suggestions. I'll try removing the blank values to allow the default values to be entered. It's just weird that it works on a Linux server presently as is. ???
  2. Sorry, here's the insert statement. INSERT INTO `status` (`status_id`, `company`, `attn`, `insured`, `claimant`, `company_file_number`, `date_loss`, `file_number`, `msg_1`, `msg_2`, `msg_3`, `msg_4`, `date_contact_letter`, `date_scheduled_inspection`, `vehicle_too_damaged`, `searching_parts`, `reaching_agreed_price_shop`, `additional_comments`, `app_id`, `current_date`, `appraisal_completion`, `second_status_date`) VALUES('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '12000', '', '', '')
  3. I'm trying to modify a PHP application built by other developers. I'm an ASP.NET guy but I know a little about PHP and MySql. The application has been working fine for years on a Linux box, but now for many reasons it has to move. I thinking of moving it to my Windows hosting servers, but there's a small issue. For the most part the application works, but Inserts on any table only partially work. Any database column that is marked NOT NULL and has a default value, is not defaulting to the value. An error is returned saying that it needs a value for this column. So the insert statements in the PHP code is already written without the columns that have "defaults" assigned in MySql, and it's these columns that are complaining that it needs a value. None of the php code has changed since I've moved it onto my Windows Server 2003 development server, so I'm thinking it has to be either the php.ini settings or something to do with the Windows box specifically. Does anyone know why default values for Inserts is not working? MySql 5.1.11 PHP 5.2.6.6 Thanks. Here's the sample insert setup code for one of the tables: var $status_id; var $company; var $attn; var $insured; var $claimant; var $company_file_number; var $date_loss; var $file_number; var $msg_1; var $msg_2; var $msg_3; var $msg_4; var $date_contact_letter; var $date_scheduled_inspection; var $vehicle_too_damaged; var $searching_parts; var $reaching_agreed_price_shop; var $date_expected_agreement; var $additional_comments; var $app_id; var $current_date; var $appraisal_completion; var $second_status_date; function add() { $fields = array("status_id", "company", "attn", "insured", "claimant", "company_file_number", "date_loss", "file_number", "msg_1", "msg_2", "msg_3", "msg_4", "date_contact_letter", "date_scheduled_inspection", "vehicle_too_damaged", "searching_parts", "reaching_agreed_price_shop", "additional_comments", "app_id", "current_date", "appraisal_completion", "second_status_date"); $values = array(addslashes($this->status_id), addslashes($this->company), addslashes($this->attn), addslashes($this->insured), addslashes($this->claimant), addslashes($this->company_file_number), addslashes($this->date_loss), addslashes($this->file_number), addslashes($this->msg_1), addslashes($this->msg_2), addslashes($this->msg_3), addslashes($this->msg_4), addslashes($this->date_contact_letter), addslashes($this->date_scheduled_inspection), addslashes($this->vehicle_too_damaged), addslashes($this->searching_parts), addslashes($this->reaching_agreed_price_shop), addslashes($this->additional_comments), addslashes($this->app_id), addslashes($this->current_date), addslashes($this->appraisal_completion), addslashes($this->second_status_date)); $new_data_obj = new data_obj; $new_data_obj->add_record($GLOBALS["db"], "status", $fields, $values); return; } These are the columns that are complaining about not being sent a value: status_id date_loss date_contact_letter date_scheduled_inspection vehicle_too_damaged searching_parts reaching_agreed_price_shop app_id current_date appraisal_completion second_status_date Here's the actual Add_record method: #adds a record to a table function add_record($db, $table, $fields, $values) { $new_error_obj = new error_obj; $new_data_obj = new data_obj; $link = $new_data_obj->connect(); if(!$link) $new_error_obj->error_page("(data_obj) Could not connect to the database"); mysql_select_db($db, $link) or $new_error_obj->error_page("(data_obj) The specified database could not be selected [$db]"); $insert_sql = "INSERT INTO `$table` ("; $flag = 0; foreach($fields as $field) { if ($flag == 0) { $insert_sql = $insert_sql . "`$field`"; $flag = 1; } Else { $insert_sql = $insert_sql . ", `$field`"; } } $insert_sql = $insert_sql . ") VALUES("; $flag = 0; foreach($values as $value) { if ($flag == 0) { $insert_sql = $insert_sql . "'" . $value . "'"; $flag = 1; } else { $insert_sql = $insert_sql . ", '" . $value . "'"; } } $insert_sql = $insert_sql . ")"; if (!mysql_query($insert_sql)) { $new_error_obj->error_page("(data_obj) The follwing SQL error occured: <p>" . mysql_error() . "</p><p>while trying to run this SQL statement:</p><p>$insert_sql</p>"); //mysql_close(); return "-1"; } else { // $result=mysql_query("select LAST_INSERT_ID();"); // $a_row = @mysql_fetch_array($result); $a_row = mysql_insert_id(); //mysql_close(); return $a_row; } }
  4. I'm not sure this is a PHP question or a MySql question. I'm working on a PHP application written by other developers meant for a Linux box. I'm working on it on a Windows Server 2003 box and while most of it works, it seems that any PHP form values that are omitted on an Insert which are intended for a NOT NULL column with a default value set, don't accept the default value. The PHP application returns an error, indicating a value must be passed in. Is this a PHP issue, a php.ini issue, a MySql issue or some weird thing using all this on a Windows Server box? Other PHP applications seem to work ok. But I don't know how they are handling NOT NULL columns with a default value. Any ideas? Thanks.
  5. I'm running on a Windows Vista Ultimate machine with IIS 7.0. Is it possible to install WAMP and skip over the Apache installation, or if not, uninstall it afterwards and have PHP, MySql and phpMyAdmin work with IIS 7? I need this to work with IIS since my web host is using IIS. Thanks, kwilder
  6. I've installed PHP via installer, and MySQL via installer and myPHPAdmin via unzip. PHP works when I run phpinfo(), and MySql works. I can create a database, tables and users via command-line. But I cannot get myPhpAdmin installed and when I try to run a simple database connection php script, I get nothing, no error, nothing. Does someone have a php.ini file configured for a Windows machine that they can send to me? Or if anyone has a solution to my problem I would be greatful. Also, are there any videos on the web that show instructions on installing on Windows machines for PHP, MySQL and phpMyAdmin? Thanks, kwilder
  7. Can someone show me a script example of how I can send mail when the mail server requires authentication? Thanks.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.