Copy link to clipboard
Copied
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.
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?
Nancy
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
<?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
Copy link to clipboard
Copied
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?
Nancy
Copy link to clipboard
Copied
..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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
It's very foolish to learn advanced programming under unreasonable deadlines.
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
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
sure...no problem...thanks for your help though. If I figure this thing out it just one day job. anyways thanks for your support.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now