[PHP] Post form values - script flow
I am very new to PHP about two hours. I have a search page that I post back to the same URL. When the form is loaded I check to see if the seach variable is set ($srch is the name of the text box on the form) and then determine what function to call. I either call a welcome message function to be printed to the page or a function to search a database and build a table of results. I have included my script belowMy question is: Is this a good way to handle search forms with PHP? Since I have no examples to work from I am not sure what the proper way is. Thanks for the help. if (isset($srch)){ if (strlen(trim($srch)) > 0) { $srch = strtoupper(trim($srch)); buildtable($srch); } else { dispwelcome(); } } else { dispwelcome(); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting only 255 chars from SQL Server
FYI: MS SQL Server 7 and greater, Varchar is a max of 8000 characters so it sounds like there is some limitation in the PHP functions that is limiting this. "Niklas lampén" <[EMAIL PROTECTED]> wrote in message 008901c1fa7b$14539d30$ba93c5c3@Niklas">news:008901c1fa7b$14539d30$ba93c5c3@Niklas... > The platform doesn't matter here, since VarChar's maximum length is 255 > chars, so everything above that is cutted away on insert. > Creating table with VarChar(800) should give an error.. > > > Niklas > > > -Original Message- > From: Michael Sims [mailto:[EMAIL PROTECTED]] > Sent: 13. toukokuuta 2002 15:32 > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Getting only 255 chars from SQL Server > > > On Sun, 12 May 2002 18:43:47 -0700, you wrote: > > >I have an SQL Server database running on a server on the internet. I > >need to have php connecting to the db and returning values. Simple > >stuff. No problem making the connection and getting data using the > mssql > >functions. The weird thing is that 4 of the fields in the table are > >vchar fields of length 800. When getting the data from the db for the > >web page, all that gets returned are the first 255 characters of each > >field. > > Are you using FreeTDS on *nix, or is this a Windows server making the > connection? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Retrieving Session Variables
I am having a problem getting a session variable in the function (currentlogin) below. I can process the script and in the else statement "print ($HTTP_SESSION_VARS['name']);" the session variable is printed but when the function tries to print the session variable, I get an error indicating an undefined variable. If someone could help me out I would appreaciate it. Is there a good tutorial on how to set and get session variables. From some of the snippets I have read in this news group there appears to be several ways to accomplish this. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Apache & IIS with PHP - Same System
Are there any issues with running Apache and IIS on the same system both using PHP? The only obvious problem I can think of is I will need to configure Apache to use some other port (other than 80). Any pointers would be greatly appeciated. Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Create table with varying results
I have a search page that creates a dynamic table of results from MS SQL Server. The table created on the web page does not always get created properly for the same recordset. Sometimes a field may have a black or red background color and if the same exact search is run again it will display properly. If I have a search with large number of records (few thousand) there is usually html text printed above the table of results. If I perform the exact search multiple times, I will get different html text printed above the table. It seems as if the PHP engine/interpretor is not processing the script properly. I would think if I had a syntax issue with the script or HTML it would either error out or return the same results everytime. Has anyone else seen this problem before? w2k SP2 IIS PHP 4.2.1 Thanks for the help. Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Create table with varying results
The source HTML (PHP Output) is sometimes correct and sometimes incorrect with the exact same script and SQL statement. The table is very basic. I thought maybe I had some problems with formatting variables in the HTML so I took all the formatting out of the script so it is really basic now and still have the same problem. I also thought maybe there were issues with the data...i.e. with nulls and non-alpha-numeric characters. I cleaned all the data so there is no null data and all characters are alpha-numeric. Still have the same problem. Very strange. Tim "Miguel Cruz" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Are you using Internet Explorer for Windows to view the HTML? It has some > rendering problems with complex tables that result in very erratic > behavior in certain circumstances (which I have yet to understand). View > the page in another browser, or better yet, view the source code. That's a > better way to determine whether or not your program is generating the > correct data. > > miguel > > On Thu, 23 May 2002, Tim Greenleaf wrote: > > I have a search page that creates a dynamic table of results from MS SQL > > Server. The table created on the web page does not always get created > > properly for the same recordset. Sometimes a field may have a black or red > > background color and if the same exact search is run again it will display > > properly. If I have a search with large number of records (few thousand) > > there is usually html text printed above the table of results. If I perform > > the exact search multiple times, I will get different html text printed > > above the table. > > > > It seems as if the PHP engine/interpretor is not processing the script > > properly. I would think if I had a syntax issue with the script or HTML it > > would either error out or return the same results everytime. > > > > Has anyone else seen this problem before? > > > > w2k SP2 > > IIS > > PHP 4.2.1 > > > > Thanks for the help. > > > > Tim > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Create table with varying results
Hi Miguel, The errors appear to be the result of strings not terminating properly from the PHP output. Then partial HTML code is inserted in cells or at the top of the table. I have stripped everything out and am now just creating a loop to build a table and still get the same errors. I have checked it with IE 5.5, IE 6, NS 4.78 and NS6.2.2 all with the same type of errors. Here is a link to the page that creates the table: http://www.coloradowinware.com/sample/error/sample.php Depending on your connection speed it may take a few seconds, it is generating 650 rows. You may need to refresh a couple of times to see the errors. Some times there is text printed above the table and sometimes there is partial html in table cells and other times there may be colored cells. Here is the source for the page: Thanks for your help. PHP Test "; print ""; print " "; print "Name"; print "Phone"; print "E-Mail"; print "Department"; print " "; print ""; //end print header row $i=0; $number = 650; while ($i < $number) : $name = "Fred Flintstone"; $email = "My Mail"; $department = "Department"; print ""; print "" . $i . ""; print "fred"; print "255-3698"; print "mailto:[EMAIL PROTECTED]>fred"; print "department"; print " "; print ""; $i++; endwhile; // close table print ""; return; } ?> "Miguel Cruz" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > What is the specific nature of the errors in the HTML? Are random > characters missing/inserted, or does it look like something that could > happen as a result of unexpected program behavior at a higher level? > > miguel > > On Thu, 23 May 2002, Tim Greenleaf wrote: > > The source HTML (PHP Output) is sometimes correct and sometimes incorrect > > with the exact same script and SQL statement. The table is very basic. > > > > I thought maybe I had some problems with formatting variables in the HTML so > > I took all the formatting out of the script so it is really basic now and > > still have the same problem. I also thought maybe there were issues with > > the data...i.e. with nulls and non-alpha-numeric characters. I cleaned all > > the data so there is no null data and all characters are alpha-numeric. > > Still have the same problem. > > > > Very strange. > > > > Tim > > > > > > > > > > > > > > "Miguel Cruz" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Are you using Internet Explorer for Windows to view the HTML? It has some > > > rendering problems with complex tables that result in very erratic > > > behavior in certain circumstances (which I have yet to understand). View > > > the page in another browser, or better yet, view the source code. That's a > > > better way to determine whether or not your program is generating the > > > correct data. > > > > > > miguel > > > > > > On Thu, 23 May 2002, Tim Greenleaf wrote: > > > > I have a search page that creates a dynamic table of results from MS SQL > > > > Server. The table created on the web page does not always get created > > > > properly for the same recordset. Sometimes a field may have a black or > > red > > > > background color and if the same exact search is run again it will > > display > > > > properly. If I have a search with large number of records (few > > thousand) > > > > there is usually html text printed above the table of results. If I > > perform > > > > the exact search multiple times, I will get different html text printed > > > > above the table. > > > > > > > > It seems as if the PHP engine/interpretor is not processing the script > > > > properly. I would think if I had a syntax issue with the script or HTML > > it > > > > would either error out or return the same results everytime. > > > > > > > > Has anyone else seen this problem before? > > > > > > > > w2k SP2 > > > > IIS > > > > PHP 4.2.1 > > > > > > > > Thanks for the help. > > > > > > > > Tim > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Create table with varying results
Hi Miguel, Thanks for looking. It may take three or four times at most. I don't know if you scrolled the table each time but it is random and sometimes not apparent but here is the contents of an e-mail address cell at line 433. fredded width='22%' bgcolor='#FF'>department Other "e-mail" cells have department it them. I have tried on two different w2k machines with IE and Netscape. Thanks anyway. "Miguel Cruz" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Like John, I tried several times (both Mac and Windows IE) and never got > anything funny. How many times do you usually have to refresh before you > see the problem? (I think I viewed it 4 times). > > miguel > > On Thu, 23 May 2002, Tim Greenleaf wrote: > > The errors appear to be the result of strings not terminating properly from > > the PHP output. Then partial HTML code is inserted in cells or at the top > > of the table. > > > > I have stripped everything out and am now just creating a loop to build a > > table and still get the same errors. I have checked it with IE 5.5, IE 6, > > NS 4.78 and NS6.2.2 all with the same type of errors. > > > > Here is a link to the page that creates the table: > > http://www.coloradowinware.com/sample/error/sample.php Depending on your > > connection speed it may take a few seconds, it is generating 650 rows. You > > may need to refresh a couple of times to see the errors. Some times there > > is text printed above the table and sometimes there is partial html in table > > cells and other times there may be colored cells. > > > > Here is the source for the page: > > > > Thanks for your help. > > > > > > > > > > PHP Test > > > > > > > > > > > buildtable() > > ?> > > > > > function buildtable() > > { > > > > //print header row > > print " > id='AutoNumber2' style='border-collapse: collapse' bgcolor='#FF'>"; > > print ""; > > print " "; > > print " > size='2' face='Verdana'>Name"; > > print " > face='Verdana'>Phone"; > > print " > face='Verdana'>E-Mail"; > > print " > face='Verdana'>Department"; > > print " "; > > print ""; > > //end print header row > > > > $i=0; > > $number = 650; > > while ($i < $number) : > > $name = "Fred Flintstone"; > > $email = "My Mail"; > > $department = "Department"; > > > > print ""; > > print " > bgcolor='#FF'>" . $i . ""; > > print " > face='Verdana'>fred"; > > print " > face='Verdana'>255-3698"; > > print " > href=mailto:[EMAIL PROTECTED]> > face='Verdana'>fred"; > > print " > face='Verdana'>department"; > > print " "; > > print ""; > > $i++; > > endwhile; > > > > // close table > > print ""; > > > > return; > > } > > ?> > > > > > > > > > > > > > > > > "Miguel Cruz" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > What is the specific nature of the errors in the HTML? Are random > > > characters missing/inserted, or does it look like something that could > > > happen as a result of unexpected program behavior at a higher level? > > > > > > miguel > > > > > > On Thu, 23 May 2002, Tim Greenleaf wrote: > > > > The source HTML (PHP Output) is sometimes correct and sometimes > > incorrect > > > > with the exact same script and SQL statement. The table is very basic. > > > > > > > > I thought maybe I had some problems with formatting variables in the > > HTML so > > > > I took all the formatting out of the script so it is really basic now > > and > > > > still have the same problem. I also thought maybe there were issues > > with > > > > the data...i.e. with nulls and non-alpha-numeric characters. I cleaned > > all > > > > the data so there is no null data and all characters are alpha-numeric. > > > > Still have the same problem. &
[PHP] Re: Create table with varying results
HI have gone to 5 different machines now and still have the same issues even though others who have replied indicate they don't see a problem with the output. It must be the crack I am smoking these days. Maybe the errors are too subtle that no one else notices? I have changed the file to ASP and only changed the print to Response.Write and removed PHP syntax and the table creates perfectly every time on every machine with mulitple browsers. I have come to the conclusion PHP is the problem...or at least the installation on my machine. Maybe I will try installing Apache and see if the results are different. Thanks for the help. Tim "Tim Greenleaf" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have a search page that creates a dynamic table of results from MS SQL > Server. The table created on the web page does not always get created > properly for the same recordset. Sometimes a field may have a black or red > background color and if the same exact search is run again it will display > properly. If I have a search with large number of records (few thousand) > there is usually html text printed above the table of results. If I perform > the exact search multiple times, I will get different html text printed > above the table. > > It seems as if the PHP engine/interpretor is not processing the script > properly. I would think if I had a syntax issue with the script or HTML it > would either error out or return the same results everytime. > > Has anyone else seen this problem before? > > w2k SP2 > IIS > PHP 4.2.1 > > Thanks for the help. > > Tim > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php