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

Data from browser isn't available in Database (Mysql)

New Here ,
May 15, 2017 May 15, 2017

Hey people,

I am in a deep trouble, I have connected mySql to my dreamweaver site succesfully but when testing in the browser the data i enter isnt visible in the database table.....and also i am getting this dynamically- relatesd content problem could this be the problem.

993
Translate
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 1 Correct answer

Community Expert , May 17, 2017 May 17, 2017

To interact with a database you need to build a CRUD application.  Basically, a set of PHP pages that is able to  connect and Create/Read/Update/Delete data in the database. 

Have you completed that yet?

PHP CRUD Tutorial (part 1)

Nancy

Translate
Mentor ,
May 15, 2017 May 15, 2017

What version of Dreamweaver are you using?

Exactly what errors are you getting?

Do you have a Web server installed and if so, which one?

What do you mean when you say: I have connected mySql to my dreamweaver site succesfully

Translate
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 17, 2017 May 17, 2017

I am using dreamweaver CC 2017 and i have made the possible connections requires (test server). i am making a registration form and therfore i have linked my DB table to the respective fields...as i try to test it out in the browser it says succesfull but as i check my DB table there is no data...

Translate
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
Mentor ,
May 17, 2017 May 17, 2017

Are you using MySQLi or PDO?

You don't mention a database plugin (such as from dmxzone or webassist) so I assume you are not using one

The following two lines of code will make PHP errors visible, in case they are not

error_reporting(E_ALL & ~E_NOTICE);
ini_set('display_errors', 1);

The following line of code can be used to make database errors "verbose" if you are using PDO. The variable $dbh is the variable you give the connection class

$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

You should paste the relevant code into the forum so we can see if your code gives us a clue as to what is happening.

Translate
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 17, 2017 May 17, 2017

<?php

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

  if (PHP_VERSION < 6) {

    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {

    case "text":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;   

    case "long":

    case "int":

      $theValue = ($theValue != "") ? intval($theValue) : "NULL";

      break;

    case "double":

      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";

      break;

    case "date":

      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

      break;

    case "defined":

      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

      break;

  }

  return $theValue;

}

}

$editFormAction = $_SERVER['PHP_SELF'];

if (isset($_SERVER['QUERY_STRING'])) {

  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "REGISTRATION")) {

  $insertSQL = sprintf("INSERT INTO `S and T R` (`School Name`, `School Contact No.`, `School Email ID`, `Fax Number`, `Teacher Name`, `Teacher Contact number`, `Teacher Email ID`, `T-size Teacher`, `Teacher Gender`) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",

                       GetSQLValueString($_POST['School_Name'], "text"),

                       GetSQLValueString($_POST['Contact Number (school)'], "text"),

                       GetSQLValueString($_POST['School Email ID'], "text"),

                       GetSQLValueString($_POST['Fax Number'], "text"),

                       GetSQLValueString($_POST['Teacher name'], "text"),

                       GetSQLValueString($_POST['Contact Number'], "text"),

                       GetSQLValueString($_POST['Teacher email ID'], "text"),

                       GetSQLValueString($_POST['T-size Teacher'], "text"),

                       GetSQLValueString($_POST['Gender'], "text"));

  mysql_select_db($database_SBA, $SBA);

  $Result1 = mysql_query($insertSQL, $SBA) or die(mysql_error());

}

mysql_select_db($database_SBA, $SBA);

$query_Recordset1 = "SELECT * FROM `S and T R`";

$Recordset1 = mysql_query($query_Recordset1, $SBA) or die(mysql_error());

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

$totalRows_Recordset1 = mysql_num_rows($Recordset1);

?>

the PHP code...i am not using PDO instead for my DB management i am using Mysql Workbench if that's what you were asking...

thanks to being considerate I really need this to be done, i am new to PHP and did some basic tutorials

Translate
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 17, 2017 May 17, 2017

To interact with a database you need to build a CRUD application.  Basically, a set of PHP pages that is able to  connect and Create/Read/Update/Delete data in the database. 

Have you completed that yet?

PHP CRUD Tutorial (part 1)

Nancy

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
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
Mentor ,
May 17, 2017 May 17, 2017

..i am not using PDO instead for my DB management i am using Mysql Workbench

This statement is not logical, but it confirms that you don't have the skills to do what you are trying to do.

Read PHP Solutions by Powers.

Translate
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 22, 2017 May 22, 2017

I totally agree, I just started with PHP and do not have enough money to take proper tutorials so had been using youtube as a source, I did look up at the PDO stuff and it is actually pretty better in understanding and learning, but it didn't solve my problem, I am still not getting my information on the DB, please help me out, I am really out of time. Thank you, Nancy OShea for informing me about PDO and the tutorials.

Translate
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 22, 2017 May 22, 2017

It's very foolish to learn advanced programming under unreasonable deadlines. 

  1. You won't learn anything. 
  2. Rushing through it will result in many mistakes & compounded stress.

Take your time to absorb what you're learning. If you don't have several months to leisurely work on this project, you should not attempt it at this time. 

Nancy

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
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 22, 2017 May 22, 2017

appreciate your advice, but I am a very quick learner...i don't have a month this is the last week for my project, I am searching for more options though, if you could help me out please do so...

Translate
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 22, 2017 May 22, 2017

That's magical thinking.  1 WEEK is not nearly enough time to build an application -- especially if you don't know what you're doing. 

I'm sorry I can't help you.  I'm fully committed to other projects right now.  But even if I had the time, I wouldn't be able to do this in only 1 week. 

Nancy

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
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 17, 2017 May 17, 2017

Just to add to your confusion, you have been using the deprecated server behaviours panels that came with Dreamweaver until CS6. Since then they have been dropped although you are able to install the panels via an extension manager.

However, the code that it produces no longer works in the latest version of PHP and you should not be teaching yourself the MySQL- way. Current alternatives are MySQLi and PDO. The link that Nancy supplied uses my preferred PDO-way.

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
Translate
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 22, 2017 May 22, 2017
LATEST

sure...no problem...thanks for your help though. If I figure this thing out it just one day job. anyways thanks for your support.

Translate
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