RE: [PHP] Query bug, what is wrong?
| From: | Robert V. Zwink | Date: | Fri, 08 Mar 2002 14:22:15 +0000 |
| Subject: | RE: [PHP] Query bug, what is wrong? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-87768@lists.php.net to get a copy of this message | ||
You probably need to wrap the strings you are trying to input with quotation
marks.
Try modifying this line (add \") :
$query = "INSERT INTO projeto (nome,setor,arquivo,status) VALUES
(\"$qname\",\"$qdes\",\"$qFILE\",'ok')";
Robert Zwink
http://www.zwink.net/daid.php
-----Original Message-----
From: Daniel F. Castro [mailto:dfcastro@ig.com.br]
Sent: Friday, March 08, 2002 8:29 AM
To: php-general@lists.php.net
Subject: [PHP] Query bug, what is wrong?
<?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(mysql_error());
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 (mysql_error());
echo "Projecto registered";
// Closing connection
mysql_close($link);
?>
Thanks you
Daniel Castro
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php