Forgive me as I'm a brickwall programmer (you know the one who beats his head against his monitor till the code works) learning PHP and mySQL.
I've created a mySql DB w/ int & long text fields .. I'm using the Replace statement to update and create records. All works well save when the text has a comma in it, seems the comma is being interpeted as a field delimiter .. the PHP is listed below .. any comment welcome ... THANKS !!! If you want to play w/ the beast ..
http://www.dbrenchley.com/Translation/Translation_2.html
<?php
require_once "connect_to_mysql.php";
if ($_POST['sendRequest'] == "wRec") {
// Access the value of the dynamic text field variable sent from flash
$id = $_POST['Id'];
$Page = $_POST['Page'];
$Item = $_POST['Item'];
$English = $_POST['English'];
$Spanish = $_POST['Spanish'];
$French = $_POST['French'];
$Comp1 = $_POST['Comp1'];
$Comp2 = $_POST['Comp2'];
$Comp3 = $_POST['Comp3'];
$Notes = $_POST['Notes'];
$Comp4 = $_POST['Comp4'];
$Notes2 = $_POST['Notes2']; //mysqli_real_escape_string($myConnection,$_POST['English'])
$sqlCommand = "REPLACE INTO `dbrench1_Translate`.`Language` (`id`, `Page`, `Item`, `English`, `Spanish`, `French`, `English_Comp`,
`Spanish_Comp`, `French_Comp`, `Notes`, `All_Comp`, `Notes_2`) VALUES ($id, $Page, $Item, '$English', '$Spanish', '$French', '$Comp1', '$Comp2',
'$Comp3', '$Notes', '$Comp4', '$Notes2')";
$query = mysqli_query($myConnection,$sqlCommand) or die(mysqli_error($myConnection));
echo "$query";
}
if ($_POST['sendRequest'] == "rRec") {
$id = $_POST['Id'];
$sqlCommand = "SELECT * FROM `dbrench1_Translate`.`Language` WHERE id=$id"; // WHERE id=$id"
$query = mysqli_query($myConnection,$sqlCommand) or die(mysqli_error($myConnection));
$result = mysqli_fetch_array($query);
echo $result[0].",".$result[1].",".$result[2].",".$result[3].",".$result[4].",".$result[5].",".$result[6].",".$result[7].",".$result
[8].",".$result[9].",".$result[10].",".$result[11];//.$result[`Page`].$result[`Item`].$result[`English`].$result[`Spanish`].$result[`French`].$result
[`English_Comp`].$result[`Spanish_Comp`].$result[`French_Comp`].$result[`Notes`].$result[`All_Comp`].$result[`Notes_2`];
}
mysqli_free_result($query);
mysqli_close($myConnection);
?>