pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ben wilko <wilko_ben@hotmail.com>
To: pgsql-php@postgresql.org
Subject: Select Where using character varying ??
Date: Tue, 03 Oct 2006 14:08:07 +1000
Message-ID: <BAY116-F1074C7ACE9E04AA4A018B88F1C0@phx.gbl> (raw)

<html><div style='background-color:'><DIV class=RTE>Hi Guys</DIV>
<DIV class=RTE>&nbsp;</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&nbsp;name = $Sem; but I get an error which is displayed&nbsp;near the end of this message. Are we able compare php string to postgresql character varying??&nbsp; not sure how else to do the selection</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>$conn = pg_Connect("host=localhost dbname=#### user=#### password=####");<BR>&nbsp; &nbsp;if (!$conn) {echo "An database connection error occurred.\n"; exit;}</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>// e.g. $Sem = "seminar one";</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>$Sem = $_POST['Seminars'];</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>$Sem_No = pg_Exec($conn,"SELECT seminar_id FROM seminar WHERE&nbsp;name = $Sem");<BR>&nbsp;if (!$SemNo) {echo "A query error occurred in retreiving the selected seminar's ID &lt;br&gt;"; /*exit;*/}<BR>$Sem_No = pg_Result($Sem_No, 0);</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>// Error Message</DIV>
<DIV class=RTE>&nbsp;</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>&nbsp;</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>Table:&nbsp;<TD> </TD><TD><A title=Table href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/redirect.php?server=%3A5432&amp;database=bd...;
<DIV class=RTE><TR><TH class=data><TR><TH class=data>Column</TH>&nbsp;&nbsp;&nbsp;&nbsp; <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&amp;ser... class=opbutton1><A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=confirm_drop&amp;s... class=data1></TD> </DIV>
<DIV class=RTE></TR><TR><TD class=data2>name</TD>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <TD class=data2>character varying</TD> <A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=properties&amp;ser... class=opbutton2><A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=confirm_drop&amp;s... class=data2></TD> </DIV>
<DIV class=RTE></TR><TR><TD class=data1>address</TD>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <TD class=data1>character varying</TD> <A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=properties&amp;ser... class=opbutton1><A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=confirm_drop&amp;s... class=data1></TD> </DIV>
<DIV class=RTE></TR><TR><TD class=data2>date</TD>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <TD class=data2>date</TD>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=properties&amp;ser... class=opbutton2><A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=confirm_drop&amp;s... class=data2></TD> </DIV>
<DIV class=RTE></TR><TR><TD class=data1>description</TD>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <TD class=data1>character varying <A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=properties&amp;ser... class=opbutton1><A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=confirm_drop&amp;s... class=data1></TD> </DIV>
<DIV class=RTE></TR><TR><TD class=data2>notes</TD>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <TD class=data2>character varying</TD> <A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=properties&amp;ser... class=opbutton2><A href="https://www13.a2hosting.com:2083/3rdparty/phpPgAdmin/tblproperties.php?action=confirm_drop&amp;s... 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>




view thread (5+ messages)  latest in thread

Message-ID: <BAY116-F1074C7ACE9E04AA4A018B88F1C0@phx.gbl>
Permalink:  ../BAY116-F1074C7ACE9E04AA4A018B88F1C0@phx.gbl/
Also on:    postgresql.org/message-id/BAY116-F1074C7ACE9E04AA4A018B88F1C0@phx.gbl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: wilko_ben@hotmail.com
  Subject: Re: Select Where using character varying ??
  In-Reply-To: <BAY116-F1074C7ACE9E04AA4A018B88F1C0@phx.gbl>
  References: <BAY116-F1074C7ACE9E04AA4A018B88F1C0@phx.gbl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox