Re: [PHP-DB] Join statement and output
Use column-aliasing. To rename a column use the SQL "AS" syntax. Ie. SELECT first_name AS fname .. now "fname" is column name in the result set...Do this for each of your first_name's, obviously using different names and you are set. /cody caughlan Norman Tan wrote: > No actual code, but hopefully, someone can help me through the theory > here. > > I have 2 tables: > > members - first_name, last_name > schedule - member1, member2, date > > The SQL statement is this: > > select s.first_name, t.first_name, f.date from members s, members t, > schedule f where s.first_name=f.member1 and t.first_name=f.member2 > > Now the output would look something like this. > > | first_name | first_name | date | > > Question is, in PHP, how would I distinguish the two first_name > fields? Database is currenly MySQL, but I would like this to be > database independant. > > Thanks for your help. > -- > Norman Tan > North Shore Interactive > http://www.nsmb.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] AUTO_INCREMENT
hi, i have a problem i have a database table created with the statement: CREATE TABLE chatmessages (id tinyint(6) DEFAULT '0' NOT NULL AUTO_INCREMENT, message text, username varchar(100), UNIQUE id (id); I insert records with: INSERT INTO chatmessages (message, username) VALUES ('$message', '$username') this works fine (for a while), i can insert messages and retreive them with php. But after some time i get the error: ERROR 1062: Duplicate entry '127' for key 1 but how can this be because i've set it to AUTO_INCREMENT. can someone help me? thanks in advance Joris Kluivers
[PHP-DB] How can I implement Yahoo-like search?
How can I implement Yahoo-like search? For example: +WinZip +Mac in one of my field in my table 'software' ? TIA, Lisa -- 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 can I implement Yahoo-like search?
Hi You can use the parsing functions of PHP 4.0 to replace the '+' with AND or OR and '-' with NOT and generate a SQL query into your table. Then, use links like >TIA, >Lisa > > >-- >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] > _ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.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] AUTO_INCREMENT
At 12:58 PM 3/4/01 +0100, Joris Kluivers wrote: >hi, > >i have a problem >i have a database table created with the statement: >CREATE TABLE chatmessages (id tinyint(6) DEFAULT '0' NOT NULL AUTO_INCREMENT, message text, username varchar(100), UNIQUE id (id); > >I insert records with: >INSERT INTO chatmessages (message, username) VALUES ('$message', '$username') > >this works fine (for a while), i can insert messages and retreive them with php. >But after some time i get the error: >ERROR 1062: Duplicate entry '127' for key 1 >but how can this be because i've set it to AUTO_INCREMENT. > >can someone help me? >thanks in advance Don't use tinyint. It only allows 128 values (0 to 127). Any values larger than 127 will go in as 127. Try smallint or int.Sounds like phpadmin, it defaults variables as tinyint = "To dwell within Samsara, however, is to be subject to the works of those mighty among dreamers." - Mahasamatman, in Zelazny's "Lord of Light" Andrew Apold -- 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] AUTO_INCREMENT
on 3/4/01 3:58 AM, Joris Kluivers at [EMAIL PROTECTED] wrote: > CREATE TABLE chatmessages (id tinyint(6) DEFAULT '0' NOT NULL > AUTO_INCREMENT, message text, username varchar(100), UNIQUE id (id); > with php. > But after some time i get the error: > ERROR 1062: Duplicate entry '127' for key 1 > but how can this be because i've set it to AUTO_INCREMENT. That's the limit of the TINYINT type. ALTER TABLE and change the type to INT. Paul -- 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: Join statement and output
Norman, The SQL statement is this: select s.first_name AS s_name, t.first_name AS t_name, f.date from members s, members t, schedule f where s.first_name=f.member1 and t.first_name=f.member2 The AS is optional but it works the same as aliasing table names in the FROM clause. $s_name | $t_name | date Dan __ Subject: Join statement and output Date: Sat, 03 Mar 2001 22:43:27 -0800 From: Norman Tan <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] No actual code, but hopefully, someone can help me through the theory here. I have 2 tables: members - first_name, last_name schedule - member1, member2, date The SQL statement is this: select s.first_name, t.first_name, f.date from members s, members t, schedule f where s.first_name=f.member1 and t.first_name=f.member2 Now the output would look something like this. | first_name | first_name | date | Question is, in PHP, how would I distinguish the two first_name fields? Database is currenly MySQL, but I would like this to be database independant. Thanks for your help. -- Norman Tan North Shore Interactive http://www.nsmb.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] Mail Form error
Can someone please tell me why this form doesn't work? I get the following error: Warning: Wrong parameter count for mail() in /home/www/projects/temp/mailform4.php on line 11 The code is as follows: Your information has been submitted.\n"; } else { echo "Use this form to submit your information.\n"; } ?> Please fill in the form and then click submit: Title: Name: Company: City: Country: Email: Contact number: * Thanx Rudi Ahlers -- 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] Mail Form error
Thanx for all the help, it was so quick. I would have helped if I checked the manual first though :) Expecting the world to treat you fairly because you are a good person is a little like expecting the bull not to attack you because you are a vegetarian." Unix specialist & Web Developer Bonzai Web Design http://www.bonzai.org.za - Original Message - From: "Randall Barber" <[EMAIL PROTECTED]> To: "Rudi Ahlers" <[EMAIL PROTECTED]> Sent: Sunday, March 04, 2001 9:14 PM Subject: Re: [PHP-DB] Mail Form error There are only 4 parameters allowed in the mail function, PHP4.0 Manual pg 535. mail($to, $subject, $message, $additional_headers); Thus for your purposes below, > if ($ACTION == "send-mail") { > mail($MYEMAIL,$TITLE,$NAME,$COMPANY,$CITY,$COUNTRY,$EMAIL,$NUM,"From: > $EMAIL"); > echo "Your information has been submitted.\n"; > } else { > echo "Use this form to submit your information.\n"; > } > ?> Try this: $extra_header = "From: $EMAIL"; $subject = "Submitted Form"; $message = "$TITLE\n$NAME\n$COMPANY\n$CITY\n$COUNTRY\n$EMAIL\n$NUM"; mail($MYEMAIL, $subject, $message, $extra_header); Hope that helps RDB - Original Message - From: "Rudi Ahlers" <[EMAIL PROTECTED]> To: "PhP List" <[EMAIL PROTECTED]> Sent: Sunday, March 04, 2001 11:34 AM Subject: [PHP-DB] Mail Form error > Can someone please tell me why this form doesn't work? > I get the following error: > Warning: Wrong parameter count for mail() in > /home/www/projects/temp/mailform4.php on line 11 > > The code is as follows: > > > > > > > $MYEMAIL = "root@localhost"; > > if ($ACTION == "send-mail") { > mail($MYEMAIL,$TITLE,$NAME,$COMPANY,$CITY,$COUNTRY,$EMAIL,$NUM,"From: > $EMAIL"); > echo "Your information has been submitted.\n"; > } else { > echo "Use this form to submit your information.\n"; > } > ?> > > Please fill in the form and then click submit: > > > > > Title: > Name: > Company: > City: > Country: > Email: > Contact number: > > * > > > > > > > Thanx > Rudi Ahlers > > > -- > 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]
SV: [PHP-DB] AUTO_INCREMENT
change CREATE TABLE chatmessages (id tinyint(6) DEFAULT '0' NOT NULL AUTO_INCREMENT, message text, username varchar(100), UNIQUE id (id); to CREATE TABLE chatmessages (id int(11) DEFAULT '0' NOT NULL AUTO_INCREMENT, message text, username varchar(100), UNIQUE id (id); mvh Knut > -Opprinnelig melding- > Fra: Joris Kluivers [mailto:[EMAIL PROTECTED]] > Sendt: 4. mars 2001 12:59 > Til: [EMAIL PROTECTED] > Emne: [PHP-DB] AUTO_INCREMENT > > > hi, > > i have a problem > i have a database table created with the statement: > CREATE TABLE chatmessages (id tinyint(6) DEFAULT '0' NOT NULL > AUTO_INCREMENT, message text, username varchar(100), UNIQUE id (id); > > I insert records with: > INSERT INTO chatmessages (message, username) VALUES > ('$message', '$username') > > this works fine (for a while), i can insert messages and > retreive them with php. > But after some time i get the error: > ERROR 1062: Duplicate entry '127' for key 1 > but how can this be because i've set it to AUTO_INCREMENT. > > can someone help me? > thanks in advance > > Joris Kluivers -- 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] thankx (AUTO_INCREMENT)
thankx for the reply's on my mail Joris Kluivers
[PHP-DB] NEWEST CRAZE
Hey...Janet Here... We Haven't Talked In So Long!! How Have You Been? Thought I would Forward you this email! I usually delete these but I opened this one, like what I saw, and thought you would like to see this. http://www.geocities.com/anewmarket/ IF THE LINK IS NOT HIGHLIGHTED OR YOU CANNOT CLICK ON IT. COPY AND PASTE IT IN YOUR BROWSER. -- 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] Looking for free temp hosting; php w/ oracle support
Hi. This semester I am enrolled in a database management class using Oracle. A couple of the projects we have to do ( coming in a few weeks ) is embedded SQL. I have convinced my instructor to let me use PHP for these projects. The problem is that our school server does not have PHP installed and won't do it just for me. I told the instructor that I could use my work's web server but, as it turns out, our webserver does not have php compiled with Oracle support and they refuse to do it since we don't use oracle in our operations. I then decided to set up PWS on my workstation with php. It took me a while but I finally got php running w/ Oracle connectivity on my own machine. It connects to the school Oracle server but runs the php from my computer. Then another problem came up. We moved our offices and with our new location we no longer have our own IP addresses. We are all behind a firewall and I can't run PWS. So now I am on the web asking for help. If anyone out there has a server running on the web with PHP installed and compiled with the OCI8 library, I would greatly appreciate it if you would allocate me a small amount of webspace for me to complete this class. I wouldn't take up much harddrive space at all, and it would only be for a couple months. The only processing power and bandwidth it would use would be when I tell my instructor the project is ready to grade and he connects and looks at it. I already have my tnsnames.ora file configured to connect to my school's oracle server. Drop me an email if you would be willing to help. Thanks. Doug Schasteen [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: [PHP] Problem getting PostgreSQL to compile
Yes, I've checked phpinfo() and not it is not compiled in. That is the problem. I have recompiled PHP with pgsql support and there is some problem. I'm not sure why it isn't compiling it in. I've tried everything I knowthe installation goes fine...no error messages, everything seems ok. Any ideas? >From: The Hermit Hacker <[EMAIL PROTECTED]> >To: K Old <[EMAIL PROTECTED]> >CC: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> >Subject: Re: [PHP] Problem getting PostgreSQL to compile >Date: Fri, 2 Mar 2001 22:30:11 -0400 (AST) > > >have you checked phpinfo() to make sure that pgsql support is actually >compiled in? if so, any errors on connection, or just silently fails? > >On Fri, 2 Mar 2001, K Old wrote: > > > Hello, > > > > I'm running RH 7 and Apache. I have the latest version of PostgreSQL >and it > > is installed and running correctly. I have installed PHP with the > > --with-pgsql and it seems to install everything needed, but when I try >to > > use pg_connect() it fails to connect. Any ideas what I can do? > > > > Thanks, > > Kevin > > [EMAIL PROTECTED] > > _ > > Get your FREE download of MSN Explorer at http://explorer.msn.com > > > > > > -- > > PHP General 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] > > > > > >Marc G. Fournier ICQ#7615664 IRC Nick: >Scrappy >Systems Administrator @ hub.org >primary: [EMAIL PROTECTED] secondary: >scrappy@{freebsd|postgresql}.org > > >-- >PHP General 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] > _ Get your FREE download of MSN Explorer at http://explorer.msn.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] MySQL - Problem with multiple INSERTs?
Howdy, I'm getting weird problems trying to INSERT to two different tables, in consecutive mysql_queries. Before, I had 3 queries going, and only 2 would work at any time. It seemed like it was 'rotating' the bad query - first the 1st query would fail (the other two were fine), then I'd empty all my tables and refresh, and this time the 2nd query was the problem, and if I did it again the 3rd was. All queries worked fine in phpMyAdmin, both individually and when executed en masse. I've boiled it down to just two queries that don't work. I've included everything below (including table schemata), to enable reproduction. It seems like a bug to me - the question is, is the bug in PHP, MySQL, or my brain? This is driving me CRAZY - Chris mysql_connect("localhost", "myusername", "mypassword"); mysql_db_query("DocCountry", "INSERT INTO projects (idCreator, name, comment) VALUES (1, 'sysmsg9.txt', 'Some file')"); mysql_db_query("DocCountry", "INSERT INTO files (idProject, name, comment) VALUES (1, 'sysmsg9.txt', 'Some file')"); CREATE TABLE projects ( id int(11) NOT NULL auto_increment, timestamp timestamp(14), idCreator int(11) DEFAULT '0' NOT NULL, name varchar(80) NOT NULL, comment text NOT NULL, authLevel varchar(32) NOT NULL, PRIMARY KEY (id) ); CREATE TABLE files ( id tinyint(4) NOT NULL auto_increment, idProject tinyint(4) DEFAULT '0' NOT NULL, name tinyint(4) DEFAULT '0' NOT NULL, comment text NOT NULL, PRIMARY KEY (id) ); (P.S. I've tried things like using SET syntax, using mysql_query instead of mysql_db_query, etc. Nothing helps.)