pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
table not showing in explorer
4+ messages / 2 participants
[nested] [flat]

* table not showing in explorer
@ 2002-12-26 02:31 Bruce Young <hbrucey@yahoo.com>
  2002-12-26 02:59 ` Re: table not showing in explorer Andrew McMillan <andrew@catalyst.net.nz>
  0 siblings, 1 reply; 4+ messages in thread

From: Bruce Young @ 2002-12-26 02:31 UTC (permalink / raw)
  To: pgsql-php

i have a php script that searches a column and prints it out. 
the table appears fine in mozilla, but dont show in Explorer.
if i change the variable in the search script to a literal value, it
works fine.  i have tried alternatives, and it seems that the problem
is in the variable. here is the script:
any help appreciated.


<html lang="en">
<head> <title>Code Search</title>
<script TYPE="text/javascript" LANGUAGE="JavaScript"><!--
function setCampCode(code) {
    opener.campcode = code;
    opener.restart();
    self.close;
}
//--></SCRIPT>
</head>
<body BGCOLOR="white">
<?php //Database Connection - global
  $dbconnect = pg_connect("dbname=campus user=apache");
?>
<br>
<center>
<table width="90%" border="0" cellspacing="1" cellpadding="0"
bgcolor="green"><tbody><tr><td>
<table width="100%" border="0" cellspacing="1" cellpadding="8"
bgcolor="#f6f6f5"><tbody><tr><td>
<table width="70%" border=0 cellpadding=0 cellspacing=4>
<form name="campcode" method="post" action="<?php
print("$PHP_SELF");?>">

<tr><td>Search:</td><td><input type="text" name="code"></td>
<td><input type="submit" name="submit" value="Search"></td></tr>
</form></table>
</td></tr></tbody></table></td></tr></tbody></table> </center>
<br><br>
<?php
    //$code_query = $code;
    if($submit) {
    
    //THIS IS THE PROBLEM I THINK
    $qry_get_camp_codes = "select id, id, name from list where name
~* '$code'";
    $result = pg_exec ($dbconnect, $qry_get_camp_codes);
	if (!$result) {printf ("Error\n"); exit;}
    if (!pg_numrows($result)) { echo "<font color=\"red\" size=4>no
result</font>"; exit;}
    printf ("<center>
    ");
    printf ("<table cellpadding=4 cellspacing=1 border=1>
	");
	printf ("<tr
bgcolor=\"lightblue\"><td><b>ID</b></td><td><b>College</b></td></tr>
	");
    while($myrow = pg_fetch_row($result)) {

	printf ("<tr><td><a
href=\"javascript:setCampCode('%s')\">%s</a></td><td>%s</td></tr>"
    , $myrow[0], $myrow[1], $myrow[2]);
    }
    printf ("</table></center>
    ");
    }
pg_close($dbconnect);
?>
</body>
</html>

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: table not showing in explorer
  2002-12-26 02:31 table not showing in explorer Bruce Young <hbrucey@yahoo.com>
@ 2002-12-26 02:59 ` Andrew McMillan <andrew@catalyst.net.nz>
  2002-12-26 05:02   ` Re: table not showing in explorer Bruce Young <hbrucey@yahoo.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Andrew McMillan @ 2002-12-26 02:59 UTC (permalink / raw)
  To: Bruce Young <hbrucey@yahoo.com>; +Cc: pgsql-php

On Thu, 2002-12-26 at 15:31, Bruce Young wrote:
> i have a php script that searches a column and prints it out. 
> the table appears fine in mozilla, but dont show in Explorer.
> if i change the variable in the search script to a literal value, it
> works fine.  i have tried alternatives, and it seems that the problem
> is in the variable. here is the script:
> any help appreciated.

If it works in Mozilla but not in IE, your problem will most likely be
in the form or the javascript.

I recommend you use the phpinfo() function to display all of the PHP
variables (and other information) in the page and go from there.  When
you do that it will probably become obvious exactly what difference
there is between the two browsers.

The problem will have nothing to do with PostgreSQL, of course.

Cheers,
					Andrew.
> 
> 
> <html lang="en">
> <head> <title>Code Search</title>
> <script TYPE="text/javascript" LANGUAGE="JavaScript"><!--
> function setCampCode(code) {
>     opener.campcode = code;
>     opener.restart();
>     self.close;
> }
> //--></SCRIPT>
> </head>
> <body BGCOLOR="white">
> <?php //Database Connection - global
>   $dbconnect = pg_connect("dbname=campus user=apache");
> ?>
> <br>
> <center>
> <table width="90%" border="0" cellspacing="1" cellpadding="0"
> bgcolor="green"><tbody><tr><td>
> <table width="100%" border="0" cellspacing="1" cellpadding="8"
> bgcolor="#f6f6f5"><tbody><tr><td>
> <table width="70%" border=0 cellpadding=0 cellspacing=4>
> <form name="campcode" method="post" action="<?php
> print("$PHP_SELF");?>">
> 
> <tr><td>Search:</td><td><input type="text" name="code"></td>
> <td><input type="submit" name="submit" value="Search"></td></tr>
> </form></table>
> </td></tr></tbody></table></td></tr></tbody></table> </center>
> <br><br>
> <?php
>     //$code_query = $code;
>     if($submit) {
>     
>     //THIS IS THE PROBLEM I THINK
>     $qry_get_camp_codes = "select id, id, name from list where name
> ~* '$code'";
>     $result = pg_exec ($dbconnect, $qry_get_camp_codes);
> 	if (!$result) {printf ("Error\n"); exit;}
>     if (!pg_numrows($result)) { echo "<font color=\"red\" size=4>no
> result</font>"; exit;}
>     printf ("<center>
>     ");
>     printf ("<table cellpadding=4 cellspacing=1 border=1>
> 	");
> 	printf ("<tr
> bgcolor=\"lightblue\"><td><b>ID</b></td><td><b>College</b></td></tr>
> 	");
>     while($myrow = pg_fetch_row($result)) {
> 
> 	printf ("<tr><td><a
> href=\"javascript:setCampCode('%s')\">%s</a></td><td>%s</td></tr>"
>     , $myrow[0], $myrow[1], $myrow[2]);
>     }
>     printf ("</table></center>
>     ");
>     }
> pg_close($dbconnect);
> ?>
> </body>
> </html>

-- 
---------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St,  Wellington
WEB: http://catalyst.net.nz/         PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201     MOB: +64(21)635-694    OFFICE: +64(4)499-2267
           Survey for nothing with http://survey.net.nz/ 
---------------------------------------------------------------------




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: table not showing in explorer
  2002-12-26 02:31 table not showing in explorer Bruce Young <hbrucey@yahoo.com>
  2002-12-26 02:59 ` Re: table not showing in explorer Andrew McMillan <andrew@catalyst.net.nz>
