<html><div style='background-color:'><DIV class=RTE>Hi Guys</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>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</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>$conn = pg_Connect("host=localhost dbname=#### user=#### password=####");<BR> if (!$conn) {echo "An database connection error occurred.\n"; exit;}</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>// e.g. $Sem = "seminar one";</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>$Sem = $_POST['Seminars'];</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>$Sem_No = pg_Exec($conn,"SELECT seminar_id FROM seminar WHERE name = $Sem");<BR> if (!$SemNo) {echo "A query error occurred in retreiving the selected seminar's ID <br>"; /*exit;*/}<BR>$Sem_No = pg_Result($Sem_No, 0);</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>// Error Message</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE><STRONG>Warning</STRONG>: pg_exec() [<A href="http://www.citanalyst.com/jet/form/function.pg-exec">function.pg-exec</A>]: Query failed: ERROR: syntax error at or near "one" at character 54 in <B>/home/bdwilko/public_html/jet/form/insertP.php</B> on line <B>56</B><BR>A query error occurred in retreiving the selected seminar's ID </DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>Table: <TD> </TD><TD><A title=Table href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/redirect.php?server=%3A5432&database=bdwilko_jet&schema=public&subject=table&table=seminar">seminar</A></TD></DIV>
<DIV class=RTE><TR><TH class=data><TR><TH class=data>Column</TH> <TH class=data>Type</TH> <TH class=data>Not Null</TH> <TH class=data>Default</TH> <TH class=data colspan="2">Actions</TH> <TH class=data>Comment</TH> </DIV>
<DIV class=RTE></TR><TR><TD class=data1>seminar_id</TD> <TD class=data1>integer</TD> NOT NULL nextval('seminar_seminar_id_seq'::regclass)</TD> <TD class=opbutton1><A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=properties&server=%3A5432&database=bdwilko_jet&schema=public&table=seminar&column=seminar_id&">Alter</A></TD><TD class=opbutton1><A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=confirm_drop&server=%3A5432&database=bdwilko_jet&schema=public&table=seminar&column=seminar_id&">Drop</A></TD><TD class=data1></TD> </DIV>
<DIV class=RTE></TR><TR><TD class=data2>name</TD> <TD class=data2>character varying</TD> <A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=properties&server=%3A5432&database=bdwilko_jet&schema=public&table=seminar&column=name&">Alter</A></TD><TD class=opbutton2><A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=confirm_drop&server=%3A5432&database=bdwilko_jet&schema=public&table=seminar&column=name&">Drop</A></TD><TD class=data2></TD> </DIV>
<DIV class=RTE></TR><TR><TD class=data1>address</TD> <TD class=data1>character varying</TD> <A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=properties&server=%3A5432&database=bdwilko_jet&schema=public&table=seminar&column=address&">Alter</A></TD><TD class=opbutton1><A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=confirm_drop&server=%3A5432&database=bdwilko_jet&schema=public&table=seminar&column=address&">Drop</A></TD><TD class=data1></TD> </DIV>
<DIV class=RTE></TR><TR><TD class=data2>date</TD> <TD class=data2>date</TD> <A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=properties&server=%3A5432&database=bdwilko_jet&schema=public&table=seminar&column=date&">Alter</A></TD><TD class=opbutton2><A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=confirm_drop&server=%3A5432&database=bdwilko_jet&schema=public&table=seminar&column=date&">Drop</A></TD><TD class=data2></TD> </DIV>
<DIV class=RTE></TR><TR><TD class=data1>description</TD> <TD class=data1>character varying <A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=properties&server=%3A5432&database=bdwilko_jet&schema=public&table=seminar&column=description&">Alter</A></TD><TD class=opbutton1><A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=confirm_drop&server=%3A5432&database=bdwilko_jet&schema=public&table=seminar&column=description&">Drop</A></TD><TD class=data1></TD> </DIV>
<DIV class=RTE></TR><TR><TD class=data2>notes</TD> <TD class=data2>character varying</TD> <A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=properties&server=%3A5432&database=bdwilko_jet&schema=public&table=seminar&column=notes&">Alter</A></TD><TD class=opbutton2><A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=confirm_drop&server=%3A5432&database=bdwilko_jet&schema=public&table=seminar&column=notes&">Drop</A></TD><TD class=data2></TD></TR><TD class=data1></DIV>
<DIV class=RTE align=center></DIV>
<DIV class=RTE></TD><TD class=data1></TD><TD class=opbutton1></TD><TD class=data1></TD></TR></DIV></div></html>