RE: [PHP-DB] page expires
http://php.sitecreative.com/faq.php -Original Message- From: Natividad Castro [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 17, 2002 6:12 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] page expires Hi to all, I have form that users fill out and submit. What I'm trying to do is not to let users to go back to the form after they have submmited, or if they go bak, make the page expires. Can someone please tell me or give an idea on how to do it? Thanks in advanced Nato -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] appending new entry to old entries
Not sure if you're asking whether you can append info onto the end of a database field without having to get the previous information, but you can. UPDATE table SET MyField=CONCAT(MyField,'Appended Text') WHERE Some_ID=5; That would update the row identified by Some_ID = 5, and append "Appended Text" to the end of MyField without a query to get the previous values. For numeric fields, you can also increment them like this: UPDATE table SET MyNumericField = MyNumericField + 1; That would update all rows in table, incrementing every row's MyNumericField value by 1. - Jonathan -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 18, 2002 2:27 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] appending new entry to old entries On Thursday 18 April 2002 16:51, Ron Allen wrote: > I would like to make it so that my helpdesk section can append entries in > their Master Station Log. Update replaces the entryany clues?? You would have to get the original value, append the new stuff then do UPDATE. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* There is very little future in being right when your boss is wrong. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP to Fax
Okay, this is a new one. I'm trying to figure out the best way to send a GIF or JPG image to a fax machine using PHP and probably some other service (since I can't think of any PHP functions that deal with faxing). #1 Now, does anyone know of a good service that I could use that would work well with scripting? #2 Does anyone know about fax servers or how to obtain one? - Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Saving DB Resuts to a file
Hi Chris, This is probably due to a permissions problem on your newsletter subdirectory. Go to the server and change the newsletter subdirectory's permissions to be 777 (leaving it that way could be a security hazard, depending on if you have important information stored in that directory or not, and if there are other people that could get on the server). Then try running the script again. - Jonathan -Original Message- From: Chris Payne [mailto:[EMAIL PROTECTED]] Sent: Friday, April 12, 2002 1:52 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Saving DB Resuts to a file Hi there, I entered the code in as you described below, and it LOOKS on the screen as thought it is doing it, but when I look at the server there is no output file, can you see anything obvious that I am doing wrong? Thanks for your help. Chris $connection = mysql_connect("localhost","xx","xx") or die("Couldn't make a connection."); // select database $db = mysql_select_db("mailinglist", $connection) or die("Couldn't select database."); return $connection; $query = mysql_query("select * from emaillist"); fopen("/web/newsletter/test.txt", w); while ($row = mysql_fetch_array($query)) { fwrite("$row[EMail]\n"); echo $row[EMail]; } fclose("/web/newsletter/test.txt"); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] How to avoid: Warning: Page has Expired
I've addressed this problem here: http://php.sitecreative.com/faq.php - Jonathan -Original Message- From: John Hughes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 09, 2002 12:30 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] How to avoid: Warning: Page has Expired I have the first part of the kids' soccer photo database site up that I mentioned in an earlier post. The site displays nine image thumbnails. You click on the thumbnails and are taken to a full size photo. Everything works as expected for the first nine images but when you go to the next page of thumbnails, you start getting: Warning: Page has Expired The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you. To resubmit your information and view this Web page, click the Refresh button. What causes this and how can I fix it so this doesn't happen? The URL for this site is http://fuzzheads.org/barcelona TIA John Hughes -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Editing/Updating Data with Forms
Just look at your basic PHP tutorials like Devshed's PHP 101: http://www.devshed.com/Server_Side/PHP/PHP101 - Jonathan -Original Message- From: Evans, Josh [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 7:31 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Editing/Updating Data with Forms Can anyone help me with editing/updating data in a table with using a form? Josh Evans ACS Helpdesk [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] grouping by category
Hi Big Al, You're just running full-steam ahead into these mailing lists. :) Anyhow, as olinux pointed out, you can get everything you want in one query, but I would choose a different query (no need to GROUP BY category), and then use a multi-dimensional array to organize the data. Here's my version of your code: $Value) { // Store all fields except for num and category, because // we already have those. if(($ColumnName != "num") && ($ColumnName != "category")) { $Reviews[$Category][$ReviewNum][$ColumnName] = $Value; } } } // Add reviews to a multi-dimensional array - END /* Now you should have an array that looks like: $Reviews["Video Cards"][1]["author"] = "Chuck Jones"; $Reviews["Video Cards"][1]["url"] = "http://www.chuckjones.com";; $Reviews["Video Cards"][1]["some_other_col_name"] = "col_value"; $Reviews["Video Cards"][6]["author"] = "Bill Smith"; $Reviews["Video Cards"][6]["url"] = "http://www.billsmith.com";; $Reviews["Video Cards"][6]["some_other_col_name"] = "col_value"; $Reviews["Memory"][3]["author"] = "Joe Bob"; $Reviews["Memory"][3]["url"] = "http://www.joebob.net";; $Reviews["Memory"][3]["some_other_col_name"] = "col_value"; */ // Go through array foreach($Reviews as $CategoryName => $SingleReview) { // Print out the category name print "" . $CategoryName . ""; // List all the reviews foreach($SingleReview as $ReviewNum => $ReviewDetails) { print "- " . $ReviewDetails["name"] . " (Written by: " . $ReviewDetails["author"] . ")"; } } ?> Now, that should give you a real basic listing looking like: Category 1 - Review Name (Written by: Author) - Review Name (Written by: Author) Category 2 - Review Name (Written by: Author) - Review Name (Written by: Author) There are some nice perks about the above code. If you added, for instance, a field called "rating" to the database, and you wanted to display the value in the listings, all you would need to do is to add "rating" to your beginning SELECT statement. At that point, it would instantly be available in the bottom $ReviewDetails array as $ReviewDetails["rating"]. The multi-dimensional arrays are a little hard to grasp at first, but they can make things a lot easier to read/understand, which is what I strive for in my coding (over speed). You never know who will one day read your code... - Jonathan -Original Message- From: Alex Behrens [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 03, 2002 6:16 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] grouping by category Hey Guys, I'm trying to get my script to group all my reviews by category now but now it just displays them all in a row a bunch of times and doesn't group them how I want it to group them. I want it too look like this: Processor Reviews - Review - Review Motherboard Reviews - Review -Review Heres my syntax, and the page is online here (http://www.hardware-unlimited.com/hardware2.php) so you can see how it is executed now: "; echo "- $name (Written by: mailto:$email\";>$author) - [Description]"; } // end review while } // end category while ?> What do I need to do? Thanks! -Alex "Big Al" Behrens E-mail: [EMAIL PROTECTED] Urgent E-mail: [EMAIL PROTECTED] (Please be brief!) Phone: 651-482-8779 Cell: 651-329-4187 Fax: 651-482-1391 ICQ: 3969599 Owner of the 3D-Unlimited Network: http://www.3d-unlimited.com Send News: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: autoincrement
To add to that, yes, the column must be numeric and it must also be your PRIMARY KEY column to be able to have the autoincrement attribute, not just a regular index. - J -Original Message- From: Glenn Holden [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 6:12 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: autoincrement First, I think an AUTO_INCREMENT column must be a numeric column, not TEXT. Second, be sure this column is indexed. If you have trouble, send us the results of a DESCRIBE TABLE `ajj47592`.`content`; statement. That may help us give you some specific syntax to try. Glenn "Daniel Broome" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Here is the info that I used,I think there is something elce that I have to > do but I have done everything to my know how.. > > Please help > > SQL-query : > > ALTER TABLE `ajj47592`.`content` CHANGE `code` `code` TEXT NOT NULL > AUTO_INCREMENT > > > MySQL said: > > > Incorrect column specifier for column 'code' > > > "Daniel Broome" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I am trying to add auto increment to a table I have already created in > > phpMyAdmin but I keeps coming up with an error. > > what can I do to fix this? > > > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] need some help...
Thank you. Someone else exists who has the sense of mind to use single quotes. I hate looking at other people's code that has tons of \"s in it. - Jonathan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 02, 2002 5:00 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] need some help... Not really a database question, but why not... Step 1: Clean up the code... a) Convert all double-quote to single quotes in the HTML portion. I usually use doubles for PHP and singles for HTML. I hate having to escape quotes. b) Use of spacing and indentation. old ** - %s",$a["url"],$a["picurl"],$a["picurl"],$a["title"]) ; } ?> ** new ** - %s",$a["url"],$a["picurl"],$a["picurl"],$a["title"]); } ?> ** Since you have to put a string value, assign all output to a single string called $output. Note that I moved your printf() to an echo, and simplified your output string by preassigning variables. An extra step, but greatly enhances readability and maintenance... Also remember that the ".=" is an append operator whereas "=" is assignment. even newer ** // Assign the stuff before... $output = " "; - $title "; } ?> // finish the structure HTML $output .= " "; // Now fopen() the file, fputs the $output, and fclose() the file. ** http://www.php.net/manual/en/function.fopen.php http://www.php.net/manual/en/function.fputs.php http://www.php.net/manual/en/function.fclose.php Party on! -Szii -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Pop up are you sure...
I was close. :) -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Monday, April 01, 2002 10:53 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Pop up are you sure... On Tuesday 02 April 2002 01:30, Jonathan Hilgeman wrote: > You're so negative, Jason. :) No, my answer was just short and to the point ;-) > Long answer, Dave, it wouldn't be wise to do this via Javascript. My long answer was going to be: it's possible to do it in PHP, but then it would not look like a pop-up window, and it requires a trip back to the server. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* Love is being stupid together. -- Paul Valery */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Pop up are you sure...
You're so negative, Jason. :) Long answer, Dave, it wouldn't be wise to do this via Javascript. Javascript can be turned off and also varies from browser to browser (like any client-side language/scripting), so this raises an issue of reliability. You may be able to do it if you're working on an intranet where you know that all users have the same browser, have Javascript turned on, and don't have access to turn it off, OR if this is for your own use and you don't want to make it screw up. Otherwise, it might be a nice feature, but you shouldn't rely on it. If you WERE going to do it, I would have your main form have a hidden input called "Confirm" and set it to a value of 1. Then, have a "Button" (not a submit button) use Javascript to open a new browser/popup window (you can format it to look like a regular Yes/No windows popup box). Have the "Yes" I-want-to-delete-this-record button change its parent window's form and change the "Confirm" input's value to 0 and submit the parent window's form in order to delete the record. Have the No button just close the popup/new window. Now, on the page that actually deletes the record, first check the Confirm variable. If it is set to 0, then you can figure that the Javascript set it to 0, and you can go ahead and delete the record without asking. Otherwise, show a regular HTML screen that asks if you really want to delete this record (no Javascript this time), so you can be covered if Javascript gets turned off. This is by no means a fool-proof method, and you should think carefully through all this before implementing a Javascript solution, but I find that there are better methods with PHP. For instance, you can have 3 checkboxes side-by-side that can act as the "yes-I-really-really-want-to-delete-this-record" safety. PHP can check to see if all 3 checkboxes were checked, and then you can know that the user was intentionally trying to delete that record, and you can go ahead and delete it - no Javascript needed. :) As far as the Javascripting goes, though, I would check out some JS forums for help on how to set up the actual scripting part of the popup box. But, as Jason probably was thinking, Javascript is never a very good thing to use with things that are delicate, fragile, or valuable in any way. It's like hiring an ex-thief to help you move - you can never be SURE that everything's going to be there in the end. - Jonathan -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Monday, April 01, 2002 12:45 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Pop up are you sure... On Monday 01 April 2002 16:44, Dave Carrera wrote: > Hi All > > > > How do you do this? Use javascript. > On click of button to delete a record make a popup yes / no box appear. > On yes then do it else stop. > > > > Is it possible to do with out using JS? Short answer, no. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* Timing must be perfect now. Two-timing must be better than perfect. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Table structure and displaying certain thing
Hi Jennifer, Okay first, in your current page, just do one SQL statement that selects the 4 fields you want all at once, then use extract() to turn the record/result into variables, and print out your form like: 0) { print ""; // Get Record and Echo/Print Out Data while($rec = mysql_fetch_assoc($ret)) { extract($rec); echo ""; echo "$name"; echo "Quantity $quantity"; echo "Cost: $price SC"; echo ""; } print ""; } else { // Say there's a problem and echo the error message to an HTML comment. print "There was a problem while fetching the item from the database.\n"; print "\n"; } ?> ... Now you'll have a file that will post a field called ItemID containing the ID number (in this case, 1) to buyitem.php. Now you just code buyitem.php to add the product to the user's "basket". There are several ways of doing that, but this should be the proper stepping stone. - Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] int or tinyint
Hi Jennifer, In most cases, it's best to use int. The difference between the two is simply the range of numbers they can show. Tinyint is fine for cases where you know you'll never need more than 127 (or 255 if you tell MySQL that it is an UNSIGNED tinyint, which just means that it can't have negative numbers so it now has that much more room for positive numbers; the UNSIGNED literally means that it doesn't have a positive or negative sign, so everything's defaulted to positive). If you use a regular tinyint on an auto-incrementing field like "member_id" and you get 127 members, you won't get any more. Each attempted INSERT query after the 127th member will have an error saying something about duplicate keys for 127 (it's trying to insert a new one, but it can only go up to 127, so it tries to insert a new member with an id of 127, but there's already one there). So in short, use int in most cases. It doesn't take up that much more space, and has a much wider range of numbers it can hold (someone else said 2 billion-something, which I think is right). But from what I currently understand (someone can correct me if I'm wrong), you are also limited to the digits/length you specify for the field. For instance, an int(5) can only hold 5 digits, so you could go up to 99,999 maximum and down to -99,999 (unless you had an UNSIGNED int, in which case, there would be no negative numbers, but you're still limited to 5 digits). An int(6) could hold 6-digit numbers up to 999,999, etc... - Jonathan -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Sunday, March 31, 2002 10:06 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] int or tinyint Hi all, Just a simple question (I think). When should I use tinyint over int. and what is the difference between the two? Thanks Jennifer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] help with preg_replace for http://
Just do a while loop: while(preg_match("/string to find unconverted links/", $TextBody)) { // preg_replace here } But make sure you're not doing this on the fly every time the page is viewed. That will take up an enormous amount of resources with lots of visitors. Just convert it and save the converted version for viewing. - Jonathan -Original Message- From: Kevin Won [mailto:[EMAIL PROTECTED]] Sent: Friday, March 29, 2002 11:46 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] help with preg_replace for http:// I'm writing a knowledgebase (basically a content management system) application where people are adding text via web forms then viewing this data on the web. standard bread-and-butter kind of stuff. of course people want to put in their hyperlinks in the page w/o having to do any sort of html coding. I'm having a hard time getting my regular expression to work correctly to match for anything that starts with http:// and ends with a space character, extracting this as a $string, then formatting the hyperlink as $string on the knowledgebase viewing scripts. The one I've written matches and replaces only the first instance of http:// in the string. (which solves problems as long as there is only one hyperlink in the page ;-) thanks kevin Kevin Won - ITG Web Developer, Systems Administrator Oregon Health Sciences University (503) 418-4282 cell: (503) 913-5367 page: x15897 fax: (503) 494-1888 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re[2]: [PHP-DB] Insert into command - PHP
Well first, I don't know if you copied and pasted directly from your file, but you're building your query in the variable $sql AFTER you run the query: mysql_query($sql) or die(msql_error()); $sql = "Insert into table ('$field1','$field2',,'$field61')"; It should be: $sql = "Insert into table ('$field1','$field2',,'$field61')"; mysql_query($sql) or die(msql_error()); However, you should also use the coding practice of: $sql = "INSERT INTO table SET NameOfField1='ValueOfField2',Field2='Value',Field3='Value', etc;" It's a little easier to read and understand. Note that you don't really have to do anything special to be able to separate the query onto multiple lines: $sql = "INSERT INTO table SET field='value', field2='value'; "; mysql_query($sql) or die(msql_error()); ... will work fine. No need for special characters - PHP will recognize values and strings that are on multiple lines AS LONG AS the value starts and ends with quotes (and the semicolon at the end). - Jonathan -Original Message- From: Ethan J. Mings [mailto:[EMAIL PROTECTED]] Sent: Friday, March 29, 2002 9:11 AM To: Jonathan Hilgeman Subject: Re[2]: [PHP-DB] Insert into command - PHP PHP-DB Mailing List Hello Jonathan, -- Friday, March 29, 2002, 11:53:31 AM, you wrote: > ...after you have run the query. Give us the output and your query and we > can help a bit more. Hi, thanks for the follow up. I included the following command in the line... mysql_query($sql) or die(msql_error()); $sql = "Insert into table ('$field1','$field2',,'$field61')"; The message returned was, "Query was empty" I am suspect of the 61 fields. The line travels far out to the right. Is there a way to properly code the line so it does not go so far to the right. Otherwise, no other report errors. -- Ethan J. Mings Office E-mail [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: displaying info in a form
People have already answered this question, but here are some additional tips. Always make sure you include the NAME attribute of an INPUT - otherwise it can cause some headaches when you try to get the submitted data on the next page. So: You can also shorten the echo/print statement down to: I've heard that you can leave off the semi-colon, but I just consider it good coding habit to always end statements with semi-colons. - Jonathan -Original Message- From: Luis R. Sales Glez. [mailto:[EMAIL PROTECTED]] Sent: Friday, March 29, 2002 9:30 AM To: Natividad Castro Cc: [EMAIL PROTECTED] Subject: [PHP-DB] Re: displaying info in a form Hi Natividad & *: Try to declare the input file as: instead of > Regards, -- Luis R. Sales Glez. Database Administrator Information Systems & Solutions Sony Latin America Inc. Mailto: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Insert into command - PHP
You can check to see if there were any insert errors by: print mysql_error(); ...after you have run the query. Give us the output and your query and we can help a bit more. - Jonathan -Original Message- From: Ethan J. Mings [mailto:[EMAIL PROTECTED]] Sent: Friday, March 29, 2002 6:34 AM To: PHP Mailing List Subject: [PHP-DB] Insert into command - PHP Crafted from The Desk on location in the Quality Lab. Hello PHP, -- I'm using the mysql_query() function. I have 61 fields (e.g, '$fname','$lname'etc) to insert into the data table. No matter what I do, the data is not loaded into the table. I've tried smaller tables with less than 11 fields and the data is loaded correctly. Question: [1] Does PHP have a limit on the number of fields? [2] How does one stop the line from running to the right. "\n" does not appear to work. Any insights would be extremely helpful. If you can point me to a direct resource on the web, I'm glad to do the homework. Thanks. -- Best regards, Ethan J. Mings mailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Unknown column 'Test' in 'field list'
Even though this is solved, I should mention a method that I find to be personally easier to use when INSERTing records. Simply use the field=value method: INSERT INTO MyTable SET firstname='Joe', lastname='Bob', age=58; By doing it this way, you don't have to worry about matching up the number of columns to values, or the order of the fields (the above example could have age or lastname as the first value without changing the output). Not to mention this method is a little easier to read and easier to construct. - Jonathan -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 6:55 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Unknown column 'Test' in 'field list' Never mind I forgot to put ' ' around $u_name in my insert. Jen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] https post via php
The only way I can think of doing this is via cURL, so you'll need to either have the hosting company recompile their PHP with cURL (something any decent hosting company should do - it's not a difficult process), or have them provide an external curl module (like an .so file) so you can use the dl() function load it, which is basically the same as having curl compiled, but a tiny bit slower. Or you could also install the command-line version of cURL or any other https posting 3rd-party programs and have PHP use the command-line tools to post to https, but there's no other way that I know of. - Jonathan -Original Message- From: mailing list [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 6:39 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] https post via php Hello, I am attempting to POST to a https://whatever.url.com server and return the result from the server into the script without the user knowing using a php script. I can not use CURL becuase the shared server I have hosting this site was not compiled -with-curl. I downloaded HTTP_POST PHP script from: http://px.sklar.com/code.html?code_id=313. Here is my code that I am using to call the functions: set_server("onlinechecks.interceptcorporation.com"); $a->set_port("443"); $a->set_file("/icolc/short.cgi"); $a->set_action("https://onlinechecks.interceptcorporation.com/icolc/short.cg i"); $a->set_enctype("application/x-www-form-urlencoded"); $a->set_element(array("MEN" => "789","MPA" => "456", "MID" => "7015","CRO" => "123456780","CAC" => "123123123", "CPH" => "17015551212","PAM" => "12.34")); $a->set_timeout(20); $a->show_post(); $a->send($display=1); ?> Here is the result returned from the browser: Bad Request Your browser sent a request that this server could not understand. Reason: You're speaking plain HTTP to an SSL-enabled server port. Instead use the HTTPS scheme to access this URL, please. Hint: https://206.11.164.21/ Apache/1.3.20 Server at 206.11.164.21 Port 80 Does anyone have any ideas? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] include() statement hell!
No problem. I wonder if there's a web-based syntax checker for PHP... - Jonathan -Original Message- From: Brad Melendy [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 12:23 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] include() statement hell! Man, this means I have to walk around the block with a sign on my back saying, "I'm a %*$&-ASS" for letting that one get by. ;-) Thanks a ton Jonathan. It of course, works now. I think it will be a while before I make that mistake again. ...Brad "Jonathan Hilgeman" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > This might be your problem: > > Try: > > :) > > - Jonathan > > -Original Message- > From: Brad Melendy [mailto:[EMAIL PROTECTED]] > Sent: Thursday, March 28, 2002 12:06 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] include() statement hell! > > > Thanks Jonathan, > Your suggestions were very helpful, especially turning on the error logging. > Here is where I'm at now: > > Files in use: > /include/dblib.inc > /include/userlib.inc > /main/page.php > > My include statements in /main/page.php: > include("../include/dblib.inc"); > include("../include/userlib.inc"); > > All the fuctions I call from dblib.inc work great, however, I have only a > single function in userlib.inc and it generates an error. The error I get > is: > > Fatal error: Call to undefined function: cleansession() > > Here is the file userlib.inc: > > session_start(); > session_register( "session" ); > > function cleanSession( $id, $login, $pass ) > { > global $session; > $session[id] = $id; > $session[login] = $login; > $session[password] = $pass; > $session[logged_in] = true; > } > ?> > > Lastly, if I paste the above function into page.php (without the > session_start and session_register lines) it works fine. I've tried giving > the function a different name, changing case, all sorts of stuff. I've > tried renaming it to userlib.php and I've opened the file directly in my > browser with the error_reporting(2039); at the top and no error messages, > yet it is as if the file never gets included. I've tried including ONLY > userlib.inc and pasting all the dblib.inc functions into page.php (to rule > out dblib.inc screwing things up) and still I get the error. > > I am truly confounded at this point. Thanks for any suggestions you have. > I think I am almost out of "Include Statement Hell". ;-) > > ...Brad > > "Jonathan Hilgeman" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > So, maybe this is the question. Can you include a file from > > > /main/page.php by using a path of /includes/dblib.inc? > > > > Probably not. PHP can "see" the whole filesystem, not just the area that > is > > limited to your account. So, when you try to include "/includes/dblib.inc" > > it is trying to go down to the SYSTEM root and open up a subdirectory > called > > includes and get the file dblib.inc inside it. > > > > If you copy the dblib.inc to the same directory as page.php, you should > only > > have to say: > > include("dblib.inc"); > > > > However, if you have this layout: > > /your/account/dir/main/page.php > > /your/account/dir/includes/dblib.inc > > /your/account/dir/includes/userlib.inc > > > > Then page.php would have to say: > > include("../includes/dblib.inc"); > > > > Which would go back one directory, THEN into the includes subdirectory, > and > > then it could find dblib.inc > > > > I would definitely add: > > error_reporting(2039); > > > > ...to the top of your page.php code to see if you can pick up any errors. > > Also, check your error log if you have one (contact your hosting company > if > > you're not sure). > > > > I would definitely try to solve this the normal way by finding the problem > > with the paths rather than trying to screw with your php.ini or httpd.conf > > file - otherwise you'll have a script that might not work if you ever have > > to move your scripts or copy them to a development server or something. > > > > - Jonathan > > > > -Original Message- > > From: Brad Melendy [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, March 27, 2002 7:27 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP-DB] include() statement hell! > > > > > > Thanks Jonathan, > > I
RE: [PHP-DB] include() statement hell!
You should also put quotes around your keys in your arrays if they're non-numeric. For instance: $session["logged_in"] instead of $session[logged_in] It's good coding habit, and it sometimes will save you from some "constant" headaches (pun intended for everyone who has run into this problem before). - Jonathan -Original Message- From: Brad Melendy [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 12:06 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] include() statement hell! Thanks Jonathan, Your suggestions were very helpful, especially turning on the error logging. Here is where I'm at now: Files in use: /include/dblib.inc /include/userlib.inc /main/page.php My include statements in /main/page.php: include("../include/dblib.inc"); include("../include/userlib.inc"); All the fuctions I call from dblib.inc work great, however, I have only a single function in userlib.inc and it generates an error. The error I get is: Fatal error: Call to undefined function: cleansession() Here is the file userlib.inc: Lastly, if I paste the above function into page.php (without the session_start and session_register lines) it works fine. I've tried giving the function a different name, changing case, all sorts of stuff. I've tried renaming it to userlib.php and I've opened the file directly in my browser with the error_reporting(2039); at the top and no error messages, yet it is as if the file never gets included. I've tried including ONLY userlib.inc and pasting all the dblib.inc functions into page.php (to rule out dblib.inc screwing things up) and still I get the error. I am truly confounded at this point. Thanks for any suggestions you have. I think I am almost out of "Include Statement Hell". ;-) ...Brad "Jonathan Hilgeman" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > So, maybe this is the question. Can you include a file from > > /main/page.php by using a path of /includes/dblib.inc? > > Probably not. PHP can "see" the whole filesystem, not just the area that is > limited to your account. So, when you try to include "/includes/dblib.inc" > it is trying to go down to the SYSTEM root and open up a subdirectory called > includes and get the file dblib.inc inside it. > > If you copy the dblib.inc to the same directory as page.php, you should only > have to say: > include("dblib.inc"); > > However, if you have this layout: > /your/account/dir/main/page.php > /your/account/dir/includes/dblib.inc > /your/account/dir/includes/userlib.inc > > Then page.php would have to say: > include("../includes/dblib.inc"); > > Which would go back one directory, THEN into the includes subdirectory, and > then it could find dblib.inc > > I would definitely add: > error_reporting(2039); > > ...to the top of your page.php code to see if you can pick up any errors. > Also, check your error log if you have one (contact your hosting company if > you're not sure). > > I would definitely try to solve this the normal way by finding the problem > with the paths rather than trying to screw with your php.ini or httpd.conf > file - otherwise you'll have a script that might not work if you ever have > to move your scripts or copy them to a development server or something. > > - Jonathan > > -Original Message- > From: Brad Melendy [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, March 27, 2002 7:27 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] include() statement hell! > > > Thanks Jonathan, > I'm trying to include a file /includes/dblib.inc from /main/page.php. In > /main/page.php I use include("includes/dblib.inc");. When that didn't work, > I tried copying the file to /main/ and including it there and that didn't > work either. Finally, I tried adding a specific path to the php.ini file > for includes_path and put the files there and that worked. Then I went and > changed the php.ini file to remove the reference (still trying to get it to > work the way I THINK it should) and then it WORKED! But ONLY from within > /main/. Each time I make these changes, I am making a matching change in > the actual include() statement at the top of /main/page.php and I am > restarting apache each time I change php.ini. > > So, maybe this is the question. Can you include a file from /main/page.php > by using a path of /includes/dblib.inc? > > dblib.inc has functions that do connections and queries to a mysql database. > Even stranger yet, is that I have one other include file called userlib.inc > that has authentication related session functions. Well, that hasn't worked > at all no
RE: [PHP-DB] include() statement hell!
This might be your problem: mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 12:06 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] include() statement hell! Thanks Jonathan, Your suggestions were very helpful, especially turning on the error logging. Here is where I'm at now: Files in use: /include/dblib.inc /include/userlib.inc /main/page.php My include statements in /main/page.php: include("../include/dblib.inc"); include("../include/userlib.inc"); All the fuctions I call from dblib.inc work great, however, I have only a single function in userlib.inc and it generates an error. The error I get is: Fatal error: Call to undefined function: cleansession() Here is the file userlib.inc: Lastly, if I paste the above function into page.php (without the session_start and session_register lines) it works fine. I've tried giving the function a different name, changing case, all sorts of stuff. I've tried renaming it to userlib.php and I've opened the file directly in my browser with the error_reporting(2039); at the top and no error messages, yet it is as if the file never gets included. I've tried including ONLY userlib.inc and pasting all the dblib.inc functions into page.php (to rule out dblib.inc screwing things up) and still I get the error. I am truly confounded at this point. Thanks for any suggestions you have. I think I am almost out of "Include Statement Hell". ;-) ...Brad "Jonathan Hilgeman" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > So, maybe this is the question. Can you include a file from > > /main/page.php by using a path of /includes/dblib.inc? > > Probably not. PHP can "see" the whole filesystem, not just the area that is > limited to your account. So, when you try to include "/includes/dblib.inc" > it is trying to go down to the SYSTEM root and open up a subdirectory called > includes and get the file dblib.inc inside it. > > If you copy the dblib.inc to the same directory as page.php, you should only > have to say: > include("dblib.inc"); > > However, if you have this layout: > /your/account/dir/main/page.php > /your/account/dir/includes/dblib.inc > /your/account/dir/includes/userlib.inc > > Then page.php would have to say: > include("../includes/dblib.inc"); > > Which would go back one directory, THEN into the includes subdirectory, and > then it could find dblib.inc > > I would definitely add: > error_reporting(2039); > > ...to the top of your page.php code to see if you can pick up any errors. > Also, check your error log if you have one (contact your hosting company if > you're not sure). > > I would definitely try to solve this the normal way by finding the problem > with the paths rather than trying to screw with your php.ini or httpd.conf > file - otherwise you'll have a script that might not work if you ever have > to move your scripts or copy them to a development server or something. > > - Jonathan > > -Original Message- > From: Brad Melendy [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, March 27, 2002 7:27 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] include() statement hell! > > > Thanks Jonathan, > I'm trying to include a file /includes/dblib.inc from /main/page.php. In > /main/page.php I use include("includes/dblib.inc");. When that didn't work, > I tried copying the file to /main/ and including it there and that didn't > work either. Finally, I tried adding a specific path to the php.ini file > for includes_path and put the files there and that worked. Then I went and > changed the php.ini file to remove the reference (still trying to get it to > work the way I THINK it should) and then it WORKED! But ONLY from within > /main/. Each time I make these changes, I am making a matching change in > the actual include() statement at the top of /main/page.php and I am > restarting apache each time I change php.ini. > > So, maybe this is the question. Can you include a file from /main/page.php > by using a path of /includes/dblib.inc? > > dblib.inc has functions that do connections and queries to a mysql database. > Even stranger yet, is that I have one other include file called userlib.inc > that has authentication related session functions. Well, that hasn't worked > at all no matter what, unless I put the functions in /includes/userlib.inc > directly into the file /main/page.php. Once there, all the functions work > fine. Otherwise, the only error messages I get are regarding unknown > functions being referenced, yet, I never get an error that the include files > can't be found. It's all crazy to me. > >
RE: [PHP-DB] MySQL, PHPand cron
First create the PHP script to connect to the database and empty the table ("DELETE FROM table;") as if you were going to visit the page manually every time you wanted to empty the table. This shouldn't be too hard: Once you have that working (test it by visiting the page and then checking to see if it emptied the table), now you want to get cron to run that script on a certain schedule. There are two ways to do this. #1 --- If your host has the command-line/CGI version of PHP installed, you can simply have cron run: /path/to/php /path/to/EmptyTable.php. It would more realistically look like: /usr/local/bin/php /home/myaccount/EmptyTable.php -- #2 --- If #1 doesn't work (you don't have the CGI version installed), you can have another 3rd-party program "request" the page. For instance, most Linux systems have a utility called wget which retrieves web pages and files by running: wget http://www.domain.com/somepage.html You can have cron run that command to simulate a visit to that page, which effectively runs the script and the table gets emptied: wget http://www.yourdomain.com/EmptyTable.php -- - Jonathan -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 11:32 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL, PHPand cron Hi all, Wondering if anyone might know how to empty a table with a php script and cron job? Would someone point me to a tutorial or help with this? TIA Jennifer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] include() statement hell!
> So, maybe this is the question. Can you include a file from > /main/page.php by using a path of /includes/dblib.inc? Probably not. PHP can "see" the whole filesystem, not just the area that is limited to your account. So, when you try to include "/includes/dblib.inc" it is trying to go down to the SYSTEM root and open up a subdirectory called includes and get the file dblib.inc inside it. If you copy the dblib.inc to the same directory as page.php, you should only have to say: include("dblib.inc"); However, if you have this layout: /your/account/dir/main/page.php /your/account/dir/includes/dblib.inc /your/account/dir/includes/userlib.inc Then page.php would have to say: include("../includes/dblib.inc"); Which would go back one directory, THEN into the includes subdirectory, and then it could find dblib.inc I would definitely add: error_reporting(2039); ...to the top of your page.php code to see if you can pick up any errors. Also, check your error log if you have one (contact your hosting company if you're not sure). I would definitely try to solve this the normal way by finding the problem with the paths rather than trying to screw with your php.ini or httpd.conf file - otherwise you'll have a script that might not work if you ever have to move your scripts or copy them to a development server or something. - Jonathan -Original Message- From: Brad Melendy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 7:27 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] include() statement hell! Thanks Jonathan, I'm trying to include a file /includes/dblib.inc from /main/page.php. In /main/page.php I use include("includes/dblib.inc");. When that didn't work, I tried copying the file to /main/ and including it there and that didn't work either. Finally, I tried adding a specific path to the php.ini file for includes_path and put the files there and that worked. Then I went and changed the php.ini file to remove the reference (still trying to get it to work the way I THINK it should) and then it WORKED! But ONLY from within /main/. Each time I make these changes, I am making a matching change in the actual include() statement at the top of /main/page.php and I am restarting apache each time I change php.ini. So, maybe this is the question. Can you include a file from /main/page.php by using a path of /includes/dblib.inc? dblib.inc has functions that do connections and queries to a mysql database. Even stranger yet, is that I have one other include file called userlib.inc that has authentication related session functions. Well, that hasn't worked at all no matter what, unless I put the functions in /includes/userlib.inc directly into the file /main/page.php. Once there, all the functions work fine. Otherwise, the only error messages I get are regarding unknown functions being referenced, yet, I never get an error that the include files can't be found. It's all crazy to me. Currently, both of my include files are called directly with two lines like: include("dblib.inc"); include("userlib.inc"); They are both located in /main/ along side page.php which is calling them. They both seem to work this way, but as soon as I place them in /includes/ and try to call them using: include("includes/dblib.inc"); include("includes/userlib.inc"); I get errors saying that the functions can't be found, however, no errors saying it can't find the include files?? Lastly, even with both include files in /main/ I still have some strange problem with my userlib.inc file because the single function that is in there won't work unless the function is pasted directly into /main/page.php. I think I've made this message way too long but I appreciate your help. I've got the page working reliably with the functions all pasted into page.php but not while including those functions. I just can't think of what could be making it difference. The functions are all the same, just running from an include file is a problem. Thanks again, just writing this up has helped to make more sense to me. I think the crux of the whole thing is the path. I'm using to including files in ASP and those can be relative so something like ../includes/dblib.inc works great. ...Brad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] include() statement hell!
#1. You may want to double-check the path where you're calling it from in case you're working with subdirectories. Let's saying you access a page at www.domain.com/page.php which calls www.domain.com/includes/header.inc. Then, header.inc includes the dblib.inc file at www.domain.com/includes/dblib.inc. However, the include's base directory will still be in page.php - the directory won't change to includes, so for header.inc to include dblib.inc, it has to say: include("includes/dblib.inc"); NOT include("dblib.inc"); Otherwise, it will be trying to include www.domain.com/dblib.inc because the page that started the whole chain reaction of includes is located at www.domain.com/page.php #2. If you have error reporting turned off, and there is a parsing error in your files, the page may just die without giving a reason. Try turning off any error reporting and also access those include files like userlib.inc directly in your web browser to see if PHP reports any errors. You may need to change the extension to something like userlib.inc.php for the web server to recognize the request correctly. #3. Please give us a little more detail on the errors you're getting (any specific messages would be nice). - Jonathan -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 3:42 PM To: 'Brad Melendy'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] include() statement hell! did you start each include file with: If not, PHP treats the code within as straight text -Original Message- From: Brad Melendy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 5:03 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] include() statement hell! Ok, I've spent some time reading the docs at php.net and I'm still confused. After a couple hours, I have an include file working with a statement like: include ("dblib.inc"); However, to add to my confusion, I've got a second include file statement on the next line: include ("userlib.inc"); And that doesn't work. Most crazy of all, if I just put the darn functions all in the PHP file that is trying to call the include files, everything works perfectly. So far I have my include_path line in the pho.ini file set to no value since I'm just using include files that exist in the same directory as the calling php file. this after I could NOT get the files to be properly recognized from their own include directory. As far as I'm concerned, you should be able to include a relative path with the included filename and have it work. Too bad that doesn't work in PHP. So, long story short, I'm about to give up on include statements and just copy and paste my functions all over the place. Does anyone have any ideas why this is so difficult for me? What am I missing? This stuff is easy in ASP but PHP is giving me serious heart-ache. :-( Thanks for any tips or suggestions. Brad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] RE: [PHP-WIN] Stange 'page-loading' effect
You should check your error logs after getting the server not found error. There will frequently be PHP error messages stored in there that might help discern the problem. You can also set "checkpoints" in your code that write out "Passed this part, passed this part, etc" to a temporary debugging file (whatever you want to call it), so you can determine where the script failed if you don't get any help from the logfiles). - Jonathan -Original Message- From: alain samoun [mailto:[EMAIL PROTECTED]] Sent: Friday, March 15, 2002 9:19 AM To: George Pitcher; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-DB] RE: [PHP-WIN] Stange 'page-loading' effect You probably have an error in your code, difficult to help without at least a snippet of it. A+ Alain -Original Message- From: George Pitcher [mailto:[EMAIL PROTECTED]] Sent: Friday, March 15, 2002 4:14 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-WIN] Stange 'page-loading' effect Hi all, I have a part of my development site where the user hits a button, sending a stream of values to a response page. However, on testing, the response page comes up with 'server not found' but when I refresh that error page, it loads the correct page but without any of the transferred values. Any ideas as to where it going wrong? I'm using PHP-4.1.1, Apache (console) on Win 2000Pro. Regards George George Pitcher is Technical Manager for the HERON Project at Napier University, Edinburgh. -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Soft-Linking and includes
However, on a different, FreeBSD platform, this is not the case. A linked file can call an include and have the desired file be called instead of the source one. That's where I'm getting confused. - Jonathan -Original Message- From: olinux [mailto:[EMAIL PROTECTED]] Sent: Friday, March 08, 2002 12:28 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Soft-Linking and includes You must use absolute paths in includes. essentially the include will reference itself as the starting point, rather than the script you are calling it from. olinux --- Jonathan Hilgeman <[EMAIL PROTECTED]> wrote: > I'm on a red hat system, and I've soft-linked two > directories: > /www/dir1/subdir > /www/dir2/subdir --> /www/dir1/subdir > > Now, inside subdir is a file that tries to > include("../info.php"); which > prints out some information about the file paths and > my database stuff. So > there's: > /www/dir1/info.php > /www/dir1/subdir/includer.php > /www/dir2/info.php > /www/dir2/subdir --> /www/dir1/subdir > > Now, when I run /www/dir2/subdir/includer.php, it > SHOULD include the file > "../info.php" which translates into > /www/dir2/info.php. However, the > symbolic linking seems to have messed it up, and > instead of running dir2's > info.php, it seems to think it is in dir1, and > instead includes dir1's > info.php file. > > Has anyone run into this and/or know a fix for it? > > Thanks! > > - Jonathan > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __ Do You Yahoo!? Try FREE Yahoo! Mail - the world's greatest free email! http://mail.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Soft-Linking and includes
I'm on a red hat system, and I've soft-linked two directories: /www/dir1/subdir /www/dir2/subdir --> /www/dir1/subdir Now, inside subdir is a file that tries to include("../info.php"); which prints out some information about the file paths and my database stuff. So there's: /www/dir1/info.php /www/dir1/subdir/includer.php /www/dir2/info.php /www/dir2/subdir --> /www/dir1/subdir Now, when I run /www/dir2/subdir/includer.php, it SHOULD include the file "../info.php" which translates into /www/dir2/info.php. However, the symbolic linking seems to have messed it up, and instead of running dir2's info.php, it seems to think it is in dir1, and instead includes dir1's info.php file. Has anyone run into this and/or know a fix for it? Thanks! - Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Tutorial?
This is another good idea. When reloading the page, have the script generate that unique ID, store it in a separate table AND put it in a hidden input. When the user submits, the database checks to see if the unique ID is in the database, and if so, the ID is deleted from the database, and the order is processed. On subsequent clicks, the unique ID would not be found in that database table so the query would fail with a message ("You have clicked more than once") or something like that, and the person could check the status of an order identified by that unique ID. - Jonathan -Original Message- From: Aron Pilhofer [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 9:51 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Tutorial? The easiest and best solution is to redirect to a new page after the submit. But I have had cases where it was necessary to have the submit code and the form on the same page. I agree totally with jonathan that a server-side solution is the way to go. To solve the problem (avoid clicking twice and/or reloading the page) I used a hidden field that generated a unique ID based, and then placed that into a field that only accepts unique values. If the user reloads, the query fails - trap that error and you're golden. "Jonathan Hilgeman" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi Jennifer, > I'm guessing the purpose of this would be to keep people from > double-clicking and submitted information twice, possibly making an > application deduct payment twice or something important similar in nature. > > The best way I've found of accomplishing the goal of keeping people from > clicking twice has three parts: > 1) Quickly switching the page. On the next page, have PHP write out about > 300 spaces and a newline, then call the flush() function to make the output > get sent to the browser. In many cases, this will cause the browser to > quickly switch to the next page and display a blank page while the data gets > processed. > > 2) It's still remotely possibly to click twice even if you have part 1 in > place, so this is a more fool-proof method. Store your data in a database > before processing it - along with a timestamp. When the person clicks the > submit button twice, the program checks the database to see if there is the > same information with a very close timestamp. If so, update the timestamp in > the database. At this point you can choose 3 paths: > > - Store the data so you can batch-process the data at a later time, once you > are sure that the visitor has left and there will be no more clicks. For > example, have a program that runs every 5 minutes (via cron), then have that > program check for data/orders that are at least 5 minutes old, and process > them. That means that the timestamp hasn't been updated by extra clicks in 5 > minutes (and you could still have notified the visitor that their order or > data request is now in line to be processed). > > - Process the data immediately. If you need to process an order immediately > and give back results, use the above method, but modify it a bit. Instead of > just displaying notification that their order is in line to be processed, > you can submit to another PHP program which sleeps for about 3-4 seconds, > then checks the database until there are no clicks for at least 4 seconds, > and THEN processes the data, and returns a value to the screen in like 4-5 > seconds. Both of these methods have similar goals, though - Receive data and > timestamp it, Wait $Time, Check for timestamp updates, Process when > timestamp is $Time old. > > 3) Have a very visible notice that people should not click multiple times, > or else undesirable results may occur, and we want "your" request/order to > be perfect. Emphasize the request to click only once and to be patient, and > if something goes wrong, here's how to contact us. > > - Jonathan > > -Original Message- > From: Jennifer Downey [mailto:[EMAIL PROTECTED]] > Sent: Saturday, March 02, 2002 10:18 PM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] Tutorial? > > > Hi all, > > Can anyone point me to a good tutorial on how to disable a submit button > once clicked? > preferably in php. > > Thanks > Jennifer Downey > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Tutorial?
Javascript will functionally solve the problem, but since Javascript is an optional piece of the browser that can be turned off/on, and functions differently in different browsers, it's definitely far from fool-proof. You could get it working 99.9% in IE and Navigator, but then have it fail in another browser, which is why I suggested my PHP, server-side method, which cannot be turned off based on a client's browser. - Jonathan -Original Message- From: Richard Black [mailto:[EMAIL PROTECTED]] Sent: Monday, March 04, 2002 8:47 AM To: Jonathan Hilgeman; 'Jennifer Downey'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Tutorial? I've also seen something similar implemented using javascript (i guess - never looked into it in any detail) The online bank I use does this. Basically, when I click a submit button, the button is replaced by an image (like a greyed out submit button) which has the caption Submitted. Clicking this does nothing. Like I say, I'm 99.9% positive this is implemented using javascript, but have never investigated how it works... Richy == Richard Black Systems Programmer, DataVisibility Ltd - http://www.datavisibility.com Tel: 0141 435 3504 Email: [EMAIL PROTECTED] -----Original Message- From: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]] Sent: 04 March 2002 16:40 To: 'Jennifer Downey'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Tutorial? Hi Jennifer, I'm guessing the purpose of this would be to keep people from double-clicking and submitted information twice, possibly making an application deduct payment twice or something important similar in nature. The best way I've found of accomplishing the goal of keeping people from clicking twice has three parts: 1) Quickly switching the page. On the next page, have PHP write out about 300 spaces and a newline, then call the flush() function to make the output get sent to the browser. In many cases, this will cause the browser to quickly switch to the next page and display a blank page while the data gets processed. 2) It's still remotely possibly to click twice even if you have part 1 in place, so this is a more fool-proof method. Store your data in a database before processing it - along with a timestamp. When the person clicks the submit button twice, the program checks the database to see if there is the same information with a very close timestamp. If so, update the timestamp in the database. At this point you can choose 3 paths: - Store the data so you can batch-process the data at a later time, once you are sure that the visitor has left and there will be no more clicks. For example, have a program that runs every 5 minutes (via cron), then have that program check for data/orders that are at least 5 minutes old, and process them. That means that the timestamp hasn't been updated by extra clicks in 5 minutes (and you could still have notified the visitor that their order or data request is now in line to be processed). - Process the data immediately. If you need to process an order immediately and give back results, use the above method, but modify it a bit. Instead of just displaying notification that their order is in line to be processed, you can submit to another PHP program which sleeps for about 3-4 seconds, then checks the database until there are no clicks for at least 4 seconds, and THEN processes the data, and returns a value to the screen in like 4-5 seconds. Both of these methods have similar goals, though - Receive data and timestamp it, Wait $Time, Check for timestamp updates, Process when timestamp is $Time old. 3) Have a very visible notice that people should not click multiple times, or else undesirable results may occur, and we want "your" request/order to be perfect. Emphasize the request to click only once and to be patient, and if something goes wrong, here's how to contact us. - Jonathan -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 02, 2002 10:18 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Tutorial? Hi all, Can anyone point me to a good tutorial on how to disable a submit button once clicked? preferably in php. Thanks Jennifer Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Tutorial?
Hi Jennifer, I'm guessing the purpose of this would be to keep people from double-clicking and submitted information twice, possibly making an application deduct payment twice or something important similar in nature. The best way I've found of accomplishing the goal of keeping people from clicking twice has three parts: 1) Quickly switching the page. On the next page, have PHP write out about 300 spaces and a newline, then call the flush() function to make the output get sent to the browser. In many cases, this will cause the browser to quickly switch to the next page and display a blank page while the data gets processed. 2) It's still remotely possibly to click twice even if you have part 1 in place, so this is a more fool-proof method. Store your data in a database before processing it - along with a timestamp. When the person clicks the submit button twice, the program checks the database to see if there is the same information with a very close timestamp. If so, update the timestamp in the database. At this point you can choose 3 paths: - Store the data so you can batch-process the data at a later time, once you are sure that the visitor has left and there will be no more clicks. For example, have a program that runs every 5 minutes (via cron), then have that program check for data/orders that are at least 5 minutes old, and process them. That means that the timestamp hasn't been updated by extra clicks in 5 minutes (and you could still have notified the visitor that their order or data request is now in line to be processed). - Process the data immediately. If you need to process an order immediately and give back results, use the above method, but modify it a bit. Instead of just displaying notification that their order is in line to be processed, you can submit to another PHP program which sleeps for about 3-4 seconds, then checks the database until there are no clicks for at least 4 seconds, and THEN processes the data, and returns a value to the screen in like 4-5 seconds. Both of these methods have similar goals, though - Receive data and timestamp it, Wait $Time, Check for timestamp updates, Process when timestamp is $Time old. 3) Have a very visible notice that people should not click multiple times, or else undesirable results may occur, and we want "your" request/order to be perfect. Emphasize the request to click only once and to be patient, and if something goes wrong, here's how to contact us. - Jonathan -Original Message- From: Jennifer Downey [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 02, 2002 10:18 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Tutorial? Hi all, Can anyone point me to a good tutorial on how to disable a submit button once clicked? preferably in php. Thanks Jennifer Downey -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Secure Encrypt/Decrypt Functions
Does anyone know of a fairly simple, but secure technique for encrypting and decrypting text? - Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Query with numbers like 1, 3, 5..........
Yes, Even Numbers: SELECT * FROM table WHERE MOD(id,2) = 0; Odd Numbers: SELECT * FROM table WHERE MOD(id,2) != 0; - Jonathan -Original Message- From: Jeremy Peterson [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 07, 2002 11:59 AM To: Raymond Lilleodegard; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Query with numbers like 1, 3, 5.. select * from table where id in (1,3,5,10,'etc') At 08:22 PM 2/7/2002 +0100, Raymond Lilleodegard wrote: >Hi! > >Is there a way to get the rows with id's like 1, 3, 5, and so on or 2, 4, 6, >...? > > >Best regards Raymond > > > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Similar Articles or Customers also bought...
Technically, you should have a list of saved orders associated with a customer ID. You should be able to search the saved orders for all customer IDs that purchased the current product ID. Then, generate a giant list of all products that all those customer IDs purchased, and compile them into a big list, with the most common purchases at the top. You should then maybe have an array looking like: $Products["Product Name"] = Number Purchased; - $Products["PHP Programming Book"] = 24; $Products["MySQL Programming Book"] = 22; $Products["PC Magazine Subscription"] = 14; $Products["Windows XP Pro"] = 6; $Products["Anti-Fungal Loin Cream"] = 1; - Then, display any products that have more than X number of purchases. That way, you truly have a valid "Customers That Bought This Also Bought These" list. A bit intensive, maybe, but it works. - Jonathan -Original Message- From: olinux [mailto:[EMAIL PROTECTED]] Sent: Monday, January 21, 2002 3:25 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Similar Articles or Customers also bought... I am trying to figure a simple way of creating a script for a news site to recommend articles that are similar [i.e. about the same company] Two examples are: http://www.theroyalgazette.com/apps/pbcs.dll/artikkel?Avis=RG&Dato=20011218&; Kategori=BUSINESS&Lopenr=112180020&Ref=AR (See the "Linked Articles") and Amazon's "Customers who bought this book also bought:" feature I think it would work something like this TABLE 1 keyword_id | keywords TABLE 2 url_id | url | url_title TABLE 3 id | keyword_id | url_id this would be your basic search engine - for example you could look up a keyword in table 1 using that keyword_id get the url_id's that correspond and then get the url's and titles for display. I guess that the "similar srticles" feature would work the same way by taking the current url_id lookup the corresponding keyword_id's use those to query for url_id's that match those keywords and then grab the url and title for display. Confused? I am :) This seems like it would work, but seems too intensive... Maybe a different table structure which contains url_id | similar_url would be better? then you could look up the current url_id for url_id's of similar articles? Thanks for your help. olinux __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Fixed Quote Marks in Inputs
Although my case was targeted specifically at forms and inputs, your question depends on how your application would write to the text file. When an HTML entity is retrieved from the database and put into the VALUE of an INPUT box or put inbetween TEXTAREA tags, the HTML entity is left encoded in the source code, but it is translated into the quote mark character when the page is viewed. So if you were to fetch a database record, put its values on a form, and hit a submit button to save it to a text file immediately, the text file would contain the quote marks, not the HTML entities. That's why I find this all very useful. I am able to convert the entity just before I insert data into the database. Once I retrieve it, in most cases the entity will be translated anyway by the browser. Not sure if that's confusing, but that's the best way I can think of to explain it right now... - Jonathan -Original Message- From: Boaz Yahav [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 05, 2002 12:07 AM To: Bogdan Stancescu; Jonathan Hilgeman Cc: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Fixed Quote Marks in Inputs I just read your thread and I have to say that I was intrigued both by the subject (which is interesting) and by the different views you show. I just have one question for Jonathan : If you store the ' and " as ' and " what do you do if you need to show the data later on in a non HTML format (text file for example). Wouldn't you still need to convert back to ' and " before you show the text? Sincerely berber Visit http://www.weberdev.com Today!!! To see where PHP might take you tomorrow. -Original Message- From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 05, 2002 1:44 AM To: Jonathan Hilgeman Cc: '[EMAIL PROTECTED]' Subject: Re: [PHP-DB] Fixed Quote Marks in Inputs Ok, seems like I misjudged you and I apologize for that. I haven't changed my opinion about the very issue we've been discussing - only wanted to post the sentence above, just for the record. Bogdan Jonathan Hilgeman wrote: > Apparently, the experienced way is to store them with slashes, which is what > I've followed for years. I consider years of programming to be a fair amount > of experience, thus qualifying me to be experienced. ANYHOW, after finally > thinking a bit outside the box and with some valuable input from some > co-workers, we came up with this function which is a much more efficient > solution in this matter than the "experienced" way you proposed. > > My purpose in even posting this function was so that other people could > avoid having to go through the same problems I faced when using the "proper" > and apparently "experienced" method that I only used because I listened to > programmers like you (mind you, I said LIKE you, not YOU) who believe in > standard procedure in all cases without considering more efficient options. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Fixed Quote Marks in Inputs
And I apologize if I came off as ultra-defensive/rude. I had a bad day, a bright idea, and then felt like someone was tearing it to pieces. This is like the PHP soap opera. - Jonathan -Original Message- From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]] Sent: Friday, January 04, 2002 3:44 PM To: Jonathan Hilgeman Cc: '[EMAIL PROTECTED]' Subject: Re: [PHP-DB] Fixed Quote Marks in Inputs Ok, seems like I misjudged you and I apologize for that. I haven't changed my opinion about the very issue we've been discussing - only wanted to post the sentence above, just for the record. Bogdan Jonathan Hilgeman wrote: > Apparently, the experienced way is to store them with slashes, which is what > I've followed for years. I consider years of programming to be a fair amount > of experience, thus qualifying me to be experienced. ANYHOW, after finally > thinking a bit outside the box and with some valuable input from some > co-workers, we came up with this function which is a much more efficient > solution in this matter than the "experienced" way you proposed. > > My purpose in even posting this function was so that other people could > avoid having to go through the same problems I faced when using the "proper" > and apparently "experienced" method that I only used because I listened to > programmers like you (mind you, I said LIKE you, not YOU) who believe in > standard procedure in all cases without considering more efficient options. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Fixed Quote Marks in Inputs
Apparently, the experienced way is to store them with slashes, which is what I've followed for years. I consider years of programming to be a fair amount of experience, thus qualifying me to be experienced. ANYHOW, after finally thinking a bit outside the box and with some valuable input from some co-workers, we came up with this function which is a much more efficient solution in this matter than the "experienced" way you proposed. My purpose in even posting this function was so that other people could avoid having to go through the same problems I faced when using the "proper" and apparently "experienced" method that I only used because I listened to programmers like you (mind you, I said LIKE you, not YOU) who believe in standard procedure in all cases without considering more efficient options. - Jonathan -Original Message- From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]] Sent: Friday, January 04, 2002 3:11 PM To: Jonathan Hilgeman Cc: '[EMAIL PROTECTED]' Subject: Re: [PHP-DB] Fixed Quote Marks in Inputs Ok, as I said before, you can store whatever you please in your database. However, please don't "speak as an experienced web programmer" when not longer than three hours ago you finally found a solution to store quoted text in a database. Bogdan Jonathan Hilgeman wrote: > I realize that part - my whole point was that it didn't really matter how it > was stored as long as it gets extracted/parsed correctly. With that in mind, > instead of using 3 functions to store, extract, and parse the data, I can > use one function to prepare the data to be stored in a format that can be > extracted directly into an form-friendly format. > > Not to mention that HTML entities are still ASCII characters, and I do not > foresee any problems with using the HTML entities in place of quote marks. > > To me, it makes the most sense. Quote marks are generally special characters > used everywhere, and storing them as quote marks instead of the entities > seems to be asking for trouble, in my opinion. I've stored values using > slashes for the past few years, and that method has given so many > problems... Speaking as an experienced web programmer, I believe this is a > much more practical method for a lot of us. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Fixed Quote Marks in Inputs
I realize that part - my whole point was that it didn't really matter how it was stored as long as it gets extracted/parsed correctly. With that in mind, instead of using 3 functions to store, extract, and parse the data, I can use one function to prepare the data to be stored in a format that can be extracted directly into an form-friendly format. Not to mention that HTML entities are still ASCII characters, and I do not foresee any problems with using the HTML entities in place of quote marks. To me, it makes the most sense. Quote marks are generally special characters used everywhere, and storing them as quote marks instead of the entities seems to be asking for trouble, in my opinion. I've stored values using slashes for the past few years, and that method has given so many problems... Speaking as an experienced web programmer, I believe this is a much more practical method for a lot of us. - Jonathan -Original Message- From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]] Sent: Friday, January 04, 2002 2:39 PM To: Jonathan Hilgeman Cc: '[EMAIL PROTECTED]' Subject: Re: [PHP-DB] Fixed Quote Marks in Inputs Oh, one more thing - maybe you don't understand what the slashing is for: you don't store \" in the database -- the slash is there just so the MySQL statement is correct. MySQL knows about slashing and will replace your \" with " so what you store in the database is exactly what the user typed in the input box. Bogdan Jonathan Hilgeman wrote: > How is it the \"proper\" way to do it and why does it have to remain the > \"proper\" way of doing it? Simply because it retains the same character in > the database? What good is that if the data will simply be extracted and > unslashed at a later point anyway? > > How the data is kept internally should not be an issue if it is only stored > to be later extracted and parsed anyway. That's a partial reason we use > timestamps instead of storing the full date everywhere. It's called proper > representation. > > And I think in cases where HTML forms are used in conjunction with > databases, the HTML equivalents are a heck of a lot more proper than > slashes, not to mention more efficient. The only downside I see is that > instead of taking up 2 characters, it takes up 6, but since many fields we > all use won't ever contain quotes, I see it as a more than reasonable > trade-off. > > I personally consider it a bad habit to use slashes unless you're dealing > with regexes. And not everybody does it that way. > > - Jonathan > > -Original Message- > From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 04, 2002 1:41 PM > To: Jonathan Hilgeman > Cc: '[EMAIL PROTECTED]' > Subject: Re: [PHP-DB] Fixed Quote Marks in Inputs > > That would be because this way you'll end up with the proper data in the > database instead of HTML-encoded strings. Plus it's the proper way to do it > -- > everybody does it this way and it's a good habit. > > Bogdan > > Jonathan Hilgeman wrote: > > > I thought I made it somewhat clear: > > > when I'm dealing with form inputs that can contain quote marks > > > > Why run 3 functions at separate times when you can run one once just > before > > data is inserted into the database? > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Fixed Quote Marks in Inputs
How is it the \"proper\" way to do it and why does it have to remain the \"proper\" way of doing it? Simply because it retains the same character in the database? What good is that if the data will simply be extracted and unslashed at a later point anyway? How the data is kept internally should not be an issue if it is only stored to be later extracted and parsed anyway. That's a partial reason we use timestamps instead of storing the full date everywhere. It's called proper representation. And I think in cases where HTML forms are used in conjunction with databases, the HTML equivalents are a heck of a lot more proper than slashes, not to mention more efficient. The only downside I see is that instead of taking up 2 characters, it takes up 6, but since many fields we all use won't ever contain quotes, I see it as a more than reasonable trade-off. I personally consider it a bad habit to use slashes unless you're dealing with regexes. And not everybody does it that way. - Jonathan -Original Message- From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]] Sent: Friday, January 04, 2002 1:41 PM To: Jonathan Hilgeman Cc: '[EMAIL PROTECTED]' Subject: Re: [PHP-DB] Fixed Quote Marks in Inputs That would be because this way you'll end up with the proper data in the database instead of HTML-encoded strings. Plus it's the proper way to do it -- everybody does it this way and it's a good habit. Bogdan Jonathan Hilgeman wrote: > I thought I made it somewhat clear: > > when I'm dealing with form inputs that can contain quote marks > > Why run 3 functions at separate times when you can run one once just before > data is inserted into the database? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Fixed Quote Marks in Inputs
I thought I made it somewhat clear: > when I'm dealing with form inputs that can contain quote marks Why run 3 functions at separate times when you can run one once just before data is inserted into the database? - Jonathan -Original Message- From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]] Sent: Friday, January 04, 2002 12:48 PM To: Jonathan Hilgeman Cc: 'Rick Emery'; '[EMAIL PROTECTED]' Subject: Re: [PHP-DB] Fixed Quote Marks in Inputs Those are two different things. You never mentioned your HTML problem, that's why nobody adressed it. So, the proper way to do it is: 1. Insert into the database using addslashes(); 2. Use stripslashes() after retrieving the data if you need to; 3. Use htmlspecialchars() for displaying the data in HTML or htmlentities() if you still have problems. Bogdan Jonathan Hilgeman wrote: > I've tried those methods, but they cause problems when the values are loaded > back into INPUTs for editing. For instance, even if the database-stored > value is Mark\'s Pet Named \"Flea Muffin\", try loading that value into an > INPUT so it looks like: > > > > Or try double-quotes: > > > > You'll see what I mean. > > By using the HTML equivalents, the value can be loaded back into an input > box flawlessly for easy updating, and it will display correctly when being > pulled from the database for other usage. > > - Jonathan > > -Original Message- > From: Rick Emery [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 04, 2002 12:11 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP-DB] Fixed Quote Marks in Inputs > > Another option is to use PHP's addslashes() and stripslashes() functions. > These will add/remove slashes in front of quotes to make them database > friendly. > > -Original Message- > From: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 04, 2002 2:05 PM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] Fixed Quote Marks in Inputs > > I finally came up with a reliable solution that I can use when I'm dealing > with form inputs that can contain quote marks (single or double quotes). To > store quote marks, you can str_replace them with their HTML code > equivalents. For single quote marks, this is ', and for double quote > marks it's " > > So before I insert any input into my database, I run my below function on > all the data: > > // Replace quotes with their ' and " equivalents > function PrepareQuotes($Var) > { > $Var = str_replace("'","'",$Var); > $Var = str_replace('"',""",$Var); > return $Var; > } > > Hope this helps someone else. > > - Jonathan > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Fixed Quote Marks in Inputs
I've tried those methods, but they cause problems when the values are loaded back into INPUTs for editing. For instance, even if the database-stored value is Mark\'s Pet Named \"Flea Muffin\", try loading that value into an INPUT so it looks like: Or try double-quotes: You'll see what I mean. By using the HTML equivalents, the value can be loaded back into an input box flawlessly for easy updating, and it will display correctly when being pulled from the database for other usage. - Jonathan -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Friday, January 04, 2002 12:11 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Fixed Quote Marks in Inputs Another option is to use PHP's addslashes() and stripslashes() functions. These will add/remove slashes in front of quotes to make them database friendly. -----Original Message- From: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]] Sent: Friday, January 04, 2002 2:05 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Fixed Quote Marks in Inputs I finally came up with a reliable solution that I can use when I'm dealing with form inputs that can contain quote marks (single or double quotes). To store quote marks, you can str_replace them with their HTML code equivalents. For single quote marks, this is ', and for double quote marks it's " So before I insert any input into my database, I run my below function on all the data: // Replace quotes with their ' and " equivalents function PrepareQuotes($Var) { $Var = str_replace("'","'",$Var); $Var = str_replace('"',""",$Var); return $Var; } Hope this helps someone else. - Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Fixed Quote Marks in Inputs
I finally came up with a reliable solution that I can use when I'm dealing with form inputs that can contain quote marks (single or double quotes). To store quote marks, you can str_replace them with their HTML code equivalents. For single quote marks, this is ', and for double quote marks it's " So before I insert any input into my database, I run my below function on all the data: // Replace quotes with their ' and " equivalents function PrepareQuotes($Var) { $Var = str_replace("'","'",$Var); $Var = str_replace('"',""",$Var); return $Var; } Hope this helps someone else. - Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] How to querry two db in a single statement?
How about: SELECT c.country FROM db2.users u LEFT JOIN db1.countries c ON u.country_id=c.country_id GROUP BY c.country; This assumes the following layout: db1.countries | country_id | country | | 67 | USA | | 68 | Uganda | | 69 | Canada | db2.users --- | user_id | username | country_id | --- | 1 | george | 69 | | 2 | harry| 67 | | 3 | bob | 68 | | 4 | bill | 69 | | 5 | joe | 68 | | 6 | martha | 68 | --- This should result in --- | country | --- | USA | | Uganda | | Canada | --- You should be able to add an "ORDER BY c.country" to that SELECT query if you want to sort the results alphabetically. - Jonathan -Original Message- From: Andreas Pucko [mailto:[EMAIL PROTECTED]] Sent: Friday, January 04, 2002 9:40 AM To: Jonathan Hilgeman Subject: AW: [PHP-DB] How to querry two db in a single statement? I wrote them: # database: connect function db_connect() { global $sys_dbhost,$sys_dbuser,$sys_dbpasswd, $mailadress_webmaster; $conn = @mysql_connect($sys_dbhost,$sys_dbuser,$sys_dbpasswd); if (!$conn) { # send error mail to webmaster $mailHeaders = "From: ".$mailadress_webmaster."\n"; // from $mailHeaders .= "X-Priority: 1\n"; // Urgent message! mail($mailadress_webmaster,'MySQL error. Website is down!',mysql_error(),$mailHeaders); HEADER("Location:/app_global/errors/unavailable.html");//redirect to unavailable } return $conn; } # Select the Database function select_db($link,$DB){ global $mailadress_webmaster, $header_1_boxcolor_2; if (!mysql_select_db($DB, $link)){ header_1('Error', $header_1_boxcolor_2); echo(' We are sorry, an error has occured.Please contact our webmaster at: '.$mailadress_webmaster.' Occured during executing '); DisplayErrMsg(sprintf("%s", $stmt)); echo(" statement \n \n Error: "); DisplayErrMsg(sprintf(" %d %s", mysql_errno($link), mysql_error($link))) ; exit() ; } } The layout of the db is verry complex. Too long to show all the tables. But in short form there is one table in db1 called country and another in db2 called user. The user has the country as a field. I am trying to find out the countries the users come from. Building a select field containing only the countries where user come from. Cheers Andy -Ursprüngliche Nachricht- Von: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]] Gesendet: Freitag, 4. Januar 2002 17:46 An: '[EMAIL PROTECTED]' Betreff: RE: [PHP-DB] How to querry two db in a single statement? Are select_db and db_connect functions that you wrote or someone else wrote? They are not generic PHP4.x functions... In any case, it would help to see your database layouts... - Jonathan -Original Message- From: Andreas Pucko [mailto:[EMAIL PROTECTED]] Sent: Friday, January 04, 2002 8:29 AM To: Jonathan Hilgeman Subject: AW: [PHP-DB] How to querry two db in a single statement? Hello Jonathan, my problem is how to connect to 2 db in the same time. They are on the same server. Here is the code I wrote so far: ### # connect to db1 $link = db_connect(); //connect to db select_db($link,$DB); // select db ### ### # Get countries who are currently used by registered members: // $geo_T1 is in $DB2 // $T5 is in $DB $stmt= " SELECT DISTINCT C.* /*Distinct means no equal results*/ from $geo_T1 C, $T5 U where C.country_id = U.country order b
RE: [PHP-DB] How to querry two db in a single statement?
If the two databases are on the same server, you can use joins to select data from multiple databases. For instance: Database 1, Table A: | id | name| | 1 | George | | 2 | Mark| | 3 | Harry | Database 2, Table A: | id | name| | 1 | Bill| | 2 | Henry | | 3 | Ford| You can: SELECT a.name as db1Name, b.name as db2Name FROM Database1.TableA a LEFT JOIN Database2.TableA b ON a.id=b.id; Now you'll get: --- | db1Name | db2Name | --- | George | Bill | | Mark | Henry| | Harry| Ford | --- Hope this helps. - Jonathan -Original Message- From: Andy [mailto:[EMAIL PROTECTED]] Sent: Friday, January 04, 2002 5:50 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] How to querry two db in a single statement? Hi there, I would like to make a querry on 2 db. There is info in tables I would like to compare. As I know, there has first to be a conect on the db before the querry. But how to do this on 2 db?? Thanx for any help. Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] finding records wiht non-null columns
...WHERE some_column IS NOT NULL; - Jonathan -Original Message- From: bill [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 03, 2002 8:19 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] finding records wiht non-null columns Is there a better query than SELECT * FROM some_database WHERE some_column <> "" I had tried WHERE some_column <> NULL but that didn't work. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] How to speed up querries in a humangous db?
You could always categorize parts of the data and split it into separate tables. For instance, if you have a LOT of United States countries, you can duplicate the table, but keep only the U.S. country-records in the second table, and everything else in the first table. Then, before querying the database, use your PHP or Perl code or whatever you use in order to specify which table to use. - Jonathan -Original Message- From: Andy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 26, 2001 12:41 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] How to speed up querries in a humangous db? this is my sql statement: $stmt= " SELECT * from $geo_T3 WHERE country_code = '$country' AND province = '$province' order by city ASC "; cheers Andy "Miles Thompson" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > To help with that we'd have to know how your queries are phrased. Please > show us. > > Are you having to do a type conversion on the tinyint field? > > Miles Thompson > > At 02:07 AM 12/26/2001 +0100, Andy wrote: > >Hi there, > > > >I have a huge table with over 2 million entries. It takes to long to make a > >querry. No I am thinking about the datatypes. Maybe there is a better way. I > >have already indexed the search fields ( which made the table 75 MB big!!!) > > > >My table looks like that: > > > >field1 : varchar100 > >field2 : char2 > >field3 : tinyint2 > > > >I have an index on field 2 and 3 > > > >The SQL Querry is searching for: field 2 AND field 3 > > > >Does anybody have an Idea how to spead this up? > > > >Thanx in advance, > > > >Andy > > > > > > > >-- > >PHP Database Mailing List (http://www.php.net/) > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > >To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] RE: [mysql-support] RE: [PHP-DB] Run php page automatically
In my opinion, PHP works fine with small scripts like this. True, it could be more efficient with Perl, but when you don't know Perl, or don't have DB perl modules installed, PHP scriptlets are a nice way to take care of small tasks. And PHP can just as easily run a system command and append text to a log file: system('echo "A new message" >> MyLogFile'); I used to think that PHP was only for the purpose of viewing through web pages, but I've since found that it really can make a handy system tool sometimes when Perl is a hassle. - Jonathan -Original Message- From: NiteHaqr [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 20, 2001 1:53 PM To: Jonathan Hilgeman; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [mysql-support] RE: [PHP-DB] Run php page automatically I would probably recommend AGAINST running this php script from cron. I have a similar script but I use a PERL version for auto-updates. PHP should only (IMHO) be used where someone will see some output on a webpage. Other advantage of using PERL is that you could easily create a log file by redirecting the output (or PRINT statements) to a file using simple redirection (> and >>) instead of having to actually manipulate the file. Just my tuppenceworth. David -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Jonathan Hilgeman Sent: 20 December 2001 19:22 To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [mysql-support] RE: [PHP-DB] Run php page automatically I usually just create a cron job for this. Create your PHP script that will delete the matching records once. Then go into cron and have it run every 10 minutes. - Jonathan -Original Message- From: Harpreet [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 20, 2001 11:21 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-DB] Run php page automatically I would like to create a php page that would automatically run every 10 minutes or so to delete records from a table. This table has an expiration field and records r tested by comparing current date with the expiration date and record is deleted if expired. Is this possible. Help is greatly appreciated. I am using php for my application. I am working on a LInux server and using mysql as my database. regards, Harpreet Kaur Software Developer Crispin Corporations Inc. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] ___ To unsubscribe yourself from this list please go to http://www.mysql.org/mailman/listinfo/support and read the unsubscription information. support mailing list [EMAIL PROTECTED] http://www.mysql.org/mailman/listinfo/support -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Run php page automatically
I usually just create a cron job for this. Create your PHP script that will delete the matching records once. Then go into cron and have it run every 10 minutes. - Jonathan -Original Message- From: Harpreet [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 20, 2001 11:21 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-DB] Run php page automatically I would like to create a php page that would automatically run every 10 minutes or so to delete records from a table. This table has an expiration field and records r tested by comparing current date with the expiration date and record is deleted if expired. Is this possible. Help is greatly appreciated. I am using php for my application. I am working on a LInux server and using mysql as my database. regards, Harpreet Kaur Software Developer Crispin Corporations Inc. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Checkboxes, PHP, and MySQL
Or a better, more-visual way might be: "; ?> - Jonathan -Original Message- From: matt stewart [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 20, 2001 8:45 AM To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Checkboxes, PHP, and MySQL the value doesn't determine whether it's checked or not - it determines the value passed WHEN it's checked. try the lines below: echo""; }else{ echo">"; } or something along these lines. -Original Message- From: SpyProductions Support Team [mailto:[EMAIL PROTECTED]] Sent: 20 December 2001 16:40 To: [EMAIL PROTECTED] Subject: [PHP-DB] Checkboxes, PHP, and MySQL I've looked around in a few of the PHP lists for an answer to this, but can't come up with one. Here's what I am doing: I have a form with a few checkboxes. When the information as to whether the checkboxes are checked or not is 'saved' into the MySQL table, they are represented by a value of '1' - fine. When I want to edit this information, in the form of a similar form with checkboxes, the boxes are not checked off if they were before. What I am stuck on is how a checkbox can get checked off when pulling information from the MySQL as an array. Here's a line of code showing my array coming out. $result is the array. I guess what I am asking is that if a checkbox is assigned a value of one, why doesn't it appear as already checked off? Thanks, -Mike -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Checkboxes, PHP, and MySQL
It's not the checkbox's VALUE attribute that determines whether it is checked or not. If you add the empty attribute CHECKED, then the checkbox will be checked. Example: VarCheck1 will be checked, and VarCheck2 will not be checked. A checkbox will only have a value on submission IF IT IS CHECKED. So if the above two boxes were submitted and VarCheck1 was checked and VarCheck2 was not checked, the new page would have the variable VarCheck1 containing "Good", while VarCheck2 would be empty/non-existent. - Jonathan -Original Message- From: SpyProductions Support Team [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 20, 2001 8:40 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Checkboxes, PHP, and MySQL I've looked around in a few of the PHP lists for an answer to this, but can't come up with one. Here's what I am doing: I have a form with a few checkboxes. When the information as to whether the checkboxes are checked or not is 'saved' into the MySQL table, they are represented by a value of '1' - fine. When I want to edit this information, in the form of a similar form with checkboxes, the boxes are not checked off if they were before. What I am stuck on is how a checkbox can get checked off when pulling information from the MySQL as an array. Here's a line of code showing my array coming out. $result is the array. I guess what I am asking is that if a checkbox is assigned a value of one, why doesn't it appear as already checked off? Thanks, -Mike -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] PHP/Mysql web hosting: who's best?
I've been through a bunch of hosts and I've stuck with Aletia.com for a while now. Their e-mail support is excellent, and the staff is personable, friendly, and communicative with their customers. Many customers are on a first-name basis with some of the staff. I pay $9.95 a month for 200 megs of space, 10 mySQL databases, 10 subdomains, and the latest versions of all the server software I use. They also offer multi-domain hosting, so you can actually run up to 3 separate domains for free on one account. My brother has a music site - all he does is pay for the domain, and he shares my plan features for free. So if you have 3 small to medium sites, you can host them all for free on one $9.95/mo account. You can add more later, but after 3, there's a fee for each extra one. And there's also no setup fee and a 30-day money-back policy. It's a great service. - Jonathan SiteCreative.com -Original Message- From: Matthew Crouch [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 19, 2001 10:28 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] PHP/Mysql web hosting: who's best? I looked at hypermart.net and they want $30 a month, which seems okay but their package comes with things I don't need, like 15 email addresses. I have a modest little dB -- does anyone know of good deals for plain folk? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] cURL not returning anything
I copied one of my PHP applications to a new server that is within a firewall. The new server is running PHP 4.0.6 and cURL 7.8.1. I use cURL to connect to a gateway and process credit card transactions. In any case, if I run curl from the command line with all the required POST fields, I get an immediate response from the gateway and it works perfectly. HOWEVER, if I use PHP+cURL to run the EXACT same test transaction, I don't get any response back. It seems as though the fetching portion works. I even tried the sample cURL program off of PHP.net's manual, and it seemed to be fetching the sample HTML page, but nothing came back. It's like the fetching process works, but there's a problem returning the contents to either a file or a variable. But there are no errors reported by PHP. Help! - Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Connecting to MySQL Database
Try moving session_start to the very top of the script (above the require statement), and then place the session_register on the line immediately below session_start. You should first create the empty session variable $admin_user, and THEN assign a value to it. But the most logical thing to do would be to put all the session information at the very top of the script. - Jonathan -Original Message- From: Michael Elliott [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 13, 2001 8:40 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Connecting to MySQL Database Alright here goes. This is my login function: function login($username, $password) // check username and password with db // if yes, return true // else return false { // connect to db $conn = db_connect(); if (!$conn) return 0; // check if username is unique $result = mysql_query("select * from admin where username='username' and password = password('$password')"); if (!$result) return 0; if (mysql_num_rows($result)>0) return 1; else return 0; } And here is my admin.php page: "; do_html_url("login.php", "Login"); do_html_footer(); exit; } } do_html_header("Administration"); if (check_admin_user()) display_admin_menu(); else echo "You are not authorized to enter the administration area."; do_html_footer(); ?> I checked my database and as you said, the password has been encrypted. Shouldn't MySQL be able to compare it against an encrypted password? Thanks for your help! "Jonathan Hilgeman" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Can you show us the code that checks the username and password to see if > they're correct? > > Is this a custom admin page that you created? > > If your page is authenticating against the "mysql" database, then you should > know that MySQL encrypts the password and stores the encrypted password. > > So if you use the GRANT statement to create a new user that looks like: > User: admin > Pass: Secrets > > ...MySQL will store this as: > User: admin > Pass: Ata91230t!44 > > So if you try to login and your login code looks like: > if($PasswordEntered == $DatabasePassword) > { > ... > } > > So even if $PasswordEntered equals "Secrets", it won't be the same, because > it won't match the encrypted password. > > - Jonathan > > -Original Message- > From: Michael Elliott [mailto:[EMAIL PROTECTED]] > Sent: Thursday, December 13, 2001 5:54 AM > To: [EMAIL PROTECTED] > Subject: [PHP-DB] Connecting to MySQL Database > > > I am trying to create an admin page to administer my database. I used a > file .sql to create my database. In the file, I included: > > grant select, insert, update, delete > on database.* > to admin@localhost identified by 'password'; > > Why can I not log in successfully using admin and password? > > Thanks > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Connecting to MySQL Database
Can you show us the code that checks the username and password to see if they're correct? Is this a custom admin page that you created? If your page is authenticating against the "mysql" database, then you should know that MySQL encrypts the password and stores the encrypted password. So if you use the GRANT statement to create a new user that looks like: User: admin Pass: Secrets ...MySQL will store this as: User: admin Pass: Ata91230t!44 So if you try to login and your login code looks like: if($PasswordEntered == $DatabasePassword) { ... } So even if $PasswordEntered equals "Secrets", it won't be the same, because it won't match the encrypted password. - Jonathan -Original Message- From: Michael Elliott [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 13, 2001 5:54 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Connecting to MySQL Database I am trying to create an admin page to administer my database. I used a file .sql to create my database. In the file, I included: grant select, insert, update, delete on database.* to admin@localhost identified by 'password'; Why can I not log in successfully using admin and password? Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] inserting mysql data using php array???
I actually have an easy way to do INSERTs like this. First I create the array: $MyArray["field"] = value; $MyArray["name"] = "Jonathan"; $MyArray["age"] = 123; $MyArray["email"] = $email_address; and then I define this function somewhere in a function library: function Array2Query($dbArray) { foreach($dbArray as $dbField => $dbValue) { $dbQuery .= "$dbField='$dbValue',"; } $dbQuery = substr($dbQuery,0,strlen($dbQuery)-1); return $dbQuery; } and then I just create the query: $Query = "INSERT INTO table SET " . Array2Query($MyArray); $Result = mysql_query($Query); Hope it helps. - Jonathan -Original Message- From: justin gruenberg [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 27, 2001 2:59 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] inserting mysql data using php array??? meaning INSERT INTO table (first_name,middle_name,last_name,suffix) VALUES($an_array) no. that is not possible. you do actually have to write it out.. INSERT INTO table (first_name,middle_name,last_name,suffix) VALUES('$name[0]', '$name[1]', '$name[2]', $name[3]) I dont understand why you have these in arrays if they are only simple text inputs. it'd be much easier to understand your code visually if you had the name of each field actually descriptive of the content in it. It is also not valid html to have [ ]'s in the name parameter, I believe. - Original Message - From: "Ubaidul Khan" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, November 27, 2001 9:45 AM Subject: [PHP-DB] inserting mysql data using php array??? Hi I am running Apache 1.3.20 with MySQL 3.23.41, and PHP 4.0.6, on Linux Mandrake 8.1. I am trying to access a MySQL database from a PHP script. I have a html form, that takes input in an array (ie. name[0], name[1], name[2], name[3], these fields represent first_name, middle_initial, last_name, and suffix in the database). What I would really like to do is, take this array of data and insert each element in the corresponding column, in the database. Is it possible to insert each element of the array into the database, using an array, instead of typing out each value? -- Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] MySQL Can't Create UNIX socket (55)
I occasionally receive an error message saying that PHP was unable to create a UNIX socket (55). Anyone else have this error or know what it is? - Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] No Caching (Reloading Fresh Content)
Thanks, but I think you already sent me that link. Or maybe it was a different Chris. Either way, I couldn't get any viable answers from there. - Jonathan -Original Message- From: Boget, Chris [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 13, 2001 1:30 PM To: 'Jonathan Hilgeman'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] No Caching (Reloading Fresh Content) > How can I ensure that a specific page is never cached and ALWAYS gets > processed every time it is viewed? Sometimes a viewer can hit his/her > browser's Back button (such a hateful button), and get a cached version of > a dynamic page. I want this page's PHP code to be executed even if the > visitor uses their Back button to get to the page. Any thoughts on how to > do this? Check out the discussion on the following page: http://www.web-caching.com/forums/Forum1/HTML/000133.html Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] MySQL Restarting A LOT
Nope - I've already tried there. Nobody answers the door. Now I'm trying here because it's a PHP application, there may be a possibility of someone else experiencing or that has experienced the problem and fixed it. Thanks for the link, anyway. I'm already a subscriber. :) - Jonathan -Original Message- From: Matthew Loff [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 20, 2001 1:18 PM To: 'Jonathan Hilgeman'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] MySQL Restarting A LOT You have the wrong list. http://www.mysql.com/documentation/lists.html -----Original Message- From: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 20, 2001 2:56 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL Restarting A LOT Okay, this is beginning to bug. I have an application that uses several databases, and it restarts daily - anywhere from 1-8 times per day. This is not supposed to happen at all unless we manually restart the server. But I'm beginning to experience frequent problems with it just restarting out of the blue, and there's no patterns that I can follow. I have binary logging set up. Help... - Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] MySQL Restarting A LOT
Okay, this is beginning to bug. I have an application that uses several databases, and it restarts daily - anywhere from 1-8 times per day. This is not supposed to happen at all unless we manually restart the server. But I'm beginning to experience frequent problems with it just restarting out of the blue, and there's no patterns that I can follow. I have binary logging set up. Help... - Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Upload
Hola Lilian, You might want to check http://phpclasses.upperdesign.com and search for "upload." - BUT - I have found it much easier and simpler to just to use my own code when doing uploads. It is really simple, since most of the work is done by the browser and the server programs. To add an upload function just create 2 pages: --- page1.html (Can be located anywhere, even on your desktop) http://www.mysite.com/page2.php"; METHOD="POST"> --- --- page2.php (Should be at http://www.mysite.com/page2.php) --- - Jonathan -Original Message- From: Lilian Salazar [mailto:[EMAIL PROTECTED]] Sent: Friday, November 16, 2001 8:09 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Upload Hi, Exists some component that allows to do upload from archives to the Web server? Where it could find it? Somebody knows? The ideal would be that it served so much for Apache as for IIS. The Database is Oracle 8i Thank you very much. -- Saludos, Lilian mailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] No Caching (Reloading Fresh Content)
I read a bit of it, but it's still giving me trouble. I have the following short, test, PHP script: Number of Users: Now, I load that script up, which displays "Number of Users: " and a submit button. I click on the submit button, and then again on the next page and I basically see: "Number of Users: 200 - 3" and a submit button. Now, keeping the browser window open in the background, I go and edit the script, changing LIMIT 200 to LIMIT 100 so that it will return just 100 users. I save and then go back to my browser and click the Back button, but now I get an IE message saying that it cannot automatically resubmit the posted information. What I want is to have it re-query the database with this new LIMIT 100 query and return "Number of Users: 100 - 2" So at this point I have either the option of forcing the user to see the IE page and have them reload it, which works, or by allowing caching to go on. Any more thoughts? - Jonathan "Chris Boget" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > How can I ensure that a specific page is never cached and ALWAYS gets > > processed every time it is viewed? Sometimes a viewer can hit his/her > > browser's Back button (such a hateful button), and get a cached version of > > > a dynamic page. I want this page's PHP code to be executed even if the > > visitor uses their Back button to get to the page. Any thoughts on how to > > do this? > > Check out the discussion on the following page: > > http://www.web-caching.com/forums/Forum1/HTML/000133.html > > Chris > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] No Caching (Reloading Fresh Content)
How can I ensure that a specific page is never cached and ALWAYS gets processed every time it is viewed? Sometimes a viewer can hit his/her browser's Back button (such a hateful button), and get a cached version of a dynamic page. I want this page's PHP code to be executed even if the visitor uses their Back button to get to the page. Any thoughts on how to do this? - Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] sending bulk emails
Interesting that this should come up. The company I work for needs to send out an e-mail to 95k of their subscribers. Now, this is the first time in 2 years, so you can imagine that we'll be getting 94k of bounced e-mail addresses. So I'm writing a script that will handle sending out the e-mails and handling incoming bounced e-mail addresses. In any case, I would think that my PHP script would time out before sending 95k e-mails. I know it has timed out at 30 seconds before, but I can't remember if the faulty script had an endless loop for 30 seconds or if there was any data getting sent or received in that time. Anyone know beforehand whether I will get a timeout with sending these e-mails, and if so, how to work around it? - Jonathan -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: Friday, November 02, 2001 4:20 AM To: Cami Cc: PHP DB list Subject: Re: [PHP-DB] sending bulk emails > Does anybody know how to send bulk emails using php? Don't do it!! But of you must - I guess you could build an array containing email addresses, names, etc - taken from form input or a database or whatever and then loop the arrays mailing people... $mail = "mail("; for($i=0; $i<$email_array_name;$i++( { $mail .= "$values,"; } $mail .= "\"$subject\",\"$body\",\"From: $from\");"; Something like that anyway (that's just off the top of my head) Regards. Russ On Fri, 2 Nov 2001 11:26:22 - Cami <[EMAIL PROTECTED]> wrote: > Hi guys, > Does anybody know how to send bulk emails using php? > Thanks, > Cami > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > #---# "Believe nothing - consider everything" Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] SSL and IE
I'm programming a credit card payment form using PHP and I have been getting some strange feedback from test groups. The groups are varied as much as possible, and it seems as though some of the ones using MSIE 5.x are having trouble connecting to the secure page while others using MSIE 5.x CAN connect. I'm not what the difference is in the versions - any thoughts or known issues on this? - Jonathan ___ Mensa Torture: Drinking a 64 oz. Icee in 8 seconds. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] executing system commands
Try to avoid system commands whenever you can and instead use PHP functions when they're available. In this case, you can use the following function mkdir: http://www.php.net/manual/en/function.mkdir.php What is the problem you're having with that system command? The most frequent problems stem from lack of permissions in a directory that you're trying to manipulate. i.e. You try to add a file to a directory, but it gets rejected mysteriously - the most likely cause is that the directory is owned by someone else and you don't have write permissions. The other frequent problem stems from not defining the path to a command, i.e. system("mycommand"); instead of system("/usr/bin/mycommand"); Hope this helps if you're having problems. - Jonathan -Original Message- From: Ric Manalac [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 25, 2001 3:46 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] executing system commands hi, i'm a newbiew php developer. i'm trying to execute a system command in one of my php scripts. what i would like to do is to create a directory. my code goes like this: // chunk of code starts here $directory = generate_sessionid(); $command = "mkdir /home/httpd/html/miroku/downloads/$directory"; system($command, $dirsuccess); // chunk of code ends here generate_sessionid() is a function that generates a string that contains 16 random integers (0-9). i want to use that random string as the name of the directory that i'm creating. i checked php3.ini if safe mode is on but it is set to Off. thanks in advance! regards, ric -- == Note: The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient,or an employee or agent responsible for delivering this to the intended recipient,you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. == -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Creating a file using php
DN has a point, though. You shouldn't rely on the mailing list, otherwise you're going to turn out to be a pretty whacked programmer who doesn't know a good portion of the available options and commands. It's a good thing to just browse through the manual from time to time. Most people on here don't know the names of all the functions that PHP offers because they don't go through the manual. I think I know most of the important ones that pertain to me, but occasionally I'll find one that I didn't know about. Why? BECAUSE I READ THE MANUAL. You will learn a ton more by doing that than by asking questions here. Bottom Line: Read, read, read, read, READ the manual. Rinse and repeat. - Jonathan -Original Message- From: Harpreet [mailto:[EMAIL PROTECTED]] Sent: Monday, October 22, 2001 10:27 AM To: 'DL Neil'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Creating a file using php Blunt: NO!!! Duh Polite: Well its easier to post and get a reply rather then me going and serching fo it.;) regards, Harpreet Kaur Software Developer Crispin Corporations Inc. -Original Message- From: DL Neil [mailto:[EMAIL PROTECTED]] Sent: Monday, October 22, 2001 12:59 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Creating a file using php Harpreet, Blunt: Do you ever check the PHP manual before posting? Polite: XXVI. Filesystem functions http://www.php.net/manual/en/ref.filesystem.php =dn - Original Message - From: "Harpreet" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: 22 October 2001 17:34 Subject: [PHP-DB] Creating a file using php > Is there a command in PHP that can create a textfile and allows writing data > to it dynamically? Can someone point me to a tutorial or site . > > Thanks in advance, help is appreciated. > > Regards, > Harpreet Kaur > Software Developer > Crispin Corporations Inc. > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: Renaming a database name...
There is an excellent set of functions called dbUtils that takes care of this type of thing. You can get it from www.SiteCreative.com - Jonathan "Arief Fajar Nursyamsu" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Dear All... > > Can I rename a database name ? > > Regards > > rief > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Exporting Access -> MySQL with a macro
I've set up a MySQL datasource on a Windows machine and it works - I have tested it. I want to export a table from Access to the datasource, and I have been able to do it manually. HOWEVER, NOW I am trying to do the same thing except via a macro, and Access is giving me trouble. It keep saying something about not finding an installable ISAM, and the help files seem to indicate that I need to specify a ODBC connection string in the field for Database Name. Can someone help me out here? - Jonathan (The mySQL database is used in my PHP application, so it's not totally off-topic) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: NEWBIE - Needs Assistance with Joins
You said you get a parse error - so I'm assuming that is a PHP parse error, not an SQL error. Can you attach the entire problem file to an e-mail and send it to me, along with the exact error message? I have a feeling that it is something to do with the way you are retrieving the results in your PHP code... - Jonathan "Cecily Walker Kidd" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > Hello, > > I have two tables, one that contains an item id, album title name, and > artist ID number. The second table is a list of artists, with an > auto-increment artist ID. > > I want to join the two tables and have them output to a single PHP page. > I was following along with the tutorial at > http://www.webmasterbase.com/article/228/, and tried to modify it for my > own needs. When I do this, I get a parse error on the line that starts > with SELECT. Here's the code: > > $Link = mysql_connect ($Host, $User, $Password); > > $CDList =mysql_query( > "SELECT artist_name, album_title ". > "FROM artists, album_titles WHERE artist_id = aid"); > > > What am I doing wrong? > > Thanks in advance. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: DB design question (so maybe a little OT)
I'm thinking that you should get all the common fields among the different types of people: F. Name, L. Name, Address, CC Number And then create a different table containing additional information that only pertains to certain types of people. Then join them using an id. - Jonathan "Alexander Deruwe" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hey all, > > I have 4 database tables, that each describe some sort of 'person' > (transporting company, truck-driver, ..) and have almost exactly the same > fields. > Is this the best way of storing this, or does this make more sense: > > One table, with all the same fields + 1 extra, noting the type of person > (that could come from yet another table). > > Any suggestions, 'cause this really bothers me. :) > > ad. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Warning: Page has Expired
Actually, if you set it to be completely blank, it seems to let the browser handle the cache. I did that and have never received a page like that since then. I researched this for about 2-3 days straight, trying everything I could find. This seems to be the best method. Every once in a while you will get a cached page if you use your back button - but its extremely seldom. - Jonathan "Dave Watkinson" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... look in php.ini (or whatever the Linux equivalent is) for session.cache_limiter and set it to session.cache_limiter = nocache HTH 8^D Dave -Original Message- From: olinux o [mailto:[EMAIL PROTECTED]] Sent: 03 September 2001 19:34 To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Warning: Page has Expired I have the same troubles. I believe that the only solution is to use GET rather than POST as your FORM METHOD. There may be another way, but this may work fine, as long as you are not working with passwords/sensitive info. olinux --- Mad Nas <[EMAIL PROTECTED]> wrote: > Hi All > > I'm using PHP 4 and MySQL in W2K . > > When i submit a form and call a php file, i get this > message : > > __ > > Warning: Page has Expired __ Do You Yahoo!? Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Weird Problem In mysql_connect();
You mean you had all this inside a function? Like: function dbConnect () { $link = mysql_connect($host,$user,$pass); } ? If so, did you pass $host, $user, and $pass to the function by global-ing them like: function dbConnect () { global $host; global $user; global $pass; $link = mysql_connect($host,$user,$pass); } -OR- function dbConnect ($host,$user,$pass) { $link = mysql_connect($host,$user,$pass); } - Jonathan "Dave Watkinson" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... yeah - everything's fine! All the variables are being stored, but they're not getting passed to mysql_connect() for some really strange reason! :-( I've done a temporary fix - moved the entire database connection function to a separate file, and required that from the first required file (!), and it's working, but the original problem has still got me confused!!! Dave -Original Message- From: Brunner, Daniel [mailto:[EMAIL PROTECTED]] Sent: 31 August 2001 21:32 To: Dave Watkinson Subject: RE: [PHP-DB] Weird Problem In mysql_connect(); Hello!! Have your tried to echo the $host?? like $host=123.100.321.1 echo $host; Dan > -- > From: Dave Watkinson > Sent: Friday, August 31, 2001 3:17 PM > To: PHP-DB List (E-mail) > Subject: [PHP-DB] Weird Problem In mysql_connect(); > > Hey all > > I can connect with $conn = > mysql_connect("IP_Address","username","password"); > > but I can't connect with > $host = "IP_Address"; > $user = "username"; > $pass = "password"; > > $conn = mysql_connect($host,$user,$pass); > > Any ideas? All I get is "Can't connect to MySQL Server on 'localhost', > which is kinda weird cos I'm actually specifying a (different) IP > address in the host argument. > > I know it wasn't broken, but I decided to try and fix it anyways!!! > > TIA! > > > Dave > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Password Question
Don't let them change it to whatever they want - have your program/system create a new, random password and e-mail it to the user's account. Unless the malicious person has a way to intercept the e-mail - which is possible - it's kind of useless. But how else are you going to get that information to them? You also might try the "Answer your secret question" routine, where you type in a question that only you know the answer to, and you answer it to get the e-mail sent off... - Jonathan "Jeff Oien" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I like the new password idea. How do I make sure it's them who's creating > a new password so that someone else doesn't maliciously change their > password? If someone knew someone's username and e-mail address > I would think they could change it. Thanks. > Jeff > > > This doesn't seem to solve his problem of encryption, however. If you really > > want secure encryption, you'll be using one-way encryption, which means it > > cannot be decoded/decrypted/unencrypted/whatever. If you want to use this > > method, then instead of sending them their password, it would be best to > > create a NEW password, send it via e-mail, then encrypt and store the new > > password in the database, overwriting the old one. > > > > If you only want mild security on the passwords, you can always use some > > encode() and decode() like base64 encoding/decoding. It's not really > > "security" but it might discourage some script kiddies or hacker wannabes. > > Or you can be a little more creative and create your own password > > encryption/decryption, which would be a bit harder to break, depending on > > the level of complexity of the algorithm. > > > > - Jonathan > > > > > > "Russ Michell" <[EMAIL PROTECTED]> wrote in message > > news:SIMEON.10108311759.J@k1c. anglia.ac.uk... > > > Have a registration screen that inserts their names, email etc *and* their > > choice of username + > > > password: > > > > > > $sql = "INSERT INTO (username,realname,password,email) VALUES > > > ('$username',$realname',password('$password'),'$email')"; > > > $result = mysql_query($sql,$connect); > > > > > > //and do a check if the username chosen exists already: > > > > > > $chksql = "SELECT username FROM WHERE username='$username'"; > > > $chkresult = mysql_query($chksql,$connect); > > > $check = mysql_num_rows($chkresult); > > > if ($check == 0) > > > echo "this username already exists, select another."; > > > } > > > else { > > > echo "continue!"; > > > } > > > > > > if they have fogotton their password after registering, then have a link > > that sets a variable, and > > > check or this variable at the top of the page: > > > > > > go here to retrieve lost > > password > > > > > > if '$id' is set then have the user input their password and email address > > (the one they registered > > > with) and query the database for a username on the basis of the inputted > > info, and email it using > > > mail() to that email address! > > > > > > Use the same method for a lost username, they can then input their > > password and email and the > > > system will mail them the lost details! > > > > > > Good luck! > > > Russ > > > > > > On Fri, 31 Aug 2001 10:38:53 -0500 Jeff Oien <[EMAIL PROTECTED]> wrote: > > > > > > > I would like users to be able to request to have their password > > > > sent to their email address if they forget it. I would also like it > > > > encrypted in the database though. How is this best handled? > > > > > > > > The security isn't real important. But I let users choose their > > > > own password and if they use a password they use for other > > > > things I think it would be best for it to be encrypted. > > > > Jeff Oien > > > > > > > > -- > > > > PHP Database Mailing List (http://www.php.net/) > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > > > > > #---# > > > > > > "Believe nothing - consider everything" > > > > > > Russ Michell > > > Anglia Polytechnic University Webteam > > > Room 1C 'The Eastings' East Road, Cambridge > > > > > > e: [EMAIL PROTECTED] > > > w: www.apu.ac.uk/webteam > > > t: +44 (0)1223 363271 x 2331 > > > > > > www.theruss.com > > > > > > #---# > > > > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Password Question
This doesn't seem to solve his problem of encryption, however. If you really want secure encryption, you'll be using one-way encryption, which means it cannot be decoded/decrypted/unencrypted/whatever. If you want to use this method, then instead of sending them their password, it would be best to create a NEW password, send it via e-mail, then encrypt and store the new password in the database, overwriting the old one. If you only want mild security on the passwords, you can always use some encode() and decode() like base64 encoding/decoding. It's not really "security" but it might discourage some script kiddies or hacker wannabes. Or you can be a little more creative and create your own password encryption/decryption, which would be a bit harder to break, depending on the level of complexity of the algorithm. - Jonathan "Russ Michell" <[EMAIL PROTECTED]> wrote in message news:SIMEON.10108311759.J@k1c. anglia.ac.uk... > Have a registration screen that inserts their names, email etc *and* their choice of username + > password: > > $sql = "INSERT INTO (username,realname,password,email) VALUES > ('$username',$realname',password('$password'),'$email')"; > $result = mysql_query($sql,$connect); > > //and do a check if the username chosen exists already: > > $chksql = "SELECT username FROM WHERE username='$username'"; > $chkresult = mysql_query($chksql,$connect); > $check = mysql_num_rows($chkresult); > if ($check == 0) > echo "this username already exists, select another."; > } > else { > echo "continue!"; > } > > if they have fogotton their password after registering, then have a link that sets a variable, and > check or this variable at the top of the page: > > go here to retrieve lost password > > if '$id' is set then have the user input their password and email address (the one they registered > with) and query the database for a username on the basis of the inputted info, and email it using > mail() to that email address! > > Use the same method for a lost username, they can then input their password and email and the > system will mail them the lost details! > > Good luck! > Russ > > On Fri, 31 Aug 2001 10:38:53 -0500 Jeff Oien <[EMAIL PROTECTED]> wrote: > > > I would like users to be able to request to have their password > > sent to their email address if they forget it. I would also like it > > encrypted in the database though. How is this best handled? > > > > The security isn't real important. But I let users choose their > > own password and if they use a password they use for other > > things I think it would be best for it to be encrypted. > > Jeff Oien > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > #---# > > "Believe nothing - consider everything" > > Russ Michell > Anglia Polytechnic University Webteam > Room 1C 'The Eastings' East Road, Cambridge > > e: [EMAIL PROTECTED] > w: www.apu.ac.uk/webteam > t: +44 (0)1223 363271 x 2331 > > www.theruss.com > > #---# > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: resizing image in php
Any specific type of image? Look at the function and user comments on this PHP manual page. They have some good examples of resizing. http://www.php.net/manual/en/function.imagecopyresized.php - Jonathan "Andrius Jakutis" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello all, > > I need to make some program with php, that I would resize image. > > Any examples? > > Thanks! > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: store an array in a mysqldb
Yikes - not sure what everyone else is smoking. That's the hard way. I thought he was just asking if he could a variable that is an array inside a database and retrieve it later as an array. If this is the case, you can use the serialize() function to convert the array to data that can be stored in a mySQL database and then unserialize()-ed later. Here's the manual reference for some examples: http://www.php.net/manual/en/function.serialize.php - Jonathan "Jeroen Van Bussel" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I would like to know if it is somehow possible to store an array in a mysql > DB. > > Could somebody please help me. > > greetz Jeroen > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] ODBC Woes
if($TFM_Doesnt_Have_Anything_About_It == 1) { $Shut_Yer_Unhelpful_Trap = 1; $You->RTFM && see(); } "Yves Glodt" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... if ($RTFM == 1) { int odbc_connect (string dsn, string user, string password [, int cursor_type]) } else { $do_this='http://php.net/download-docs.php'; } On Tuesday 28 August 2001 22:05, Jonathan Hilgeman wrote: > Okay, all I need to know is this: > Some people say that they can only connect with: > odbc_connect("DSN=Datasource;UID=username;PWD=password","",""); > > Others say that doesn't work, and that they can only connect with: > odbc_connect("Datasource","username","password"); > > I am confused. I can use the second example (I'm on PHP 4.0.3), but > not hte first, although I need to use the first example. Is there > some sort of switch that lets you decide what format you can follow? > > - Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] ODBC Woes
I am attempting to use oPAYc (www.opayc.com) as a central method of payment processing. In order to pass information like different store configs or certificates at runtime, I need to pass them in the DSN string area. I'm using iODBC right now. - Jonathan "Andrew Hill" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Nope, it depends on the driver manager you are using, and I believe the > first example has been deprecated in nearly all cases. Why do you need to > use the first? > > Just use variables: > > $dsn="dsnname"; > $uid="user"; > $pwd="password"; > > odbc_conenct($dsn, $uid, $pwd) > > Best regards, > Andrew Hill > Director of Technology Evangelism > OpenLink Software http://www.openlinksw.com > Universal Data Access & Data Integration Technology Providers > > > -Original Message- > > From: Jonathan Hilgeman [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, August 28, 2001 4:05 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP-DB] ODBC Woes > > > > > > Okay, all I need to know is this: > > Some people say that they can only connect with: > > odbc_connect("DSN=Datasource;UID=username;PWD=password","",""); > > > > Others say that doesn't work, and that they can only connect with: > > odbc_connect("Datasource","username","password"); > > > > I am confused. I can use the second example (I'm on PHP 4.0.3), > > but not hte > > first, although I need to use the first example. Is there some sort of > > switch that lets you decide what format you can follow? > > > > - Jonathan > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] ODBC Woes
Okay, all I need to know is this: Some people say that they can only connect with: odbc_connect("DSN=Datasource;UID=username;PWD=password","",""); Others say that doesn't work, and that they can only connect with: odbc_connect("Datasource","username","password"); I am confused. I can use the second example (I'm on PHP 4.0.3), but not hte first, although I need to use the first example. Is there some sort of switch that lets you decide what format you can follow? - Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: Troubles in ODBC Land
Okay, I uninstalled unixODBC and tried iODBC ( I actually began to try it before, but then thought of something that might work on unixODBC, so I went back to it ). Now iODBC's odbctest application works with myODBC installed. However, after I recompile PHP with iodbc parameters, I try to run the odbc_connect function. If I misspell the DSN or use a non-existent one, I will get the following message: Warning: SQL error: [iODBC][Driver Manager]Data source name not found and no default driver specified. Driver could not be loaded, SQL state IM002 in SQLConnect Now, if I spell the defined DSN correctly and reload the page, the application just hangs. If I look at my error logs I see this: /usr/libexec/ld-elf.so.1: /usr/local/lib/libmyodbc.so: Undefined symbol "pthread_mutex_init" Once for every time I reload the page. This is odd, because this was a problem message I was receiving when testing unixODBC on the command line. After I installed iODBC, the command-line application was able to connect and query perfectly! So what gives? Why does one application work and another does not? I set the following environment vars - some may not make sense, but I've been trying everything: $EnvVars["LD_LIBRARY_PATH"] = "/usr/local/lib:/usr/include"; $EnvVars["LD_RUN_PATH"] = "/usr/local/lib:/usr/include"; $EnvVars["ODBCINI"] = "/usr/local/src/odbcsdk/doc/odbc.ini"; $EnvVars["PATH"] = "/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/bin:/usr/X11R6/bin:/hom e/suroot/bin:/usr/libexec:/usr/include"; foreach($EnvVars as $Key => $Val) { putenv("$Key=$Val"); $HTTP_ENV_VARS["$Key"] = $Val; } I can see via phpinfo() that they are getting set. Any more ideas? - Jonathan "Jonathan Hilgeman" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I'm on a FreeBSD 4.2 box running Apache 1.3.14+OpenSSL with mod_php4 > (4.0.3). I am attempting to set up ODBC for this box, and it's giving me > problems. > > First, I installed unixODBC (www.unixodbc.org), which went fairly smooth. > Second, I installed myODBC for UNIX via the ports directory, which also > seemed to install fine. > Third, I modified the mod_php4 Makefile to include --with-unixODBC and > compiled it. Everything seemed to go through fine, and Apache restarted at > the end. > > When I went to test the function, I got a "Page Cannot be Displayed" error > (IE 5.5). If I try removing the line that uses odbc_connect(...), it will > print out the request variables. Only when odbc_connect is present in the > code, will it break. > > $conn_id=odbc_connect(); > > I have tried this with a DSN name and a username and password, but it does > not work. Any ideas, anyone? > > - Jonathan > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Troubles in ODBC Land
I'm on a FreeBSD 4.2 box running Apache 1.3.14+OpenSSL with mod_php4 (4.0.3). I am attempting to set up ODBC for this box, and it's giving me problems. First, I installed unixODBC (www.unixodbc.org), which went fairly smooth. Second, I installed myODBC for UNIX via the ports directory, which also seemed to install fine. Third, I modified the mod_php4 Makefile to include --with-unixODBC and compiled it. Everything seemed to go through fine, and Apache restarted at the end. When I went to test the function, I got a "Page Cannot be Displayed" error (IE 5.5). If I try removing the line that uses odbc_connect(...), it will print out the request variables. Only when odbc_connect is present in the code, will it break. $conn_id=odbc_connect(); I have tried this with a DSN name and a username and password, but it does not work. Any ideas, anyone? - Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] can you help to beginner?
Actually, He should be using three. While one company could use many services, you might also have other companies that offer the same service. So there should be 3 tables to allow a many-to-many relationship. See my e-mail response to him. - Jonathan "Chris Hobbs" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I won't add to the code suggestions already given, but I will share one > thought about your tables - you absolutely _should_ be using two. Any > given company can have from one service to thousands (take GE, > everything from light bulbs to cruise missiles :). The only way to > capture that data effectively is in two tables. > > Andrius Jakutis wrote: > > > > Can you help me? I know that for this example its better to use one table, > > not two, but I am just learning.. > > > -- > Chris Hobbs Silver Valley Unified School District > Head geek: Technology Services Coordinator > webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ > postmaster: [EMAIL PROTECTED] > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: can you help to beginner?
Actually, it is much better to use three tables in this case. Have the following tables: Company table: companyid and companyname Services table: serviceid and servicename Company2Services table: companyid and serviceid Let's say you have three companies: 1 Kleptos Anonymous 2 Solar Sneezers 3 Microshaft And you have 4 services: 1 Dry-cleaning 2 Software programming 3 Web programming 4 Gardening Now let's say Solar Sneezers and Microshaft both offer Web programming as a service. You would add the following records to the Company2Services table: companyid = 2, serviceid = 3 companyid = 3, serviceid = 3 Now lets say Kleptos and Solar Sneezers both offer Dry-cleaning. Add the following to the Company2Services table: companyid = 1, serviceid = 1 companyid = 2, serviceid = 1 And only solar sneezers offers Gardening: companyid = 2, serviceid = 4 So now you have the following in the Company2Service table: companyid = 2, serviceid = 3 companyid = 3, serviceid = 3 companyid = 1, serviceid = 1 companyid = 2, serviceid = 1 companyid = 2, serviceid = 4 NOW, you have something that is flexible. Run the following query: SELECT c.companyname,s.service FROM Company2Service cs LEFT JOIN company c ON cs.companyid=c.companyid LEFT JOIN services s ON cs.serviceid = s.serviceid ORDER BY c.companyname; This will return 5 records, which are the 5 different combinations of companies and services, with the company names in alphabetical order. Here would be the code: $Link = mysql_connect(); $Query = "SELECT c.companyname,s.service FROM Company2Service cs LEFT JOIN company c ON cs.companyid=c.companyid LEFT JOIN services s ON cs.serviceid = s.serviceid ORDER BY c.companyname;"; $Result = mysql_db_query("MyDatabaseName",$Query,$Link); while($Row = mysql_fetch_array($Result)) { $company_name = $Row["companyname"]; $service_name = $Row["servicename"]; $Companies[$company_name][] = $service_name; } foreach($Companies as $Company => $ArrayOfServices) { print "Company: $Company\n"; foreach($ArrayofServices as $Service) { print "$Service\n"; } } -- Jonathan "Andrius Jakutis" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello All, > > Maybe you can help me, becouse I was searching for various documentations, > and it seems too difucult for me, becouse everything is so crowded. > > I need to built small html file, where I could get listed companies. > > I have two tables in my MYSQL database, companies and services. > Company table: > companyid and companyname > > services table: > id companyid services. > > So I need simply to get listings like this: > > Company name > services > > Company2 name > Services > > etc... > > Can you help me? I know that for this example its better to use one table, > not two, but I am just learning.. > > Thanks > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] It's just spam...
I thought I might advertise my own new line of products: Half-eaten Viagra. Do you have some troubles with you-know-who? Do you want me to take care of it for you? I thought not, and thats why this half-eaten Viagra will do at least half the job. If you can't handle the rest of the job, then maybe you shouldn't even be in a situation where you need Mr. Happy at all. (excluding those with medical disorders) - Jonathan --- What goes up, must come down. Ask any system administrator. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: FreeBSD connecting to Access database on NT/2k
Also, I should mention that I have glanced at two methods: iODBC and OpenRDA, but I'd like to know if I can use PHP's dl() function to simply load them when needed, instead of having to recompile... - Jonathan "Jonathan Hilgeman" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I'm not exactly sure how to go about using PHP on a FreeBSD box to connect > to an Access database on a Windows NT/2000 machine. I tried odbc_connect and > just got an "undefined function" error. But beyond that, all I have is a URL > to the database file, and a username and password. > > I've heard some suggestions, but I will not mention them because they seemed > to be confusing, and if anyone else suggests the solutions, the person might > try to offer their own, better explanation of how it all works. > > I want something that's free, preferably. :) > > - Jonathan, www.SiteCreative.com > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] FreeBSD connecting to Access database on NT/2k
I'm not exactly sure how to go about using PHP on a FreeBSD box to connect to an Access database on a Windows NT/2000 machine. I tried odbc_connect and just got an "undefined function" error. But beyond that, all I have is a URL to the database file, and a username and password. I've heard some suggestions, but I will not mention them because they seemed to be confusing, and if anyone else suggests the solutions, the person might try to offer their own, better explanation of how it all works. I want something that's free, preferably. :) - Jonathan, www.SiteCreative.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Photo Album Schema
Load-balancing? I thought this was more of a simple project? I still think the per-user directories are the most simplest, yet effective methods. - Jonathan, www.SiteCreative.com "Hugh Bothwell" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > "Sheridan Saint-Michel" <[EMAIL PROTECTED]> wrote in message > 036e01c12a62$22947200$[EMAIL PROTECTED]">news:036e01c12a62$22947200$[EMAIL PROTECTED]... > > You may want to, instead, create a directory for each user > > with their name. This has several benefits. The first is that it > > is an easy way to avoid conflicts. If Rick and I both upload > > an image 'beach.jpg' one won't be overwritten. > > I would prefer to store the picture's original name in > the database and on your site use unique generated > names... this would allow a single user to have > a number of pictures all named 'beach' (for instance). > > I would not use per-user directories; rather, I > would split them by upload time and/or sessionID. > This should give a more even distribution, and be > directly useful for load balancing etc. > > > > Finally, this opens up a variety of possibilities for the future. > > Things like FTP access, and having random pictures on the > > user's initial album page wouldn't be too dificult with this setup. > > Here's a question - how hard is it to set up > a virtual ftp dir, linked to arbitrary specified files? > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Photo Album Schema
Well said, Justin. I still would have to go with the scheme of: /photos/$UserID/$Category (?)/$FileName - Jonathan Hilgeman www.SiteCreative.com "Justin Buist" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED].. . > I'm going to play Devil's advocate a little bit more here. > > Lets say user #1 uploads 1family.jpg, and user 11 uploads family.jpg. > > "1" . "1family.jpg" == "11family.jpg" > "11" . "family.jpg" == "11family.jpg" > > You run into stuff like this anytime you let users upload files of any > sort. > > Justin Buist > Trident Technology, Inc. > 4700 60th St. SW, Suite 102 > Grand Rapids, MI 49512 > Ph. 616.554.2700 > Fx. 616.554.3331 > Mo. 616.291.2612 > > On Tue, 21 Aug 2001, Sheridan Saint-Michel wrote: > > > If you are going to use a single directory with a filename > > convention I would suggest something simple, yet unique > > like > > > > "id" . "filename" > > > > Where id is the unique userid from the DB and filename > > is the original name of the file. > > > > This would avoid conflicts (which is the point of a naming convention) > > and be fairly easy to implement. > > > > Sheridan Saint-Michel > > Website Administrator > > FoxJet, an ITW Company > > www.foxjet.com > > > > > > - Original Message - > > From: "Anthony Carlos" <[EMAIL PROTECTED]> > > To: "Rick Emery" <[EMAIL PROTECTED]>; "PHP-DB" <[EMAIL PROTECTED]> > > Sent: Tuesday, August 21, 2001 11:47 AM > > Subject: RE: [PHP-DB] Photo Album Schema > > > > > > > I vote for one directory to simplify the programming side of things. What > > do > > > you guys recommend for the filename convention? > > > > > > Would you let users determine it or would you force them into something > > like > > > a primary key? > > > > > > Anthony Carlos > > > > > > -Original Message- > > > From: Rick Emery [mailto:[EMAIL PROTECTED]] > > > Sent: Tuesday, August 21, 2001 11:55 AM > > > To: PHP-DB > > > Subject: RE: [PHP-DB] Photo Album Schema > > > > > > > > > I vote for a single directory. Then use Sheridan's naming suggestion. > > > > > > Richard Emery > > > Excel Communications, Inc. > > > IT Sr. Project Manager > > > (972) 478-3398 > > > (972) 944-0542 (pager) > > > > > > There is no "trying"... > > > There is only "Do" or "Not Do" > > > > > > > > > > > > -Original Message- > > > From: Jeff Oien [mailto:[EMAIL PROTECTED]] > > > Sent: Tuesday, August 21, 2001 10:49 AM > > > To: PHP-DB > > > Subject: RE: [PHP-DB] Photo Album Schema > > > > > > > > > I should have said photo_filename. That was what I intended to do. > > > Would you suggest one directory for all photos or separate directories > > > for each user? > > > Jeff Oien > > > > > > > Rick: I don't see any .php tags there... plus just because someone > > > > else has done it doesn't mean he can't do it as well =) > > > > > > > > Jeff: The only critique I would give from the description you have > > > > given us thus far is the fact that you appear to be storing the photo > > > > in the DB. > > > > > > > > The biggest bottleneck in a server-side script is usually the DB calls. > > > > With this in mind, you want to limit these calls as much as possible. > > > > > > > > I would suggest setting up a naming and/or directory scheme to store > > > > the pictures on the website, and then store the URL of the picture in > > the > > > > DB, rather than the image itself. > > > > > > > > Then when outputing the page just do something like > > > > > > > > echo ""; > > > > > > > > Sheridan Saint-Michel > > > > Website Administrator > > > > FoxJet, an ITW Company > > > > www.foxjet.com > > > > > > > > - Original Message - > > > > From: "Rick Emery" <[EMAIL PROTECTED]> > > > > To: <[EMAIL PROTECTED]>; "PHP-DB" <[EMAIL PROTECTED]> > > > > Sent: Tuesday, August 21, 2001 10:19 AM
[PHP-DB] Re: query returned "Resource id #2" (quick php/mysql tutorial)
Hi Alex, mySQL doesn't return normal PHP values. You need to use mysql functions to convert the mySQL resulting data into an array, like so: // mySQL Table: // // field1 | field2 | stuff | // // Florida | Ferrari | George | // // Detroit | Honda | Raymond | // // Kansas | Porsche | Betsy | // $Link = mysql_connect("server","username","password"); $Query = "SELECT field2,stuff FROM table;"; $Result = mysql_db_query("database",$Query,$Link); while($ResultRow = mysql_fetch_array($Result)) { // Now we're in a loop that cycles 3 times (there are 3 records) // The first time, $ResultRow will be an array that looks like: // $ResultRow["field2"] => "Ferrari" // $ResultRow["stuff"] => "George" // The next cycle through the loop, $ResultRow will look like: // $ResultRow["field2"] => "Honda" // $ResultRow["stuff"] => "Raymond" // The last cycle through the loop, $ResultRow will be: // $ResultRow["field2"] => "Porsche" // $ResultRow["stuff"] => "Betsy" print $ResultRow["stuff"] . " owns a " . $ResultRow["field2"] . ""; } // The above script will write the following to your screen: // George owns a Ferrari // Raymond owns a Honda // Betsy owns a Porsche Hope this helps. - Jonathan "Default" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > I'm using PHP 4 and mysql. I'm trying to do just a simple query from a > database table, but every time it returns the value, it returns > "Resource id #2" and results like that. Any ideas? Thanks. > > Alex > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: MYSQL_SOCKET
Edit your /etc/my.cnf file and search for the word socket. - Jonathan "Jay Paulson" <[EMAIL PROTECTED]> wrote in message 020f01c125d6$ce5b17f0$6e00a8c0@webdesign">news:020f01c125d6$ce5b17f0$6e00a8c0@webdesign... the variable MYSQL_SOCKET is set to /tmp/mysql.sock and i need it to be /var/lib/mysql/mysql.sock is there anyway i can set this variable in php? thanks... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: (OT) SQL query repeats
Try one of the following: 1) Move the GROUP BY between WHERE and HAVING -OR- 2)SELECT l.*,lg.* FROM lesson l LEFT JOIN lesson_gle lg ON lg.l_id=l.l_id WHERE lg.glenum LIKE 'MA%' GROUP BY l.l_id ORDER BY l.l_id - Jonathan "Adv. Systems Design" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I appreciate the input but it does not work...I tried it before and just now...this is the output: SELECT * FROM lesson, lesson_gle WHERE lesson.l_id = lesson_gle.l_id HAVING lesson_gle.glenum LIKE 'MA%' ORDER BY lesson.l_id GROUP BY lesson.l_id MySQL Error: You have an error in your SQL syntax near 'GROUP BY lesson.l_id ' at line 7 This script cannot continue, terminating. Any other ideas? Luis > hello: > > I have 2 tables...lesson and lesson_gle (which holds > repeating data for lesson, i.e. l_id, glenum) > > the following query gets results, but there are > repeated entries (one for every repeat in lesson_gle > table) > > SELECT * > FROM lesson, lesson_gle > WHERE lesson.l_id = lesson_gle.l_id > HAVING lesson_gle.glenum LIKE 'MA%' > ORDER BY lesson.l_id > > Any ideas on how to get the data to not repeat? > > Thanks > > Luis > > __ > Do You Yahoo!? > Make international calls for as low as $.04/minute with Yahoo! Messenger > http://phonecard.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: (OT) SQL query repeats
If you use "GROUP BY lesson.l_id" after your "ORDER BY lesson.l_id", you will not get any records with the same lesson.l_id value. - Jonathan "Adv. Systems Design" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > hello: > > I have 2 tables...lesson and lesson_gle (which holds > repeating data for lesson, i.e. l_id, glenum) > > the following query gets results, but there are > repeated entries (one for every repeat in lesson_gle > table) > > SELECT * > FROM lesson, lesson_gle > WHERE lesson.l_id = lesson_gle.l_id > HAVING lesson_gle.glenum LIKE 'MA%' > ORDER BY lesson.l_id > > Any ideas on how to get the data to not repeat? > > Thanks > > Luis > > __ > Do You Yahoo!? > Make international calls for as low as $.04/minute with Yahoo! Messenger > http://phonecard.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Resource Consumption
I previously posted that GD was giving me grief after a while, once I had moved the development of my site over to a Windows machine running Apache. I believe I now know why there were problems. After a while, I began receiving error messages and they would output in the middle of the image code, causing the image to break. Setting error_reporting to 0 allowed them to load. Now I have another problem. It seems that after Apache uses a file, it does not release it. I was able to display a sample image using a TrueType font file, and I was able to see the text perfectly. After refreshing, the text portion of the image did not work, but other elements of the image did. I wrote $php_errormsg to a logfile and was able to see the following error: Could not read font However, I KNOW the font is there, and it has loaded it before. I double-checked to make sure, and it was still there. It seems that it cannot open the file or something - as if another process were using the file. The only explanation I can think of is that Apache never let go of the file after using it. Is this a possibility? Remember, I am using a Windows 2k platform. - Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Windows+GD-ed Images
Hi people, I have a site that is made up of a number of different images that are all created on the fly with GD. The site works fine on a stable UNIX environment, but I have tried to transfer it to a regular Windows box for development, and I am having some troubles. MOST of the images will work fine, but after clicking through a few pages, images will begin to break. I have tried increasing the ThreadsPerChild in the Apache config to 100, then to 200 (originally 50), and if I reload the page after restarting the server, the new image will show up, but the same situation repeats after clicking through more pages. Is there any particular reason that anyone can think of, why this would happen? Here are the specs: Machine: Celeron 400-something/128 Mb RAM (Yes I know its not much to look at) Apache 1.3.19 MySQL 3.23.37 PHP 4.0.5 GD 1.8.3? (Something like that - it supports PNGs) I have plenty of hard drive space left. - Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: Warning Page Expired
Edit your php.ini file and find the line that starts with session.cache_limiter. Replace it so that the line says: session.cache_limiter = ; Fix for Caching Problems If you leave the value blank (the "; Fix for" part is just a comment), the browsers will handle their own caching and will eliminate this error. Occasionally you will get a page that is cached and you will need to refresh in order to see the updated contents, but for the most part, it works. Another solution is simply to use GET methods in your forms instead of POST. The whole page expired error is supposed to be a "safety" feature to keep people from seeing private, posted information. The GET method puts all the information in the query string, so there's nothing to hide, so caching doesn't become a problem. - Jonathan "Olinux O" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > How do I eliminate this error when the BACK button is > used? > > Warning Page Expired > > Thanks, > olinux > > > __ > Do You Yahoo!? > Make international calls for as low as $.04/minute with Yahoo! Messenger > http://phonecard.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: mysql_fetch_array
try just changing mysql_fetch_array to mysql_fetch_assoc "Bryan" <[EMAIL PROTECTED]> wrote in message 006801c1192c$649f6e30$272478cc@bryanspc">news:006801c1192c$649f6e30$272478cc@bryanspc... > mysql_fetch_array places 2 records for each one returned (example) > > Array > ( > [0] => 56 > [location_id] => 56 > ) > > Is there any way to delimate that and have the key present only once? > here is my code : > > /* > * > * > * Start code > * > * > */ > > while ($aRow = mysql_fetch_array($sResult) ) { > print_r($aRow); > > > foreach ($aRow as $key => $sValue) { > > $sData[$key] = "SELECT * FROM location WHERE region='$sValue' AND region > !='yes'"; > $sDataResult[$key] = mysql_query($sData[$key], $sDbcnx) or > die(mysql_error()); > > /* print Main heading linking to no where */ > > print "".$sValue.""; > > > while($aData[$key] = mysql_fetch_array($sDataResult[$key]) ) { > > /* grab the data from the main heading and print all the info for that > record */ > > print > " ".trim($aData[$key]['location'])."\ > n"; > > } /* end while */ > > > } /* end foreach */ > > } /* end main while */ > > /* > * > * > * End Code > * > * > */ > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: upload problem ...
Make sure you have ENCTYPE="multipart/form-data" in the tag, otherwise it will not work. You should have a begin and end tag and make sure it has the ENCTYPE attribute, and the METHOD='POST' and the ACTION attribute filled in, too. "Comp.Mail.Sendmail" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have implemented the code even as one file but the php file > just run without uploading the file to the server, though i have > chmod the uploadfolder "tmp" as 777,, > Any help.Thanks ... > > "Jonathan Hilgeman" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > File 1 (whateverform.php): > > > > > METHOD=POST> > > > > > > > > > > > > File 2 (fileupload-destination.php): > > > > if (is_uploaded_file($alfredoUpload)) > > { > > // Uncomment the following line ONLY if you're on Red Hat 7.0 > > // $Fix_RH7_Upload = fix_php_rh7_upload_bug($alfredoUpload); > > // Move to directory > > $filename = basename ($alfredoUpload_name); > > move_uploaded_file($alfredoUpload, "/home/mydirectory/uploadfolder/" . > > $filename); > > } > > // # > > // Fix PHP Upload Bug on Red Hat 7.0 > > // # > > function fix_php_rh7_upload_bug($tmp) > > { > > $infile=fopen($tmp,"r"); // Open the file for the copy > > $outfile=fopen("$tmp.new","w"); // create a new temp file > > $header=fgets($infile,255); //get the 1st line (netscape sometimes doesn't > > add a Content-type line) > > //if its more than just a \r\n sequence then > > if (strlen($header)>2) $header=fgets($infile,255); //get next line also > > while(!feof($infile)) > > { // Loop through the remaining file > > $temp=fread($infile,128); > > fwrite($outfile,$temp,strlen($temp)); //copying contents to new temp file > > } > > fclose($outfile); > > fclose($infile); > > copy("$tmp.new","$tmp"); //replace the original with our new bug fixed > file > > unlink("$tmp.new"); //and delete the new file > > return filesize($tmp); //return a true file size > > } > > > > > > You can post the upload to the same file if you want (so File 1 AND File 2 > > are whateverform.php). I just split them up for this example. I don't take > > credit for the fix_php_rh7_upload_bug function. That was posted by someone > > else on the PHP documentation. > > > > - Jonathan > > > > > > -Original Message- > > From: comp.mail.sendmail [mailto:[EMAIL PROTECTED]] > > Sent: Friday, July 13, 2001 10:28 AM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP-DB] upload problem ... > > > > Could anyone send me the actual code for doing the files upload to > > a linux box with php. I know the form for the upload but not the php file > > that > > does the upload . > > Thanks everyone. > > > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: upload problem ...
File 1 (whateverform.php): File 2 (fileupload-destination.php): if (is_uploaded_file($alfredoUpload)) { // Uncomment the following line ONLY if you're on Red Hat 7.0 // $Fix_RH7_Upload = fix_php_rh7_upload_bug($alfredoUpload); // Move to directory $filename = basename ($alfredoUpload_name); move_uploaded_file($alfredoUpload, "/home/mydirectory/uploadfolder/" . $filename); } // # // Fix PHP Upload Bug on Red Hat 7.0 // # function fix_php_rh7_upload_bug($tmp) { $infile=fopen($tmp,"r"); // Open the file for the copy $outfile=fopen("$tmp.new","w"); // create a new temp file $header=fgets($infile,255); //get the 1st line (netscape sometimes doesn't add a Content-type line) //if its more than just a \r\n sequence then if (strlen($header)>2) $header=fgets($infile,255); //get next line also while(!feof($infile)) { // Loop through the remaining file $temp=fread($infile,128); fwrite($outfile,$temp,strlen($temp)); //copying contents to new temp file } fclose($outfile); fclose($infile); copy("$tmp.new","$tmp"); //replace the original with our new bug fixed file unlink("$tmp.new"); //and delete the new file return filesize($tmp); //return a true file size } You can post the upload to the same file if you want (so File 1 AND File 2 are whateverform.php). I just split them up for this example. I don't take credit for the fix_php_rh7_upload_bug function. That was posted by someone else on the PHP documentation. - Jonathan -Original Message- From: comp.mail.sendmail [mailto:[EMAIL PROTECTED]] Sent: Friday, July 13, 2001 10:28 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] upload problem ... Could anyone send me the actual code for doing the files upload to a linux box with php. I know the form for the upload but not the php file that does the upload . Thanks everyone. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: Warning: Page has Expired
You can also change your form to use the GET method instead. That works without changing your php.ini file. But don't use GET methods for logging in or passing secure information. It's much more insecure than POSTing (not that POSTing variables is a 100% secure method, either)... "Keith Spiller" <[EMAIL PROTECTED]> wrote in message 003401c10a0f$6bd7da60$3083140a@aristotle">news:003401c10a0f$6bd7da60$3083140a@aristotle... I've setup a members directory in mysql that is searchable via different field and I limit the number of records. I use session variables to remember the number of records to display, what the starting record is, what the search string and search fields are. At anytime a user can click on an id number to do a Select statement that queries for that single row of data. Afterward, if the user hits their browsers back button I get: "Warning: Page has Expired" I've noticed allot of sites just ask the user to not use the back button. I'm curious if this is caused by an error in my code or because I used session variables that might have changed in the last MySQL select query. So that when you hit back, the browser is using some sort of cached data while still loading the php code? I'm very confused at this point. Is there anything I can do to prevent the "Expired Page" warning, rather than expecting my viewers to learn to do without it. Keith Spiller [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: Warning: Page has Expired
I had this problem, too. It seems as though when using session variables and POST forms, you get this error when trying to go back to a POSTed page. I believe I read somewhere that the error is more of a security issue - to keep others from simply going back and seeing any private data, but I'm not clear on how that works. I finally found a plausible fix, though. Just open up your php.ini file and look for [Session]. Under it should be session.cache.limiter - just set that to a blank. Here's my [Session] section: BEGIN SNIPPET [Session] session.save_handler = files ; handler used to store/retrieve data session.save_path = /tmp; argument passed to save_handler ; in the case of files, this is the ; path where data files are stored session.use_cookies = 1 ; whether to use cookies session.name = PHPSESSID ; name of the session ; is used as cookie name session.auto_start= 0 ; initialize session on request startup session.cookie_lifetime = 0 ; lifetime in seconds of cookie ; or if 0, until browser is restarted session.cookie_path = / ; the path the cookie is valid for session.cookie_domain = ; the domain the cookie is valid for session.serialize_handler = php ; handler used to serialize data ; php is the standard serializer of PHP session.gc_probability= 1 ; percentual probability that the ; 'garbage collection' process is started ; on every session initialization session.gc_maxlifetime= 1440; after this number of seconds, stored ; data will be seen as 'garbage' and ; cleaned up by the gc process session.referer_check = ; check HTTP Referer to invalidate ; externally stored URLs containing ids session.entropy_length= 0 ; how many bytes to read from the file session.entropy_file = ; specified here to create the session id ; session.entropy_length= 16 ; session.entropy_file = /dev/urandom session.cache_limiter = ; (leaving it blank) ; session.cache_limiter = nocache ; set to {nocache,private,public} to ; determine HTTP caching aspects session.cache_expire = 180 ; document expires after n minutes session.use_trans_sid = 1 ; use transient sid support if enabled ; by compiling with --enable-trans-sid - END SNIPPET - Hope this helps. - Jonathan "Keith Spiller" <[EMAIL PROTECTED]> wrote in message 003401c10a0f$6bd7da60$3083140a@aristotle">news:003401c10a0f$6bd7da60$3083140a@aristotle... I've setup a members directory in mysql that is searchable via different field and I limit the number of records. I use session variables to remember the number of records to display, what the starting record is, what the search string and search fields are. At anytime a user can click on an id number to do a Select statement that queries for that single row of data. Afterward, if the user hits their browsers back button I get: "Warning: Page has Expired" I've noticed allot of sites just ask the user to not use the back button. I'm curious if this is caused by an error in my code or because I used session variables that might have changed in the last MySQL select query. So that when you hit back, the browser is using some sort of cached data while still loading the php code? I'm very confused at this point. Is there anything I can do to prevent the "Expired Page" warning, rather than expecting my viewers to learn to do without it. Keith Spiller [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]