[PHP-DB] php code on sqlite

2004-10-20 Thread Aravalli Sai
hi 
  this is php code for inventory management system
which is done using SQLite.this is an user
interface where an user wil giv values to the text
boxes and it should be saved in the backend database
which is sqlite..
but when i run this code on browser it is giving an
error ... Parse error: parse error in
/home/saravall/.HTML/inv.php on line 81

HTML
HEAD
/HEAD
body
?php

$db =/home/saravall/office.db;
$handle = sqlite_open($db) or die(could not open
database);

if(isset($_POST['submit'])) {

if (!empty($_post['tagno'])  !empty
($_post['desc']) 
!empty ($_post['acqdt'])  !empty
($_post['manufacturer'])  !empty
 ($_post['model']) !empty($_post['serialid']) 
!empty( $_post
['custloc'])  !empty($_post['totcost']))
 {
$insquery = insert into inventory
(tagno,desc,acqdt,manufacturer,model, serial
id,custloc,totcost) values (\.sqlite_escape_string(
$_post['tagno']).\,\.sqlite_escape_string($_post['desc']).\,\
.sqlite_escape_string($_post['serialid']).\,\.sqlite_escape_string($_post
['custloc']).\,\.sqlite_escape_string($_post['totcost']).\);
 
 
$insresult = sqlite_query($handle,$insquery) or
die(error:.sqlite_error_string(sqlite_last_error($handle)));
echo isuccessfully inserted!/ip /;
}
else {
echo iincomplete from input!/ip /;
  $query = SELECT * FROM inventory ;
$result = sqlite_query($handle,$query) or

die(err:.sqlite_error_string(sqlite_last_error($handle)));
if (sqlite_num_rows($result)  0)
{
echo table cellpadding=20 border=1;
while ($row = sqlite_fetch_array($result))
{
echo tr;
echo td.$row[0]./td;
echo td.$row[1]./td;
echo td.$row[2]./td;
echo td.$row[3]./td;
echo td.$row[4]./td;
echo td.$row[5]./td;
echo td.$row[6]./td;
echo td.$row[7]./td;
echo td.$row[8]./td;
echo td.$row[9]./td;
echo /tr;
}
echo /table;

}
sqlite_close($handle);
?
p
h2  
enter  new record:/h2
form method=post action=?php  echo
$_server['php_self'];?
Tag number:input type=text name=number  
br/
desc:input type=text name=desc
br/
acq date:input type=text name=date
br/
manufacturer:input type=text name=manufacturer
br/  
model:input type=text name=model
br/ 
serial id:input type=text name=serial id
br/
custodian location:input type=text
name=custodian
br/
sum cost:input type=text name=cost
br/
input type=submit name=submit value =save
/p
/form
/body
/HTML


i would appreciate if you can help me in correcting
this error..
thanks in advance..
sai



___
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] php code on sqlite

2004-10-20 Thread Mike Smith
Add

?
}
}
?

after your closing /html


On Wed, 20 Oct 2004 11:50:29 -0700 (PDT), Aravalli Sai
[EMAIL PROTECTED] wrote:
 hi
   this is php code for inventory management system
 which is done using SQLite.this is an user
 interface where an user wil giv values to the text
 boxes and it should be saved in the backend database
 which is sqlite..
 but when i run this code on browser it is giving an
 error ... Parse error: parse error in
 /home/saravall/.HTML/inv.php on line 81
 
 HTML
 HEAD
 /HEAD
 body
 ?php
 
 $db =/home/saravall/office.db;
 $handle = sqlite_open($db) or die(could not open
 database);
 
 if(isset($_POST['submit'])) {
 
 if (!empty($_post['tagno'])  !empty
 ($_post['desc']) 
 !empty ($_post['acqdt'])  !empty
 ($_post['manufacturer'])  !empty
  ($_post['model']) !empty($_post['serialid']) 
 !empty( $_post
 ['custloc'])  !empty($_post['totcost']))
  {
 $insquery = insert into inventory
 (tagno,desc,acqdt,manufacturer,model, serial
 id,custloc,totcost) values (\.sqlite_escape_string(
 $_post['tagno']).\,\.sqlite_escape_string($_post['desc']).\,\
 .sqlite_escape_string($_post['serialid']).\,\.sqlite_escape_string($_post
 ['custloc']).\,\.sqlite_escape_string($_post['totcost']).\);
 
 $insresult = sqlite_query($handle,$insquery) or
 die(error:.sqlite_error_string(sqlite_last_error($handle)));
 echo isuccessfully inserted!/ip /;
 }
 else {
 echo iincomplete from input!/ip /;
   $query = SELECT * FROM inventory ;
 $result = sqlite_query($handle,$query) or
 
 die(err:.sqlite_error_string(sqlite_last_error($handle)));
 if (sqlite_num_rows($result)  0)
 {
 echo table cellpadding=20 border=1;
 while ($row = sqlite_fetch_array($result))
 {
 echo tr;
 echo td.$row[0]./td;
 echo td.$row[1]./td;
 echo td.$row[2]./td;
 echo td.$row[3]./td;
 echo td.$row[4]./td;
 echo td.$row[5]./td;
 echo td.$row[6]./td;
 echo td.$row[7]./td;
 echo td.$row[8]./td;
 echo td.$row[9]./td;
 echo /tr;
 }
 echo /table;
 
 }
 sqlite_close($handle);
 ?
 p
 h2
 enter  new record:/h2
 form method=post action=?php  echo
 $_server['php_self'];?
 Tag number:input type=text name=number
 br/
 desc:input type=text name=desc
 br/
 acq date:input type=text name=date
 br/
 manufacturer:input type=text name=manufacturer
 br/
 model:input type=text name=model
 br/
 serial id:input type=text name=serial id
 br/
 custodian location:input type=text
 name=custodian
 br/
 sum cost:input type=text name=cost
 br/
 input type=submit name=submit value =save
 /p
 /form
 /body
 /HTML
 
 i would appreciate if you can help me in correcting
 this error..
 thanks in advance..
 sai
 
 ___
 Do you Yahoo!?
 Declare Yourself - Register online to vote today!
 http://vote.yahoo.com
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php