@ 2002-12-26 05:02   ` Bruce Young <hbrucey@yahoo.com>
  2002-12-26 09:50     ` Re: table not showing in explorer Andrew McMillan <andrew@catalyst.net.nz>
  0 siblings, 1 reply; 4+ messages in thread

From: Bruce Young @ 2002-12-26 05:02 UTC (permalink / raw)
  To: pgsql-php

Still wont work. did a few tests and it seems like Explorer wont print the
table when i use a form variable.  the script will notify if there are no
results, but nothing if any. - no table
oh, and what info in phpinfo() would i need to look at if its the prob.?
thanks

=====================================
<html lang="en">
<head> <title>Code Search</title>
</head>
<body>
<center>

<table width="90%" border="0" cellspacing="1" cellpadding="0"
bgcolor="lightblue">
<form name="campcode" method="post" action="<?php print("$PHP_SELF");?>">
<tr height=30><td>Search:</td><td><input type="text" name="code"></td>
<td><input type="submit" name="submit" value="Search"></td></tr>
</form></table>
 </center>
<br><br>
<?php
    $dbconnect = pg_connect("dbname=campus user=apache");
    //$code_query = $code;
    $code = strtolower($code);
    if($submit) {
      if($code=="") {print "You need to enter a query!"; exit;}

    //WORKS in Explorer
    $qry_get_camp_codes = "select id,name from campuslist where name ilike
lower('%HOUSTon%')";
    //DONT WORK in Explorer
    //$qry_get_camp_codes = "select id,name from campuslist where name ilike
lower('%$code%')";
    $result = pg_query ($dbconnect, $qry_get_camp_codes);
	  if (!$result) {printf ("Error\n"); exit;}
      if (!pg_numrows($result)) { echo "<font color=\"red\" size=4>no
result</font>"; exit;}
    print "<center>";
    print "<table border=1>";
	print "<tr><td>ID</td><td>NAME</td></tr>";
    while($myrow = pg_fetch_row($result)) {
	printf ("<tr><td>%s</td><td>%s</td></tr>"
    , $myrow[0], $myrow[1]);
    }
    printf ("</table></center>
    ");
    }
pg_close($dbconnect);
?>
</body>
</html>

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: table not showing in explorer
  2002-12-26 02:31 table not showing in explorer Bruce Young <hbrucey@yahoo.com>
  2002-12-26 02:59 ` Re: table not showing in explorer Andrew McMillan <andrew@catalyst.net.nz>
  2002-12-26 05:02   ` Re: table not showing in explorer Bruce Young <hbrucey@yahoo.com>
@ 2002-12-26 09:50     ` Andrew McMillan <andrew@catalyst.net.nz>
  0 siblings, 0 replies; 4+ messages in thread

From: Andrew McMillan @ 2002-12-26 09:50 UTC (permalink / raw)
  To: Bruce Young <hbrucey@yahoo.com>; +Cc: pgsql-php

On Thu, 2002-12-26 at 18:02, Bruce Young wrote:
> Still wont work. did a few tests and it seems like Explorer wont print the
> table when i use a form variable.  the script will notify if there are no
> results, but nothing if any. - no table
> oh, and what info in phpinfo() would i need to look at if its the prob.?

From your code, it looks like the table won't be printed if $submit is
not set (although your code is perhaps weak on checking the value of
that variable).

I have seen cases where IE will set the value of a submit button
variable differently if you hit <enter> within the form, than if you
click on the button with your mouse.

Remember, your comments accusation of "does/doesn't work in IE" is not
actually true - all of this code runs on the _server_ - not the client. 
All that IE or Mozilla does is provide values for variables input to the
script: the script runs on the same server in both cases.

In any case in the phpinfo() I would look for differences in the value
of the "submit" variable.  Obviously differences in the value of the
"code" variable would have an effect as well, but are possibly less
likely.

You may want to lose the javascript too, to simplify debugging.  That
stuff _does_ run on the client, so may behave differently on Mozilla and
IE.  Personally I avoid DHTML like the plague (because it is so prone to
browser-specific problems) and so I don't know what your fragment is
supposed to achieve.

Cheers,
					Andrew.

> thanks
> 
> =====================================
> <html lang="en">
> <head> <title>Code Search</title>
> </head>
> <body>
> <center>
> 
> <table width="90%" border="0" cellspacing="1" cellpadding="0"
> bgcolor="lightblue">
> <form name="campcode" method="post" action="<?php print("$PHP_SELF");?>">
> <tr height=30><td>Search:</td><td><input type="text" name="code"></td>
> <td><input type="submit" name="submit" value="Search"></td></tr>
> </form></table>
>  </center>
> <br><br>
> <?php
>     $dbconnect = pg_connect("dbname=campus user=apache");
>     //$code_query = $code;
>     $code = strtolower($code);
>     if($submit) {

You could change that to:
      if ( "$code" != "" ) {


>       if($code=="") {print "You need to enter a query!"; exit;}
> 
>     //WORKS in Explorer
>     $qry_get_camp_codes = "select id,name from campuslist where name ilike
> lower('%HOUSTon%')";
>     //DONT WORK in Explorer
>     //$qry_get_camp_codes = "select id,name from campuslist where name ilike
> lower('%$code%')";
>     $result = pg_query ($dbconnect, $qry_get_camp_codes);
> 	  if (!$result) {printf ("Error\n"); exit;}
>       if (!pg_numrows($result)) { echo "<font color=\"red\" size=4>no
> result</font>"; exit;}
>     print "<center>";
>     print "<table border=1>";
> 	print "<tr><td>ID</td><td>NAME</td></tr>";
>     while($myrow = pg_fetch_row($result)) {
> 	printf ("<tr><td>%s</td><td>%s</td></tr>"
>     , $myrow[0], $myrow[1]);
>     }
>     printf ("</table></center>
>     ");
>     }
> pg_close($dbconnect);
> ?>
> </body>
> </html>
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
-- 
---------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St,  Wellington
WEB: http://catalyst.net.nz/         PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201     MOB: +64(21)635-694    OFFICE: +64(4)499-2267
           Survey for nothing with http://survey.net.nz/ 
---------------------------------------------------------------------




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2002-12-26 09:50 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-12-26 02:31 table not showing in explorer Bruce Young <hbrucey@yahoo.com>
2002-12-26 02:59 ` Andrew McMillan <andrew@catalyst.net.nz>
2002-12-26 05:02   ` Bruce Young <hbrucey@yahoo.com>
2002-12-26 09:50     ` Andrew McMillan <andrew@catalyst.net.nz>

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