You are here: Re: [PHP] Unable to send variables to MySQL table « PHP « IT news, forums, messages
Re: [PHP] Unable to send variables to MySQL table

Posted by "Richard Lynch" on 11/11/05 00:27

On Wed, November 9, 2005 1:15 pm, Stewart Priest wrote:
> I've written this script shown below. It gets its variables from a
> form, and then it (supposedly!) writes these values into a MySQL table
> ('invoices').
>
> The script executes with no errors, but when I check the table, the
> table is still empty. I can manually insert the data directly into the
> table, and when I echo the variables in the script, the values are
> displayed whe I run it, but for reasons unknown, the values are not
> written to the table.
>
> Any ideas? The code is below.
>
> Many thanks.
> Stewart
>
> <?php
>
> // this opens the connection to the db
> include 'library/opendb.php';
>
> // this adds detals to the invoice table
> $item1_desc = $_REQUEST['item1_desc'];
> $item2_desc = $_REQUEST['item2_desc'];
> $item3_desc = $_REQUEST['item3_desc'];
> $item4_desc = $_REQUEST['item4_desc'];
> $item1_cost = $_REQUEST['item1_cost'];
> $item2_cost = $_REQUEST['item2_cost'];
> $item3_cost = $_REQUEST['item3_cost'];
> $item4_cost = $_REQUEST['item4_cost'];
> $delivery_cost = $_REQUEST['delivery_cost'];
>
> $add_to_db = "insert into invoices (item1_desc, item1_cost,
> item2_desc, item2_cost, item3_desc, item3_cost, item4_desc,
> item4_cost, delivery_cost) values ('$item1_desc', '$item1_cost',
> '$item2_desc', '$item2_cost', '$item3_desc', '$item3_cost',
> '$item4_desc', '$item4_cost', '$delivery_cost')";
> mysql_query($add_to_db);

echo "<hr />$query<hr />";
mysql_query($add_to_db) or die(mysql_error());

> ?>


--
Like Music?
http://l-i-e.com/artists.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация