Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Dec 2009
    Posts
    173
    Thanks
    24
    Thanked 1 Time in 1 Post

    inserting data in table

    hey guys whats wrong with this code?
    PHP Code:
    $con mysql_connect("localhost","root","");
    mysql_connect('localhost','root','') or die ($error);
    mysql_select_db('imovel') or die ($error);

    $sql "INSERT INTO `imovel`.`info` (
    `ID`,
    `ESTADO`, 
    `CIDADE`, 
    `RUA`, 
    `MOBILIADO`, 
    `GARAGEM`, 
    `METRAGEM`, 
    `DORMITORIOS`, 
    `BANHEIROS`, 
    `SUITES`, 
    `SALA`, 
    `COZINHA`, 
    `PATIOCERCADO`, 
    `CHURRASQUEIRA`, 
    `AREASERVICO`, 
    `POSICAOSOLAR`, 
    `LAREIRA`, 
    `EMPREGADA`, 
    `VALOR`, 
    `DESCRICAO`, 
    `ACESSOS`, 
    `FOLDER`) VALUES (
    NULL, 
    \'
    $estado\', 
    \'
    $cidade \', 
    \'
    $rua\', 
    \'
    $mobiliado\', 
    \'
    $garagem\', 
    \'
    $metragem\', 
    \'
    $dormitorios\', 
    \'
    $banheiros\', 
    \'
    $suites\', 
    \'
    $sala\', 
    \'
    $cozinha\', 
    \'
    $patio\', 
    \'
    $churrasqueira\', 
    \'
    $areaservico\', 
    \'
    $posicaosolar\', 
    \'
    $lareira\', 
    \'
    $empregada\', 
    \'
    $valor\', 
    \'
    $desc\', 
    \'\', 
    \'
    $nomepasta\');";

    mysql_query($sql); 

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,547
    Thanks
    45
    Thanked 259 Times in 256 Posts
    You're escaping single quotes in a double quote, which isn't necessary and adds a literal backslash into the quote.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •