database query - Mailing list pgsql-php

From PJourdan
Subject database query
Date
Msg-id 5.1.0.14.2.20020430144126.00ad01a0@mail.host45.com
Whole thread Raw
List pgsql-php
I am new to php & pgsql and am having some problems with a database query.
I have reconstructed a defunct website on my local FreeBSD machine. On the
site everything worked fine. On the local machine, after some problems in
reconstructing the pg database, the main site functions fairly well. The
problem is in the administration section. This is accessed from another
directory /radm.

1) On original site, access to the login (passwd, username) was
www.sitename.com/radm. On local machine, I must now enter
192.168.1.25/radm/index.php. Then it works.

2) When I try to access the product administration page, no products are
displayed. The web pages showing the products normally work fine and the
products are seen with minor glitches. But the admin code does not seem to
access the database. No db errors are generated. Apparently the queries
were designed for pg 7.0 and I am now using 7.2.1_1.
What seems to be wrong? Thanks in advance
Philip Jourdan

Here is a snippet:

include "$DOCUMENT_ROOT/../lib/general.conf";
$user_id=CheckUser(3);
no_cache();
include "admin.php";
$page_id=2;
if(!isset($id)) $id=0;
if(!isset($op)) $op='';

$path='';
if(isset($filter) && $filter=='Search') {
     $path='Search->';
}
else {
     list($path)=sqlget("select name from category where category_id='$id'");
}
if($op=='ca_add') $path.='->Add New Category';
if($op=='w_add') $path.='->Add New Product';
if($op=='w_edit') {
     list($caname)=sqlget("
     select name from wares_category,category
    where wares_category.ware_id='$id' and
    category.category_id=wares_category.category_id
     limit 1");
     list($wname)=sqlget("select name from wares where ware_id='$id'");
     $path="$caname->$wname (edit)";
}
ShowHeader("Admin->Products->$path");
if($op=='ca_edit' || $op=='ca_add' || (isset($check) &&
        $check=='Update category') && has_right($user_id,$page_id,'S')>0) {
     if($op=='ca_edit') {
    list($root_id,$archived,$hidden,$name,$color,$image,$comments)=sqlget("
        select root_id,archived,hidden,name,color,image,comments
        from category where category_id=$id");
     }
     else {
    $root_id=$id;
    $archived=$hidden='f';
    $name='';
    $color='lightblue';
    $image=$comments='';
     }
     BeginForm();
     InputField("Name",'f_name', array('required'=>'yes','default'=>$name));
     InputField("Archived",'f_arch',
array('required'=>'yes','default'=>$archived,
    'type'=>'select','combo'=>array('f'=>'No','t'=>'Yes')));
     InputField("Hidden",'f_hidden',
array('required'=>'yes','default'=>$hidden,
    'type'=>'select','combo'=>array('f'=>'No','t'=>'Yes')));
     InputField("Color",'f_color', array('required'=>'yes','default'=>$color));
     InputField("Image",'f_image', array('default'=>$image));
     InputField("Comments",'f_comments',
array('default'=>$comments,'type'=>'textarea','fparam'=>' rows=5 cols=58
wrap=virtual'));
     FrmEcho("<input type=hidden name=id value=$id>");
     FrmEcho("<input type=hidden name=op value=$op>");
     EndForm('Update category');
     ShowForm();
}


pgsql-php by date:

Previous
From: Tomaz Borstnar
Date:
Subject: Re: Many "pq_flush: send() failed: Broken pipe" after
Next
From: "P. Jourdan"
Date:
Subject: sql commands