Re: [PHP-DB] Inserting date into a table
Pambos Nicolaou wrote: I have created the table below: CREATE TABLE questions (ID INT NOT NULL AUTO_INCREMENT,name VARCHAR(30),day TIMESTAMP, question TEXT, email VARCHAR(30),answer TEXT, PRIMARY KEY(ID)); I want to insert into the TIMESTAMP field the date automatically. How can I do it using the insert command INSERT INTO $table VALUES('','$name','TIMESTAMP','$question','$email','NULL'); Two ways: 1: INSERT INTO $table (name, question, email) VALUES ('$name','$question','$email') This way, the ID and TIMESTAMP columns will be populated automatically. The ID column will get the next available number and the day column will be assigned the current date/time. Note how you can leave out the answer column, too, since you weren't assigning a value to it, anyhow. It will be given the default value of the column, which in this case is NULL. 2: INSERT INTO $table (name, day, question, email) VALUES ('$name',NULL,'$question','$email') Setting the TIMESTAMP column to NULL will cause it to be set to the current date/time. This works for the first TIMESTAMP column in a table (since you only have one, it doesn't matter). I recommend method 1. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] db query problem
I'm using MS SQL Server 2000 and I have a table called tasks with the following schema: id= int identity 1 1 not null standardId= varchar(15) not null userId= varchar(15) not null status= varchar(15) not null beginDt= datetime endDate=datetime active=char(1) // flag 1=display 0=do not display I need to return records based on userId and standardId. Assume I have the following five records: userId: jimmy standardId: EC.01.10 userId: jimmy standardId: RI.03.20 userId: karen standardId: PC.02.40 userId: sally standardId: EC.01.10 userId: ted standardId: RI.03.20 userId: joe standardId: EC.01.10 These are the results I need to return: All of jimmy's records: where userId='jimmy' I also need to return all records that match all of jimmy's standardId(s), in other words, I need to return in all other records where standardId='EC.01.10 or standardId='RI.03.20 (without duplicating jimmy's results). Which in this scenario would be userId sally, joe, ted I also need to group the records by standardId. Can this be done in a subquery or is two queries required? Having worked mostly with MySQL I dont' have a lot of experience with subqueries. Any suggestions on the best way to approach this probelm? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] db query problem
Hi! Try this: select t1.id, t1.standartId, t2.id from tasks as t1 left join tasks as t2 using(standartId) where t1.id='jimmy' Saturday, April 24, 2004, 5:12:56 PM, Jimmy wrote: JB I'm using MS SQL Server 2000 and I have a table called tasks with the JB following schema: JB id= int identity 1 1 not null JB standardId= varchar(15) not null JB userId= varchar(15) not null JB status= varchar(15) not null JB beginDt= datetime JB endDate=datetime JB active=char(1) // flag 1=display 0=do not display JB I need to return records based on userId and standardId. Assume I have the JB following JB five records: JB userId: jimmy standardId: EC.01.10 JB userId: jimmy standardId: RI.03.20 JB userId: karen standardId: PC.02.40 JB userId: sally standardId: EC.01.10 JB userId: ted standardId: RI.03.20 JB userId: joe standardId: EC.01.10 JB These are the results I need to return: JB All of jimmy's records: where userId='jimmy' JB I also need to return all records that match all of jimmy's standardId(s), JB in other words, I need to return in all other records where JB standardId='EC.01.10 or JB standardId='RI.03.20 (without duplicating jimmy's results). Which in this JB scenario would be userId sally, joe, ted JB I also need to group the records by standardId. JB Can this be done in a subquery or is two queries required? JB Having worked mostly with MySQL I dont' have a lot of experience with JB subqueries. JB Any suggestions on the best way to approach this probelm? -- Best regards, Mikhail U. Petrov mailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] db query problem
Hi! Sorry for my missing.. select t1.userId, t1.standartId, t2.userId from tasks as t1 left join tasks as t2 using(standartId) where t1.userId='jimmy' I think it should work. Saturday, April 24, 2004, 5:12:56 PM, Jimmy wrote: JB I'm using MS SQL Server 2000 and I have a table called tasks with the JB following schema: JB id= int identity 1 1 not null JB standardId= varchar(15) not null JB userId= varchar(15) not null JB status= varchar(15) not null JB beginDt= datetime JB endDate=datetime JB active=char(1) // flag 1=display 0=do not display JB I need to return records based on userId and standardId. Assume I have the JB following JB five records: JB userId: jimmy standardId: EC.01.10 JB userId: jimmy standardId: RI.03.20 JB userId: karen standardId: PC.02.40 JB userId: sally standardId: EC.01.10 JB userId: ted standardId: RI.03.20 JB userId: joe standardId: EC.01.10 JB These are the results I need to return: JB All of jimmy's records: where userId='jimmy' JB I also need to return all records that match all of jimmy's standardId(s), JB in other words, I need to return in all other records where JB standardId='EC.01.10 or JB standardId='RI.03.20 (without duplicating jimmy's results). Which in this JB scenario would be userId sally, joe, ted JB I also need to group the records by standardId. JB Can this be done in a subquery or is two queries required? JB Having worked mostly with MySQL I dont' have a lot of experience with JB subqueries. JB Any suggestions on the best way to approach this probelm? -- Best regards, Mikhail U. Petrov mailto:[EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Hi I am new
Since you didn't mention what database you are using I'm assuming MySQL. Here's a good place to start: http://dev.mysql.com/tech-resources/articles/ddws/ Water_foul [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I am new to databases and php and I was wondering if any one would point me to a good guide anything would help :) thanks in advance, water_foul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Anyone Subscibed to PHP-GTK-General?
In looking at the lists available on news.php.net it seems the links to the rss and rdf are missing for php-gtk So it may not be available. [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Warning: This is OT. Just wondering if anyone receives emails from [EMAIL PROTECTED] I've subscribed and received a confirmation response, but my emails to that list get returned, and I receive no posts from anyone else. Does anyone know if [EMAIL PROTECTED] is active? dave -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Anyone Subscibed to PHP-GTK-General?
Also, the last post was on 27 August 2003...so this group is probally not active. You might want to contact someone at gtk.php.net to see what going on with this newsgroup. The last I heard they were planning on a new release for gtk for php 5. [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Warning: This is OT. Just wondering if anyone receives emails from [EMAIL PROTECTED] I've subscribed and received a confirmation response, but my emails to that list get returned, and I receive no posts from anyone else. Does anyone know if [EMAIL PROTECTED] is active? dave -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] move_uploaded_file
I have a file uploading function that works well on my local server. It finds a picture and uploads it into a defined directory. Unfortunately this function does not work when I try to upload to my web host. It says I do not have the proper permissions. I believe this has to do with the fact that my web host requires a user name and password for all file transfers for security reasons. I still want my users to be able to upload files or pictures to my web host (if I have granted them proper access through my log in). How do I indicate the correct login sequence for my web host with a function like move_uploaded_file? - Matt -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] move_uploaded_file
--- matthew perry [EMAIL PROTECTED] wrote: I have a file uploading function that works well on my local server. It finds a picture and uploads it into a defined directory. Matthew, if you are the confident that your function works correctly, your next check should be on what permissions you have to the defined directory on your web host's server. If you are on a UNIX/Linux based box, you probably only have write permissions to your /home/logon_name directory. So if you are trying to write to some directory outside of that, you are probably restricted, which explains the error message from you web server. I'm not familiar enough with directory structures on Windows-based web servers, but I imagine it is similar to UNIX/Linux in restricting you to your user path. ~Rachel __ Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25ยข http://photos.yahoo.com/ph/print_splash -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] move_uploaded_file
Windows works a bit different. You have to define which folders and files get access to the internet. After that you can specify the web permissions using the iis snap in. This is of course if you're using iis. I'm not sure for apache or other servers handle it. -- Marcjon -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php