Xaamp on windows server

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Xaamp on windows server

Postby xjmf » 27. March 2013 17:17

Hi..
I can access Mysql database and table using php script... but I cannot insert data into the table ....
Code: Select all
<?php
/*



{ // Connect and Test MySQL and specific DB (return $dbSuccess = T/F) 

//    Execute code ONLY if connections were successful    
if ($dbSuccess) {
   
      
      $company_SQLinsert = "INSERT INTO tCompany ( ";
      // $company_SQLinsert .=  "ID, ";
      $company_SQLinsert .=  "preName, ";
      $company_SQLinsert .=  "Name, ";
      $company_SQLinsert .=  "RegType, ";
      $company_SQLinsert .=  "StreetA, ";
      $company_SQLinsert .=  "StreetB, ";
      $company_SQLinsert .=  "StreetC, ";
      $company_SQLinsert .=  "Town, ";
      $company_SQLinsert .=  "County, ";
      $company_SQLinsert .=  "Postcode, ";
      $company_SQLinsert .=  "COUNTRY ";
      $company_SQLinsert .=  ") ";
      
      $company_SQLinsert .=  "VALUES ";
      
      { // insert Pie Company
         $company_SQLinsert .=  "(";
         //$company_SQLinsert .=  "'<autoincremented ID value>', ";
         $company_SQLinsert .=  "'The', ";
         $company_SQLinsert .=  "'Pie Company', ";
         $company_SQLinsert .=  "'', ";
         $company_SQLinsert .=  "'89 Gravy Road', ";
         $company_SQLinsert .=  "'', ";
         $company_SQLinsert .=  "'', ";
         $company_SQLinsert .=  "'Pastryville', ";
         $company_SQLinsert .=  "'NSW', ";
         $company_SQLinsert .=  "'1297', ";
         $company_SQLinsert .=  "'Australia' ";
         $company_SQLinsert .=  "), ";
      }

      { // insert TMIT       
         $company_SQLinsert .=  "(";
         //$company_SQLinsert .=  "'<autoincremented ID value>', ";
         $company_SQLinsert .=  "'', ";
         $company_SQLinsert .=  "'TMIT World', ";
         $company_SQLinsert .=  "'Limited', ";
         $company_SQLinsert .=  "'42 Lily Close', ";
         $company_SQLinsert .=  "'', ";
         $company_SQLinsert .=  "'', ";
         $company_SQLinsert .=  "'Bicester', ";
         $company_SQLinsert .=  "'Oxfordshire', ";
         $company_SQLinsert .=  "'OX26 3EJ', ";
         $company_SQLinsert .=  "'UK' ";
         $company_SQLinsert .=  "), ";
      }

      { // insert JACASTA       
         $company_SQLinsert .=  "(";
         //$company_SQLinsert .=  "'<autoincremented ID value>', ";
         $company_SQLinsert .=  "'', ";
         $company_SQLinsert .=  "'JACASTA', ";
         $company_SQLinsert .=  "'Limited', ";
         $company_SQLinsert .=  "'42 Lily Close', ";
         $company_SQLinsert .=  "'', ";
         $company_SQLinsert .=  "'', ";
         $company_SQLinsert .=  "'Bicester', ";
         $company_SQLinsert .=  "'Oxfordshire', ";
         $company_SQLinsert .=  "'OX26 3EJ', ";
         $company_SQLinsert .=  "'UK' ";
         $company_SQLinsert .=  ") ";
      }
      
      
      if (mysql_query($company_SQLinsert))  {   
         echo "INSERT INTO tCompany - SUCCESSFUL.<br /><br />";
      } else {
         echo "INSERT INTO tCompany - FAILED.<br /><br />";
      }




I get INSERT INTO tCompany - FAILED.... and no other error..
Thanks John

[edit by Altrea: added code-BBCode tags around php code]
xjmf
 
Posts: 3
Joined: 27. March 2013 16:32
XAMPP Version: 5.6.3
Operating System: XP;Vista;Windows 7

Re: Xaamp on windows server

Postby Altrea » 27. March 2013 17:57

Hi John,

xjmf wrote:I get INSERT INTO tCompany - FAILED.... and no other error..

Well, if you don't use the mysql_error() function, you will not get any helpful error messages.
Another good idea would be to echo out the full sql Statement.

best wishes,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 6490
Joined: 17. August 2009 13:05
XAMPP Version: 5.5.19
Operating System: W7Ux64

Re: Xaamp on windows server

Postby xjmf » 28. March 2013 15:01

Thanks for your reply... but any help on why the database will not insert the data into the fields..
xjmf
 
Posts: 3
Joined: 27. March 2013 16:32
XAMPP Version: 5.6.3
Operating System: XP;Vista;Windows 7

Re: Xaamp on windows server

Postby Altrea » 28. March 2013 16:17

xjmf wrote:Thanks for your reply... but any help on why the database will not insert the data into the fields..

How should i know why the database will not insert the data?
The only information i have is the pre-processed code which should build the sql query.

It is a script issue. It is YOUR script. Start debugging! I have told your which the next steps would be.

If you would really want that we do the debugging for you (which is not the support area of this board here), you have to give us everything which is needed to rebuild a test environment. That includes the Database Schema in sql Syntax, the Database Connection user with permission information, the full script, full information about the server configuration (Apache, MySQL and PHP), information about how the script will get executed (Request and Response), etc. Maybe (!!) then someone here will be willing to do the debugging work for you.

best wishes,
Altrea
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 6490
Joined: 17. August 2009 13:05
XAMPP Version: 5.5.19
Operating System: W7Ux64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 67 guests