logo       

Select Where using character varying ??: msg#00000

Subject: Select Where using character varying ??
    
NOT NULL nextval('seminar_seminar_id_seq'::regclass)
                          Alter
                       Alter
                                             Alter
                 
                         Alter
Hi Guys
 
I am printing names into a combo box and posting the variable. I try and use the name ($Sem) in an SQL statement; WHERE name = $Sem; but I get an error which is displayed near the end of this message. Are we able compare php string to postgresql character varying??  not sure how else to do the selection
 
 
$conn = pg_Connect("host=localhost dbname=#### user=#### password=####");
   if (!$conn) {echo "An database connection error occurred.\n"; exit;}
 
 
// e.g. $Sem = "seminar one";
 
$Sem = $_POST['Seminars'];
 
 
$Sem_No = pg_Exec($conn,"SELECT seminar_id FROM seminar WHERE name = $Sem");
 if (!$SemNo) {echo "A query error occurred in retreiving the selected seminar's ID <br>"; /*exit;*/}
$Sem_No = pg_Result($Sem_No, 0);
 
// Error Message
 
Warning: pg_exec() [function.pg-exec]: Query failed: ERROR: syntax error at or near "one" at character 54 in /home/bdwilko/public_html/jet/form/insertP.php on line 56
A query error occurred in retreiving the selected seminar's ID
 
 
Table: 
seminar
ColumnType Not Null Default Actions Comment
seminar_id integer AlterDrop
namecharacter varying Drop
addresscharacter varying Drop
datedateDrop
descriptioncharacter varying AlterDrop
notescharacter varying Drop
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
audio.irate.dev...    yellowdog.gener...    ietf.ips/2002-0...    xfree86.fonts/2...    busybox/2003-07...    emacs.jdee/2004...    linux.mandrake....    hardware.microc...    user-groups.lin...    science.analysi...    version-control...    db.filemaker.de...    cluster.openmos...    mail.eyebrowse....    text.xml.xerces...    kde.devel.kwrit...    finance.moneyda...    gcc.regression/...    network.routing...    os.freebsd.deve...    recreation.radi...    qnx.openqnx.dev...    python.xml/2002...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe