[PHP-DB] Re: Refresh after DB Query
Sorry if you are a newbie.. but if might help if you delete the records before you select them to display in html ie: put the delete query at the top of the page, just after this line: require (templates/db_connect.php); adam
[PHP-DB] Re: Strange MySQL Query Problem
I have a simple form which queries the database based on 2 pop-up menu choices and keywords entered by the user, it passes on the variables as follows: pop-up1=choice1, pop-up2=choice2, textfield=user specified data use : $pop-up1 = $HTTP_POST_VARS[pop-up1]; ... each variables you passed PHP 4.2's default doesn't support register global the query is as follows $result = mysql_query(SELECT some_id, some_description, some_feature FROM '$pop-up1' WHERE some_description LIKE '%$texfield%' AND some_feature LIKE '%$pop-up2'); it tells me that column which equals to the $texfield does not exists, a bit buffled I am, I've these queries before on larger web servers, this is the first time on my workstation and it does just that, simpler queries work fine... thanks in advance, R ps. the form is guarded against empty entries ps2. RedHat 7.3, Mysql 3.23.51, Apache 1.3+ wik PHP 4.2.1 configured for MySQL -- 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] Dow name from Dow number
Hello, in PostgreSQL I have this: select date_part('dow', timestamp_name), count(id) from table_name group by date_part('dow',timestamp_name); and I get a record count list grouped by week days. E.g.: ---+-- 0 | 123 1 | 16 2 | 45 ... | 6 | 9 I just want the day's name in the place of the day's number. E.g. --+-- sun | 123 mon|16 tue |45 etc. I use PHP 4.0 Thanks for help. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] RE: Refresh after DB Query - Solved
Ugh! Thanks, Adam. I knew it would be something stupid. Although I am kind of new (less than 6 months) to PHP, I'm really not that bad with it (IMHO). I really thought I had tried putting the DELETE stuff where you said to put it and it didn't work. However, new day, fresh eyes, your advice...it works now. Thanks again. Rich -Original Message- From: Adam Royle [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 03, 2002 2:22 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: Refresh after DB Query Sorry if you are a newbie.. but if might help if you delete the records before you select them to display in html ie: put the delete query at the top of the page, just after this line: require (templates/db_connect.php); adam
Re: [PHP-DB] PDF/FDF Support
on 7/2/02 8:20 PM, Jefferson Cowart at [EMAIL PROTECTED] appended the following bits to my mbox: I'm trying to write a PDF form that people can fill in. I want to then take the data, store it in my database, and then recall the data, and display a filled in form with that data. I see two options. The first is to have acrobat post the entire PDF file and store the entire file. This option seems to be to be a little bit of a waste as much of the data is the same (the form). The second option is to have it post FDF data and then later turn that around and put it back into a form for people to view. Does anyone know of any good documentation on how to do this with PDF files, PHP, and a DB backend? The most accessible solution is to generate the PDF file with all of the data filled in as text in the PDF. That way, programs other than Acrobat Reader can view the PDF file. If you have your PHP module compiled with FDF support, you can read this page for more info: http://www.php.net/manual/en/ref.fdf.php If you don't have that, it is fairly straightforward to make an FDF document by hand with PHP. I put up a sample at: http://www.burney.ws/misc/fdf-sample.phps Basically, though, you want to do the following: 1) Use Acrobat to create the PDF fill in document, using reasonable variable names (probably your database field names) 2) Write a PHP file that does something like: - Output the correct FDF header - Output the standard beginning FDF stuff - Put the database data into the the /T and /V fields - Set the /F value as the URL of your pdf fill-in. - Output the standard ending FDF stuff Caveats: Acrobat Reader must be installed as a web plugin (i.e., opening the document in the browser) and it must be set to handle the FDF type. This may be the default case in Windows, but I know from experience that it is a PITA on old Macs. Hope that helps. Sincerely, Paul Burney http://paulburney.com/ ?php while ($self != asleep) { $sheep_count++; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] date issue with MsSql - follow up....still a bug?
Hello. I was curious if any one is using PHP4.2x with SQLserver 7(or 2000) and having luck with the datetime type. No matter the datetime in the database PHP 4.1.2 is always returning Feb 06 2036 6:37AM . The insert is correct, its only the select that this happens on. There was a bug report, though not exactly what is happening to me with 4.1.1, and not the same OS, and i don't want to duplicate this report, but would rather upgrade to 4.2 if the problem is fixed in this version, but i'm not convinced that it is as the bug report is not closed. Thanks for any input any of you may have, Jeff - Forwarded by Jeffrey N Dyke/CORP/Keane on 07/03/2002 08:59 AM - Jeffrey N Dyke To: [EMAIL PROTECTED] 07/02/2002 cc: 05:40 PM Subject: date issue with MsSql I'm posting info into a SQL Server from a form, all has been working fine inserting, updating and selecting information for months. I have recently added a date field to the table with the type of datetime. It updates the table in SQL Server fine, but it keeps pulling it back as this date [Feb 07 2036 06:30AM]. for an example i put in a date of 01/01/2001(which is what is in the Database) it doesn't matter the date that i'm inputting, it always brings back the same date. set up - solaris 8/Apache/SQLServer 7/PHP4.12 any ideas? Thanks Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] cookies multiple pages
I'm having a problem with cookies over several pages. I've tried to set them up per the manual, ie: prior to header, and using setcookie('cookiename',$value,time()+3600). The cookie seems to be created fine on the first page, and passed to the second page, but is not maintained when the pages are re-viewed. I am trying to use this to assign a user id when someone comes in, and keep their id while they go through various searches and resulting pages, as well as keeping their search parameters for them. But when they go to a new search, all the data gets wiped and it starts all over. I have the cookie set for an hour, but it is empty when the search is run again. I thought cookies would remain in effect for the duration of the life (an hour) and be accessible to the pages over again. Help?? My code is as follows: search.php: if (!isset($user_data)) { setcookie(user_data,,time()+(3600));// set for 6 weeks *24*7*6 } [snip] if($user_data==) { $sql=insert into user (last_login) values (now()); mysql_query($sql); $myID= mysql_insert_id(); $user_data = $myID; } search_result.php: if (isset($user_data)) { $myID = $user_data; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] cookies multiple pages
Is this a issue with register _globals = off. try referencing it with $_COOKIE['user_data']. Also isn't 3600 only an hour. 60secs * 60mins? i think 6 weeks would be... 151200 60 * 60 * 42days does that work? Jeff Terry Romine eatrom@blazing-t To: [EMAIL PROTECTED] rails.com cc: Subject: [PHP-DB] cookies multiple pages 07/03/2002 10:45 AM I'm having a problem with cookies over several pages. I've tried to set them up per the manual, ie: prior to header, and using setcookie('cookiename',$value,time()+3600). The cookie seems to be created fine on the first page, and passed to the second page, but is not maintained when the pages are re-viewed. I am trying to use this to assign a user id when someone comes in, and keep their id while they go through various searches and resulting pages, as well as keeping their search parameters for them. But when they go to a new search, all the data gets wiped and it starts all over. I have the cookie set for an hour, but it is empty when the search is run again. I thought cookies would remain in effect for the duration of the life (an hour) and be accessible to the pages over again. Help?? My code is as follows: search.php: if (!isset($user_data)) { setcookie(user_data,,time()+(3600));// set for 6 weeks *24*7*6 } [snip] if($user_data==) { $sql=insert into user (last_login) values (now()); mysql_query($sql); $myID= mysql_insert_id(); $user_data = $myID; } search_result.php: if (isset($user_data)) { $myID = $user_data; } -- 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] Re: Changing leters to *
Password Field: INPUT TYPE=PASSWORD An INPUT element with `TYPE=PASSWORD' is a text field as above, except that the value is obscured as it is entered. (see also: section Security Considerations). For example: pName: input name=login Password: input type=password name=passwd Bartosz Matosiuk [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... Hi I need to change letters to * in the form window (password) and I don't know how. Mayby someone has got some ideas Thanks madsiuk ([EMAIL PROTECTED]) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] cookies multiple pages
Banging my head against a wall with this ! Hope someone can help ! Using MySQL Trying to list cities with events for that month I've correctly (i think) formatted my date to a datetime style for MySQL $month is there chosen one $tosearch = date(Y-$month-d 00:00:00); And then this is my inquiry -(although this just would be 60 days in advance but it doesn't work) And what I really want is just for that month ? SO if its already 20th of the month it only looks a the next 11 days SELECT distinct t_city_name,t_city_id_city, t_event_date FROM t_city,t_zipcodecity,t_location,t_event WHERE (t_city_id_city = t_zipcodecity_id_city) AND (t_zipcodecity_zipcode = t_location_zipcode ) AND (t_location_sex = 2) AND (t_location_id_location = t_event_id_location) AND (t_event_date = (DATE_ADD('2002-07-03 00:00:00', INTERVAL 60 day)) ) ORDER by t_city_name Can anyone help please -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] cookies multiple pages
1) no, the commented setcookie(user_data,,time()+(3600));// set for 6 weeks *24*7*6 I would move the *24*7*6 back into the (3600) to make it so. I just want to test for an hour 2) so maybe this is a problem with the server? I've been tearing my hair out because neither cookies nor sessions are acting the way that I have done them in the past on a different server. **sigh** On Wednesday, July 3, 2002, at 10:05 AM, [EMAIL PROTECTED] wrote: Is this a issue with register _globals = off. try referencing it with $_COOKIE['user_data']. Also isn't 3600 only an hour. 60secs * 60mins? i think 6 weeks would be... 151200 60 * 60 * 42days does that work? Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] cookies multiple pages
as in if (!isset($_COOKIE['user_data'])) { setcookie(user_data,,time()+(3600));// set for 6 weeks *24*7*6 } ?? nah.. that doesn't work either. It still creates a new cookie. On Wednesday, July 3, 2002, at 10:05 AM, [EMAIL PROTECTED] wrote: Is this a issue with register _globals = off. try referencing it with $_COOKIE['user_data']. [EMAIL PROTECTED] said: Trust me this does not work with php 4.2.1 and apache 2.0.39 from what I am told if you get the cvs for apache 2.0.4 it should but I just down graded to apache 1.3.26 and php 4.0.6 and eveything works like a champ. Just my .02 of course if you get it working let me know what you did as I spent a week on it... but since this isn't my server, I can't downgrade or reset settings. *sigh* Thanks, so far.. Terry
Re: [PHP-DB] cookies multiple pages
One thing I did find was to look at your php.ini file and see where the session.save_path=/tmp this is now pointing to your server /tmp not the apache directory anymore so you will either have to change the permissions on that folder so apache can write there or make a directory somewhere else and do the same. That is how I got my sessions to work again and or court to make sure it is enabled. As for the mulitple cookies that is still a somthing I have not been able to get to work. When I posted it in the bugs. section of php.net they said to use the cvs apache 2.0.4 version and it should work...but I am not in a position to put non-stable things in production. HTH-- Khris Terry Romine [EMAIL PROTECTED] 07/03/2002 11:32 AM To: [EMAIL PROTECTED] cc: php-db [EMAIL PROTECTED] Subject:Re: [PHP-DB] cookies multiple pages 1) no, the commented setcookie(user_data,,time()+(3600));// set for 6 weeks *24*7*6 I would move the *24*7*6 back into the (3600) to make it so. I just want to test for an hour 2) so maybe this is a problem with the server? I've been tearing my hair out because neither cookies nor sessions are acting the way that I have done them in the past on a different server. **sigh** On Wednesday, July 3, 2002, at 10:05 AM, [EMAIL PROTECTED] wrote: Is this a issue with register _globals = off. try referencing it with $_COOKIE['user_data']. Also isn't 3600 only an hour. 60secs * 60mins? i think 6 weeks would be... 151200 60 * 60 * 42days does that work? Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] cookies multiple pages
just checked and the server is running Apache 1.6.19 and PHP 4.0.6 Terry On Wednesday, July 3, 2002, at 09:52 AM, [EMAIL PROTECTED] wrote: Trust me this does not work with php 4.2.1 and apache 2.0.39 from what I am told if you get the cvs for apache 2.0.4 it should but I just down graded to apache 1.3.26 and php 4.0.6 and eveything works like a champ. Just my .02 of course if you get it working let me know what you did as I spent a week on it...
[PHP-DB] Date Times stuff
Banging my head against a wall with this ! Hope someone can help ! Using MySQL Trying to list cities with events for that month I've correctly (i think) formatted my date to a datetime style for MySQL $month is there chosen one $tosearch = date(Y-$month-d 00:00:00); And then this is my inquiry $int is the number of days left if current month, 31 otherwise. But the weird thing is it always returns a result ? even if no events, and for this month where there are events it returns the city name 3 times ? totally ignoring the distinct ! SELECT DISTINCT t_city_name,t_city_id_city, t_event_date FROM t_city,t_zipcodecity,t_location,t_event WHERE (t_city_id_city = t_zipcodecity_id_city) AND (t_zipcodecity_zipcode = t_location_zipcode ) AND ((t_location_sex = $pref) OR (t_location_sex = 6) OR (t_location_sex = 0)) AND (t_location_id_location = t_event_id_location) AND (t_event_date (DATE_ADD('$tosearch', INTERVAL $int day)) ) ORDER by t_city_name I'm sure its something stupid but Can anyone help please! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] system help!
hey all, i have this ?php $today = getdate(); $month = $today['mon']; $day = $today['mday']; $year = $today['year']; $date=$month.-.$day; $command=mysqldump -uroot --password=* iktato intrat2003 tt.sql; $test=system($command); ? When $command=mysqldump -uroot --password=* iktato intrat2003 ; it works and when $command=mysqldump -uroot --password=* iktato intrat2003 tt.sql; it doesn't work. BUT!!! i have made a consol script that runs a linux command from a normal input text box. With that same command it executes it and makes the tt.sql. And im not using exec() because i need to see the results of it thats why i use system() help pls Thomas omega Henning -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Strange characters from MSSQL
Hi there, Can anybody help me? I'm building a webinterface to an existing MSSQL database. When displaying text from the database, strange characters like ? show up, when I'm supposed to get æ, ø and å (Danish charset). We're talking PHP4 on IIS5, W2K server. The MSSQL server is on a different machine. (A really crappy setup...) /Tim K -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Strange MySQL Query Problem
I already got some replies for this but it wasn't it, here is the problem: I have a simple form which queries the database based on 2 pop-up menu choices and keywords entered by the user, it passes on the variables as follows: pop-up1=choice1, pop-up2=choice2, textfield=user specified data the query is as follows $result = mysql_query(SELECT some_id, some_description, some_feature FROM '$pop-up1' WHERE some_description LIKE '%$texfield%' AND some_feature LIKE '%$pop-up2'); it tells me that column which equals to the $texfield does not exists, meaning that the query seems to be fed wrong? No idea here, $texfield and $pop-up2 are not requests for tables but matches in those tables a bit buffled I am, I've these queries before on larger web servers, this is the first time on my workstation and it does just that, simpler queries work fine... thanks in advance, R ps. the form is guarded against empty entries ps2. RedHat 7.3, Mysql 3.23.51, Apache 1.3+ wik PHP 4.2.1 configured for MySQL -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] A challenge
... At least, I found it challenging. Hopefully someone here will find this a lot easier =) I am developing a website wherein customers can log in, enter in the name and type of their business (rather like the yellow pages.) I have a database of all the customers, and each table in the database is another type of business. (For example, in the table 'Gyms' all of the places where you can workout will be listed.) Currently the database has no tables in it. When a new type of business registers, then the table is created. In order to prevent many variations of the same table from being created (I.E. Restaurants, Cafe's, Luncheonettes etc) I have customers choose what type of business they are from a pull down menu. Here is the challenge: I would like my users who come to browse to see a similar pull down menu, but I want this menu only to list those types of businesses that have registered. Essentially I would like the pull down menu customers see to be a dynamic list of names of existing tables, updating for each new table that is created. As for how to do this I'm stuck. It seems that it must be php that modifies an html form. Any suggestions?? Deeply appreciated. Thanks. [EMAIL PROTECTED] -- Jonathan
Re: [PHP-DB] Strange MySQL Query Problem
From your query, it looks as if you are letting the user select the table that they can query with $pop-up1. Is that correct? If so, do all the available choices of tables have the same column names? Other than that I can't see why this query would fail. Martin eat pasta type fasta [EMAIL PROTECTED] 07/03/02 04:27PM I already got some replies for this but it wasn't it, here is the problem: I have a simple form which queries the database based on 2 pop-up menu choices and keywords entered by the user, it passes on the variables as follows: pop-up1=choice1, pop-up2=choice2, textfield=user specified data the query is as follows $result = mysql_query(SELECT some_id, some_description, some_feature FROM '$pop-up1' WHERE some_description LIKE '%$texfield%' AND some_feature LIKE '%$pop-up2'); it tells me that column which equals to the $texfield does not exists, meaning that the query seems to be fed wrong? No idea here, $texfield and $pop-up2 are not requests for tables but matches in those tables a bit buffled I am, I've these queries before on larger web servers, this is the first time on my workstation and it does just that, simpler queries work fine... thanks in advance, R ps. the form is guarded against empty entries ps2. RedHat 7.3, Mysql 3.23.51, Apache 1.3+ wik PHP 4.2.1 configured for MySQL -- 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 with htaccess files
RE: PHP with htaccess files... Has anyone used basic http authentication with htaccess files that reference password files and used PHP scripts that could add new users to the password file? I wanted to use a PHP login page, but most of the site I want to protect is already written in html and I do not want to go through the entire site changing the extensions and adding an include statement to reference the login script. So I am wondering if there is any thing I need to consider or worry about when using php with htaccess security... Any help or advice would be greatly appreciated. Larentium [EMAIL PROTECTED]
[PHP-DB] problem getting data from mysql into backend.csv...
hello. we are new to this list and new to php so forgive me if this is a dumb question but we are stuck... we are trying to setup the event calendar script that http://www.php.net uses on their front page. The only problem I'm having is getting the information from the mysql database to the backend.csv file that it uses. Everything is working properly included the submitting of the events, and the data is being imported correctly. Has only used this script before, or maybe has some ideas on what I need to check? Thanks in advance. matthew de Jongh president the spa! internet voice (413) 539-9818 www.the-spa.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Join on insert???
I am writing scripts to load user data into a MySQL database. I have tables in the DB called People and PeopleEmail. The PeopleEmail table stores one email address per record with one of the columns corresponding to the PID of the people table. Is there a way to run a single query that will insert the data into the people table and then take the auto generated pid and use it to insert the email into people email. Right now I envision having to use 3 queries (1 insert into people, a select to retrieve the PID, and then another insert to insert the email.) Is there an easier way? Thanks Jefferson Cowart [EMAIL PROTECTED] Support Open Instant Messaging Protocols http://www.petitiononline.com/openIM/petition.html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Strange MySQL Query Problem
Could this be as simple as a typo? textfield texfield Jen Swofford [EMAIL PROTECTED] -Original Message- From: eat pasta type fasta [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 03, 2002 3:27 PM To: PHP LIST Subject: [PHP-DB] Strange MySQL Query Problem I already got some replies for this but it wasn't it, here is the problem: I have a simple form which queries the database based on 2 pop-up menu choices and keywords entered by the user, it passes on the variables as follows: pop-up1=choice1, pop-up2=choice2, textfield=user specified data the query is as follows $result = mysql_query(SELECT some_id, some_description, some_feature FROM '$pop-up1' WHERE some_description LIKE '%$texfield%' AND some_feature LIKE '%$pop-up2'); it tells me that column which equals to the $texfield does not exists, meaning that the query seems to be fed wrong? No idea here, $texfield and $pop-up2 are not requests for tables but matches in those tables a bit buffled I am, I've these queries before on larger web servers, this is the first time on my workstation and it does just that, simpler queries work fine... thanks in advance, R ps. the form is guarded against empty entries ps2. RedHat 7.3, Mysql 3.23.51, Apache 1.3+ wik PHP 4.2.1 configured for MySQL -- 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] A challenge
On Wednesday 03 July 2002 13:27, you wrote: ... At least, I found it challenging. Hopefully someone here will find this a lot easier =) I am developing a website wherein customers can log in, enter in the name and type of their business (rather like the yellow pages.) I have a database of all the customers, and each table in the database is another type of business. (For example, in the table 'Gyms' all of the places where you can workout will be listed.) Currently the database has no tables in it. When a new type of business registers, then the table is created. In order to prevent many variations of the same table from being created (I.E. Restaurants, Cafe's, Luncheonettes etc) I have customers choose what type of business they are from a pull down menu. Here is the challenge: I would like my users who come to browse to see a similar pull down menu, but I want this menu only to list those types of businesses that have registered. Essentially I would like the pull down menu customers see to be a dynamic list of names of existing tables, updating for each new table that is created. As for how to do this I'm stuck. It seems that it must be php that modifies an html form. Any suggestions?? Deeply appreciated. Thanks. [EMAIL PROTECTED] -- Jonathan I'm not sure I understand, but you could set it: * A table with customers * A table with business types * A link table with that holds the key to a customer and a business type. A customer can belong to different business type. When a new business is created, you just add an entry to the business type table When a customer assigns himself a business type, you just add a record for this association in the link table. To get the list of business type: select id, name from busitype order by name asc For a search with the $busitypeid variable, you just do select customers.id, customers.name from link left join customers on link.custid=customers.id where link.typeid=$busitypeid I really don't see you would create tables for every business type. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php