Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Mysql import help

Options
  • 25-03-2016 5:11pm
    #1
    Registered Users Posts: 2




    Can anyone see any obvious problems with this sql file?

    It's throwing out

    " You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-salary, accommodation_type, address, contact_number) VALUES ('اما ' at line 1"
    ????


Comments

  • Registered Users Posts: 6,494 ✭✭✭daymobrew


    Please post the first few lines of the sql file.


  • Registered Users Posts: 2 amalsuju


    <?php require_once('../../Connections/connection.php'); ?>
    <?php
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
    if (isset($_SERVER)) {
    $editFormAction .= "?" . htmlentities($_SERVER);
    }

    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
    $insertSQL = sprintf("INSERT INTO logg (username, firstname, lastname, typename, password, age, birthdate, email, gender, civil_reg, civildate, Source, qualification, salary, source_of_salary, accommodationtype, address, contactnumber) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
    GetSQLValueString($_POST, "text"),
    GetSQLValueString($_POST, "text"),
    GetSQLValueString($_POST, "text"),
    GetSQLValueString($_POST, "text"),
    GetSQLValueString($_POST, "int"),
    GetSQLValueString($_POST, "int"),
    GetSQLValueString($_POST, "date"),
    GetSQLValueString($_POST, "text"),
    GetSQLValueString($_POST, "text"),
    GetSQLValueString($_POST, "int"),
    GetSQLValueString($_POST, "date"),
    GetSQLValueString($_POST, "text"),
    GetSQLValueString($_POST, "text"),
    GetSQLValueString($_POST, "int"),
    GetSQLValueString($_POST, "text"),
    GetSQLValueString($_POST, "text"),
    GetSQLValueString($_POST, "text"),
    GetSQLValueString($_POST, "int"));
    }
    mysql_select_db($database_connection, $connection);
    $query_logg = 'SELECT * FROM logg';
    $logg = mysql_query($query_logg, $connection) or die(mysql_error());
    $row_logg = mysql_fetch_assoc($logg);
    $totalrows_logg = mysql_num_rows($logg);

    ?>


  • Registered Users Posts: 2,030 ✭✭✭colm_c


    Looks like your line breaks are also inserting (or trying to) hence line return character:

    'اما ' at line 1

    It also could be one of your values e.g. date depending on what you are passing in.


Advertisement