My guess is you aren't properly quoting your data with single
    quotes or it contains characters which need to be quoted.

    Also, you have more chances then getting 'Query Error' when
    you use the 'mysql_error()' function.

    Btw, this is the wrong list .. [EMAIL PROTECTED]
    would be the right one.

    - Markus

On Fri, Mar 08, 2002 at 12:55:05AM -0300, Daniel Ferreira Castro wrote : 
> My query has a bug that I can not detect....
> My database called test has a table called projeto.
> This projeto table has the fields <id int,nome VARCHAR(40), setor 
> VARCHAR(30), arquivo VARCHAR(120),status VARCHAR(2)>
> When I use the client mysql the query works fine.  But when I put it in the 
> php script below, an error appears exactly like "Query Error", that is 
> telling me that my query is wrong.  Where is the mistake??
> 
> <?php
>   $qname      = $HTTP_POST_VARS['ct_nome'];
>   $qkey       = $HTTP_POST_VARS['ct_kw'];
>   $qdia               = $HTTP_POST_VARS['ct_dia'];
>   $qmes       = $HTTP_POST_VARS['ct_mes'];
>   $qano       = $HTTP_POST_VARS['ct_ano'];
>   $qautor     = $HTTP_POST_VARS['ct_autor'];
>   $qeng       = $HTTP_POST_VARS['cS_eng'];
>   $qdes       = $HTTP_POST_VARS['cS_des'];
>   $qFILE      = "FILES";
>   $host       = localhost;
>   //Database Conection
>   $link = mysql_connect($host,"root","root")
>     or die("Not possible to connect");
>   print("Connection OK");
>   //Database Selection
>   mysql_select_db("test")
>     or die("Could not select database");
>   print("Selection OK");
>   $query = "INSERT INTO projeto (nome,setor,arquivo,status) VALUES 
> ($qname,$qdes,$qFILE,'ok')";
>   print "$qname";
>   print "$qkey";
>   print "$qautor";
>   print "$qdia/$qmes/$qano";
>   //My Query
>   mysql_query ($query)
>       or Die ("Query Error");
>   echo "Projecto registered";
> 
>   // Closing connection
>   mysql_close($link);
> ?>
> 
> Thanks you
> 
> Daniel Castro

> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.325 / Virus Database: 182 - Release Date: 2/19/02
> 

> -- 
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Please always Cc to me when replying to me on the lists.
GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to