• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

POST SUCCESS BUT NO DATA IN DB

New Here ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

Hi guys, please assist me, I am posting to the database from my website and the success message and page is showing, however when I look into the database nothing shows, what could be the matter!? 

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , May 07, 2020 May 07, 2020

Pretty much all of it must be replaced.  You can't mix old MySQL with new MySQLi (improved) and expect it to work.  I'm sorry.  But the whole app must be re-built with modern code.

 

Look at the WebAssist extension.  It works much like the old server-behavior panels but the code is modern.

http://www.webassist.com/product/mysqli

 

Votes

Translate

Translate
LEGEND , May 08, 2020 May 08, 2020

I'm not providing all of the solution but a streamlined one so you get the idea when using mysqli (I've set down to 'eMail'  in the $_POST[] array list).

 

1. Add the name attribute 'insert' to your form button:
<input type="submit" name="insert" value="Insert">

 

2. Connect to your database: (use your connection details):

<?php $conn = new mysqli('hostServerName' , 'username' , 'password' , 'databaseName');?>

 

3. Insert the form data into your database.

 

<?php
// Insert form data IF the form submit butt

...

Votes

Translate

Translate
Community Expert ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

Without seeing the script we can only guess.  But what I would assume is happening is that your script is testing true but in fact, there is an error in your db query thus the DB query is failing, but the script is getting a result of true passed to it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

yes indeed you are right, sorry about that, i realise my page is not passing the error to the user, instead it goes straight to the success page but does not actually load the data onto the database, this error all started when i had to switched to mysqi and had to use trigger-error,  because i loaded onto my live server and it kept refusing to continue  until i replaced mysqli_error() with trigger-error, here is the code below, please assist??

 

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "borrower_reg")) {
$MemberID = $_POST['whatever2'];
$insertSQL = sprintf("INSERT INTO borrower (Member_ID, Title, FName, LName, Identity_No, Date_Of_Birth, Nationality, Citizenship, Cell, Email, Dependants, Gender, Marital_Status, Spouse, M_Date, M_Place, M_Regime, S_Employer, S_Occupation, S_Workno, Residential, Postal, Employer, Emp_Address, Position, Emp_Since, Salary, Salary_Date, Emp_Tel, Emp_Type, Bank_Name, Account_Name, Account_Number, Account_Type, Branch_Name, Branch_Code, Password, RFName, RLName, RFAddress, RContact, RRelationsip) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['whatever2'], "text"),
GetSQLValueString($_POST['Title'], "text"),
GetSQLValueString($_POST['FName'], "text"),
GetSQLValueString($_POST['LName'], "text"),
GetSQLValueString($_POST['Identity_No'], "text"),
GetSQLValueString($_POST['Date_Of_Birth'], "date"),
GetSQLValueString($_POST['Nationality'], "text"),
GetSQLValueString($_POST['Citizenship'], "text"),
GetSQLValueString($_POST['Cell'], "text"),
GetSQLValueString($_POST['eMail'], "text"),
GetSQLValueString($_POST['Dependants'], "int"),
GetSQLValueString($_POST['Gender'], "text"),
GetSQLValueString($_POST['Marital'], "text"),
GetSQLValueString($_POST['SpouseName'], "text"),
GetSQLValueString($_POST['M_Date'], "date"),
GetSQLValueString($_POST['M_Place'], "text"),
GetSQLValueString($_POST['M_Regime'], "text"),
GetSQLValueString($_POST['S_Employer'], "text"),
GetSQLValueString($_POST['S_Occupation'], "text"),
GetSQLValueString($_POST['SWorkno'], "text"),
GetSQLValueString($_POST['Residential'], "text"),
GetSQLValueString($_POST['Postal'], "text"),
GetSQLValueString($_POST['employer'], "text"),
GetSQLValueString($_POST['emp_address'], "text"),
GetSQLValueString($_POST['position'], "text"),
GetSQLValueString($_POST['emp_since'], "date"),
GetSQLValueString($_POST['Salary'], "text"),
GetSQLValueString($_POST['salary_date'], "text"),
GetSQLValueString($_POST['emp_tel'], "text"),
GetSQLValueString($_POST['Emp_Type'], "text"),
GetSQLValueString($_POST['Bank_Name'], "text"),
GetSQLValueString($_POST['Account_Name'], "text"),
GetSQLValueString($_POST['Account_Number'], "text"),
GetSQLValueString($_POST['Account_Type'], "text"),
GetSQLValueString($_POST['Branch_Name'], "text"),
GetSQLValueString($_POST['Branch_Code'], "text"),
GetSQLValueString($_POST['psw'], "text"),
GetSQLValueString($_POST['RFName'], "text"),
GetSQLValueString($_POST['RLName'], "text"),
GetSQLValueString($_POST['RAddress'], "text"),
GetSQLValueString($_POST['RContact'], "text"),
GetSQLValueString($_POST['RRelationship'], "text"));

mysqli_select_db(dbconnect(), $database_connection1);
$Result1 = mysqli_query(dbconnect(), $insertSQL) or trigger_error(dbconnect()->error."[$insertSQL]");

header(sprintf("Location:to.php?whatever2= $MemberID"));}

?>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

It's impossible to say where your failure is occuring without some error reporting.

Did you create the update script yourself?

 

 

Nancy O'Shea— Product User, Community Expert & Moderator

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

yes i did, i realise my page is not passing the error to the user, instead it goes straight to the success page but does not actually load the data onto the database, this error all started when i had to switched to mysqi and had to use trigger-error,  because i loaded onto my live server and it kept refusing to continue  until i replaced mysqli_error() with trigger-error, here is the code below, please assist??

 

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "borrower_reg")) {
$MemberID = $_POST['whatever2'];
$insertSQL = sprintf("INSERT INTO borrower (Member_ID, Title, FName, LName, Identity_No, Date_Of_Birth, Nationality, Citizenship, Cell, Email, Dependants, Gender, Marital_Status, Spouse, M_Date, M_Place, M_Regime, S_Employer, S_Occupation, S_Workno, Residential, Postal, Employer, Emp_Address, Position, Emp_Since, Salary, Salary_Date, Emp_Tel, Emp_Type, Bank_Name, Account_Name, Account_Number, Account_Type, Branch_Name, Branch_Code, Password, RFName, RLName, RFAddress, RContact, RRelationsip) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['whatever2'], "text"),
GetSQLValueString($_POST['Title'], "text"),
GetSQLValueString($_POST['FName'], "text"),
GetSQLValueString($_POST['LName'], "text"),
GetSQLValueString($_POST['Identity_No'], "text"),
GetSQLValueString($_POST['Date_Of_Birth'], "date"),
GetSQLValueString($_POST['Nationality'], "text"),
GetSQLValueString($_POST['Citizenship'], "text"),
GetSQLValueString($_POST['Cell'], "text"),
GetSQLValueString($_POST['eMail'], "text"),
GetSQLValueString($_POST['Dependants'], "int"),
GetSQLValueString($_POST['Gender'], "text"),
GetSQLValueString($_POST['Marital'], "text"),
GetSQLValueString($_POST['SpouseName'], "text"),
GetSQLValueString($_POST['M_Date'], "date"),
GetSQLValueString($_POST['M_Place'], "text"),
GetSQLValueString($_POST['M_Regime'], "text"),
GetSQLValueString($_POST['S_Employer'], "text"),
GetSQLValueString($_POST['S_Occupation'], "text"),
GetSQLValueString($_POST['SWorkno'], "text"),
GetSQLValueString($_POST['Residential'], "text"),
GetSQLValueString($_POST['Postal'], "text"),
GetSQLValueString($_POST['employer'], "text"),
GetSQLValueString($_POST['emp_address'], "text"),
GetSQLValueString($_POST['position'], "text"),
GetSQLValueString($_POST['emp_since'], "date"),
GetSQLValueString($_POST['Salary'], "text"),
GetSQLValueString($_POST['salary_date'], "text"),
GetSQLValueString($_POST['emp_tel'], "text"),
GetSQLValueString($_POST['Emp_Type'], "text"),
GetSQLValueString($_POST['Bank_Name'], "text"),
GetSQLValueString($_POST['Account_Name'], "text"),
GetSQLValueString($_POST['Account_Number'], "text"),
GetSQLValueString($_POST['Account_Type'], "text"),
GetSQLValueString($_POST['Branch_Name'], "text"),
GetSQLValueString($_POST['Branch_Code'], "text"),
GetSQLValueString($_POST['psw'], "text"),
GetSQLValueString($_POST['RFName'], "text"),
GetSQLValueString($_POST['RLName'], "text"),
GetSQLValueString($_POST['RAddress'], "text"),
GetSQLValueString($_POST['RContact'], "text"),
GetSQLValueString($_POST['RRelationship'], "text"));

mysqli_select_db(dbconnect(), $database_connection1);
$Result1 = mysqli_query(dbconnect(), $insertSQL) or trigger_error(dbconnect()->error."[$insertSQL]");

header(sprintf("Location:to.php?whatever2= $MemberID"));}

?>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

'this error all started when i had to switched to mysqi'

 

That code wont work with mysqli - its old outdated Deamweaver code, which you can't mix in with the new mysqli

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

which line of code exactly if i may ask?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

Pretty much all of it must be replaced.  You can't mix old MySQL with new MySQLi (improved) and expect it to work.  I'm sorry.  But the whole app must be re-built with modern code.

 

Look at the WebAssist extension.  It works much like the old server-behavior panels but the code is modern.

http://www.webassist.com/product/mysqli

 

Nancy O'Shea— Product User, Community Expert & Moderator

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

Alright thanks, let me look into it

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 08, 2020 May 08, 2020

Copy link to clipboard

Copied

LATEST

I'm not providing all of the solution but a streamlined one so you get the idea when using mysqli (I've set down to 'eMail'  in the $_POST[] array list).

 

1. Add the name attribute 'insert' to your form button:
<input type="submit" name="insert" value="Insert">

 

2. Connect to your database: (use your connection details):

<?php $conn = new mysqli('hostServerName' , 'username' , 'password' , 'databaseName');?>

 

3. Insert the form data into your database.

 

<?php
// Insert form data IF the form submit button with the name of 'insert' is clicked
if(isset($_POST['insert'])) {
$MemberID = $conn->real_escape_string($_POST['whatever2']);
$title = $conn->real_escape_string($_POST['Title']);
$fname = $conn->real_escape_string($_POST['FName']);

$lname = $conn->real_escape_string($_POST['LName']);

$identityNumber = $conn->real_escape_string($_POST['Identity_Number']);

$dateOfBirth = $conn->real_escape_string($_POST['Date_Of_Birth']);

$nationality = $conn->real_escape_string($_POST['Nationality']);

$citizenship = $conn->real_escape_string($_POST['Citizenship']);

$cell = $conn->real_escape_string($_POST['Cell']);

$eMail = $conn->real_escape_string($_POST['eMail]);

$conn->query("INSERT INTO borrower
(Member_Id, Title, FName, LName, Identity_Number, Date_Of_Birth, Nationality, Citizenship, Cell, eMail)
VALUES
('$MemberID', '$title', '$fname', '$lname', '$identityNumber', '$dateOfBirth', '$nationality',  '$citizenship',  '$cell', '$eMail')
");

$insertSuccessful = 'true';

}

if(isset($insertSuccessful)) {

header("Location: to.php?whatever2= $MemberID");

}

?>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

Another happy email harvester:

[Image removed]

 

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

Ben,

The system is still broken.  Please report bad screen names in the Back Room under Needs a Name Change

Adobe Staff will take it from there.

 

Nancy O'Shea— Product User, Community Expert & Moderator

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 07, 2020 May 07, 2020

Copy link to clipboard

Copied

Thanks, Nancy, have reported it.

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines