Re: [PHP-DB] MySQL DB CleanUp Help!
- Original Message - From: Arcadius A. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 23, 2001 9:28 PM Subject: [PHP-DB] MySQL DB CleanUp Help! Hello ! I'd like to automatically delete old entries from my MySQL Is there any special funcion in PHP or MySQl for doing that ? For that purpose, I've created a PHP script (form) that delete old entries when I submit a form ... but I'd like the scrip to do the job periodically(for instance once in two days or in a week) without my intervention... Is this possible ? ( I'ts on a UNIX server) Thanks.. Arcad. Here's one way to do it: Create a php page which when accessed will do deletions you require. Create a cron job which uses wget to access that page. regards -- Jason Wong Gremlins Associates www.gremlins.com.hk -- 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 a logo..
Do you know What's a logo worth: PRICELESS. Do you have a logo ? Do you have what it takes to design one ? To do it in Flash ? Do you heve what it takes to put it on your website ? on your stationery Business card ? On literally hundreds of products ? Do you have what it takes to make it 3D, ANIMATED doesn't take AGES to download ? Do you want me to take care of that for you ? For examples, and pricing, Contact [EMAIL PROTECTED] Serving Individuals, Family crests, Small Businesses, Communities, Townships and Corporate America. Don't get left behind. Get graphical. 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] Query construction (again)
(Apologies for cross-postings here but I lost a php-db list members personal email address..) I need a query that in English would read something like: Select all records from table: 'items' where each record is displayed for 7days after it's submission. It was suggested I may have to modify the output of now() to match my MySQL DB 'submitDate' field as in the query below: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY) = now(); So I tried the following: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY) = DATE_FORMAT(NOW(),'Y-M-D'); MySQL didn't complain but nor did it print out all postings submitted in the last seven days which is what it is suppposed to be doing! The 'submitDate' field is a MySQL DATE field and I'm using MySQL-3.22.32 if that's any use. Why is the query not doing what it's told!!? Cheers for your help thus far! Russ Depending on how the date is stored (date + time, or just date) On Wed, 22 Aug 2001 21:39:19 +0800 Gremlins Mailing List [EMAIL PROTECTED] wrote: - Original Message - From: Russ Michell [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 22, 2001 10:16 PM Subject: [PHP-DB] Query construction (again) Hey there folks - similar problem - different project! I want to select some records for a period of 7days after their insert [dateFrom] date. Last time I asked you guys for help I was helped toward the following solution: $sql = SELECT * FROM $Tpostings WHERE now()=dateFrom AND now()dateTo; The problem in this new project is that the 'dateTo' field is not included in the DB. It is 7-days after 'dateFrom'. So why does the following query not work: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY); No error is received though... There is no comparison in your WHERE clause. Try something like: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY) = now(); Depending on how the date is stored (date + time, or just date) you may have to modify the output of now() to match. hth -- Jason Wong Gremlins Associates www.gremlins.com.hk -- 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 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]
SV: [PHP-DB] Query construction (again)
This should work: SELECT * FROM items WHERE TO_DAYS(NOW()) - TO_DAYS(submitDate) = 7; -Ursprungligt meddelande- Fran: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]For Russ Michell Skickat: den 23 augusti 2001 11:46 Till: Gremlins Mailing List Kopia: [EMAIL PROTECTED] Amne: Re: [PHP-DB] Query construction (again) (Apologies for cross-postings here but I lost a php-db list members personal email address..) I need a query that in English would read something like: Select all records from table: 'items' where each record is displayed for 7days after it's submission. It was suggested I may have to modify the output of now() to match my MySQL DB 'submitDate' field as in the query below: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY) = now(); So I tried the following: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY) = DATE_FORMAT(NOW(),'Y-M-D'); MySQL didn't complain but nor did it print out all postings submitted in the last seven days which is what it is suppposed to be doing! The 'submitDate' field is a MySQL DATE field and I'm using MySQL-3.22.32 if that's any use. Why is the query not doing what it's told!!? Cheers for your help thus far! Russ Depending on how the date is stored (date + time, or just date) On Wed, 22 Aug 2001 21:39:19 +0800 Gremlins Mailing List [EMAIL PROTECTED] wrote: - Original Message - From: Russ Michell [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 22, 2001 10:16 PM Subject: [PHP-DB] Query construction (again) Hey there folks - similar problem - different project! I want to select some records for a period of 7days after their insert [dateFrom] date. Last time I asked you guys for help I was helped toward the following solution: $sql = SELECT * FROM $Tpostings WHERE now()=dateFrom AND now()dateTo; The problem in this new project is that the 'dateTo' field is not included in the DB. It is 7-days after 'dateFrom'. So why does the following query not work: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY); No error is received though... There is no comparison in your WHERE clause. Try something like: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY) = now(); Depending on how the date is stored (date + time, or just date) you may have to modify the output of now() to match. hth -- Jason Wong Gremlins Associates www.gremlins.com.hk -- 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 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: SV: [PHP-DB] Query construction (again)
Thanks for that - but I just sorted it literally 10 seconds ago! I used: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 8 DAY) CURDATE(); Something happens with using INTERVAL 7 DAY though, in that only 6 days worth of posts are displayed, so 8 will have to suffice! Thanks very much! Russ On Thu, 23 Aug 2001 11:09:32 +0200 Torgil Zechel [EMAIL PROTECTED] wrote: This should work: SELECT * FROM items WHERE TO_DAYS(NOW()) - TO_DAYS(submitDate) = 7; -Ursprungligt meddelande- Fran: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]For Russ Michell Skickat: den 23 augusti 2001 11:46 Till: Gremlins Mailing List Kopia: [EMAIL PROTECTED] Amne: Re: [PHP-DB] Query construction (again) (Apologies for cross-postings here but I lost a php-db list members personal email address..) I need a query that in English would read something like: Select all records from table: 'items' where each record is displayed for 7days after it's submission. It was suggested I may have to modify the output of now() to match my MySQL DB 'submitDate' field as in the query below: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY) = now(); So I tried the following: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY) = DATE_FORMAT(NOW(),'Y-M-D'); MySQL didn't complain but nor did it print out all postings submitted in the last seven days which is what it is suppposed to be doing! The 'submitDate' field is a MySQL DATE field and I'm using MySQL-3.22.32 if that's any use. Why is the query not doing what it's told!!? Cheers for your help thus far! Russ Depending on how the date is stored (date + time, or just date) On Wed, 22 Aug 2001 21:39:19 +0800 Gremlins Mailing List [EMAIL PROTECTED] wrote: - Original Message - From: Russ Michell [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 22, 2001 10:16 PM Subject: [PHP-DB] Query construction (again) Hey there folks - similar problem - different project! I want to select some records for a period of 7days after their insert [dateFrom] date. Last time I asked you guys for help I was helped toward the following solution: $sql = SELECT * FROM $Tpostings WHERE now()=dateFrom AND now()dateTo; The problem in this new project is that the 'dateTo' field is not included in the DB. It is 7-days after 'dateFrom'. So why does the following query not work: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY); No error is received though... There is no comparison in your WHERE clause. Try something like: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY) = now(); Depending on how the date is stored (date + time, or just date) you may have to modify the output of now() to match. hth -- Jason Wong Gremlins Associates www.gremlins.com.hk -- 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 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] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam 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: It's just a logo..
Wisam [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Do you know What's a logo worth: PRICELESS. Do you have a logo ? Do you have what it takes to design one ? To do it in Flash ? Do you heve what it takes to put it on your website ? on your stationery Business card ? On literally hundreds of products ? Do you know What's a literate ad worth: PRICELESS. Do you have what it takes to design one? Obviously not. -- 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] help please... session - database
hello, i have hit a major stumbling block and am now getting really frustrated.. if someone could point me in the right direction i would really appreciate it.. - i have a set of forms across a number of pages - the user enters data into each of the forms and these are placed in a session variable - at the completion of form entry the session variables are supposed to be passed to a mysql database - one of the variables is a URL for some reason the form entry the data is encoded so that a full stop '.' is changed into an AT '@' - I have tried urlencoding and decoding the session, using str_replace for the @ .. adding slashes - for some reason this just wont work .. ... help? ... i.e Adds form post to session if (is_array($HTTP_POST_VARS)) { while (list($var, $value) = each($HTTP_POST_VARS)) { session_register($var); $HTTP_SESSION_VARS[$var]=$value; } } i.e adds session to database (simplified so as to find problem) $title =stripslashes($HTTP_SESSION_VARS[title]); $href= $HTTP_SESSION_VARS[HREF]; $fee =stripslashes($HTTP_SESSION_VARS[fee]); $result= mysql_query(INSERT INTO links (Title, Hyperlink,fee) VALUES ('$title','$href','$fee')) or die(mysql_error()); print $result; -- 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] establish mysql server....install
Check the socket specified in the configuration file, and make sure it exists, I forget the details exactly, but I had the same problem, and the directory which it tried to create the socket wasn't in the directory it was looking for it. I just created a symbolic link to it, and it works. Ryan -Original Message- From: haikal [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 23, 2001 12:56 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] establish mysql serverinstall Hello... I just installing RedHat linux 7.1, i have problem in starting mysql server the Mysql hadbeen installed throgh RedHatPackageManager...but when i start it and error message can't connect throgh port server. issued . when i use command safe_mysqld , it runs just a second before stops automatically. Any body know how to solve my problem? i'm still newbie here help thankyou -- 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] help please... session - database
Try $link = addslashed($HTTP_SESSION_VARS[HREF]) and then use $link in the sql insert and.. stripslashes(query result) when you retrieve the value and need to display it on the page. hth andre brendan wrote: hello, i have hit a major stumbling block and am now getting really frustrated.. if someone could point me in the right direction i would really appreciate it.. - i have a set of forms across a number of pages - the user enters data into each of the forms and these are placed in a session variable - at the completion of form entry the session variables are supposed to be passed to a mysql database - one of the variables is a URL for some reason the form entry the data is encoded so that a full stop '.' is changed into an AT '@' - I have tried urlencoding and decoding the session, using str_replace for the @ .. adding slashes - for some reason this just wont work .. ... help? ... i.e Adds form post to session if (is_array($HTTP_POST_VARS)) { while (list($var, $value) = each($HTTP_POST_VARS)) { session_register($var); $HTTP_SESSION_VARS[$var]=$value; } } i.e adds session to database (simplified so as to find problem) $title =stripslashes($HTTP_SESSION_VARS[title]); $href= $HTTP_SESSION_VARS[HREF]; $fee =stripslashes($HTTP_SESSION_VARS[fee]); $result= mysql_query(INSERT INTO links (Title, Hyperlink,fee) VALUES ('$title','$href','$fee')) or die(mysql_error()); print $result; -- 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 DB CleanUp Help!
Or of course one could compile PHP as a standalone and simply cron the script itself. No matter how PHP is invoked, though, IMHO scripts like this that require no human interaction should be a bit more robust than interactive systems. For example, one would probably want to code it to make sure the two instances of the same script cannot run simultaneously (and if an instance tries to run simultaneously, it should send an email to the admin and quit instead of performing its duties). Also error checking should email problems to the admin. As an alternative to emailing the admin, you could log status messages and errors to syslog or a file or a db table. Good luck! Doug At 03:30 PM 8/23/01 +0800, Jason Wong wrote: - Original Message - From: Arcadius A. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 23, 2001 9:28 PM Subject: [PHP-DB] MySQL DB CleanUp Help! Hello ! I'd like to automatically delete old entries from my MySQL ...[snip]... Arcad. Here's one way to do it: Create a php page which when accessed will do deletions you require. Create a cron job which uses wget to access that page. regards -- Jason Wong Gremlins Associates www.gremlins.com.hk --Doug's Signature File ~ ~ ~ I'm proud to work for GLISnet, Michigan's best ISP ~ ~ ~ --1.888.445.4763---8am to 8pm every day---http://www.glis.net-- The views and opinions expressed in this email are my own and may not be those of my employer. -- 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] It's just a logo..
What's a spammer worth? Nothing. -Original Message- From: Wisam [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 22, 2001 7:46 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] It's just a logo.. Do you know What's a logo worth: PRICELESS. Do you have a logo ? Do you have what it takes to design one ? To do it in Flash ? Do you heve what it takes to put it on your website ? on your stationery Business card ? On literally hundreds of products ? Do you have what it takes to make it 3D, ANIMATED doesn't take AGES to download ? Do you want me to take care of that for you ? For examples, and pricing, Contact [EMAIL PROTECTED] Serving Individuals, Family crests, Small Businesses, Communities, Townships and Corporate America. Don't get left behind. Get graphical. 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] -- 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] Re: Photo Album Schema
just using id.gif immediately becomes problematic as each user is, by design, going to have multiple images. I know you could add a count to id, or mangle it, or any number of other things. But that takes us back into unnecessary complexity. Sheridan Saint-Michel Website Administrator FoxJet, an ITW Company www.foxjet.com - Original Message - From: Bill Zeller [EMAIL PROTECTED] To: Steve Brett [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, August 23, 2001 10:28 AM Subject: Re: [PHP-DB] Re: Photo Album Schema Hi, I can see absolutely no reason to store the name of the image with the picture? Why not, whether using one directory or one for each user, just do id.gif? Best Regards, Bill Zeller --- Steve Brett [EMAIL PROTECTED] wrote: that would generally work on the assumption that many photos can belong to many albums. possibly a bad thing. table 1 -userid (primary key) -username -password -album_title -creation_date table 2 -photoid (primary key) -photo (jpg or gif) -date -photo_title -description (limited length) -userid (foreign key) would give you 1 album contains many photos, each photo relating to one album only. Steve Tatare [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'd rather do it like this (but I'm not sure it's ok...) table 1 -userid (primary key) -username -password -album_title -creation_date table 2 -photoid (primary key) -photo (jpg or gif) -date -photo_title -description (limited length) table 3 -userid (primary key) -photoid (primary key) reguards. tatare, http://www.memoroo.fr.st (not already available in english - could anyone help me to translate it ?) Jeff Oien [EMAIL PROTECTED] a écrit dans le message : [EMAIL PROTECTED] I want to make a photo album that will have users who sign up to create an album and then have the albums open to the public. I was thinking of doing it like this but I've never done a relational database before so if anyone thinks of anything I should change please let me know. Thanks. Jeff Oien Table1: -username -password -album_title -creation_date -id Table2: -id (from Table1) -photo (jpg or gif) -date -photo_title -description (limited length) -- 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] __ 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 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] can you help to beginner?
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]
RE: [PHP-DB] can you help to beginner?
? Mysql_connect($server,$user,$pass); Mysql_select_db($database); $sql = SELECT companyid,companyname FROM companies ORDER BY companyname ASC; $result = mysql_query($sql); $num = mysql_num_rows($result); if ($num) { while($row = mysql_fetch_array($result)) { print $row[companyname]br; print getServices($row[companyid]) . br; print hr; } } else { print No Companies; } Function getServices ($id) { $sql = SELECT services FROM services WHERE companyid = $id; $result = mysql_query($sql); $num = mysql_num_rows($result); if ($num) { while ($row = mysql_fetch_array($result)) { $html.= $row[services]br; } } else { $html = No Services; } return $html; } ? that should do it I think.. :) /BoNzO http://bonzo.sineleven.nu -Original Message- From: Andrius Jakutis [mailto:[EMAIL PROTECTED]] Sent: den 24 augusti 2001 04:05 To: [EMAIL PROTECTED] Subject: [PHP-DB] can you help to beginner? 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 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] variable if statement
i want to do something like this: $string=($a==1) OR ($b==2); if ($string) { do something ; } any ideas? i tried using if (eval($string)) but that just gave me errors. 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]
Re: [PHP-DB] variable if statement
- Original Message - From: Brian Weisenthal [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, August 24, 2001 1:14 AM Subject: [PHP-DB] variable if statement i want to do something like this: $string=($a==1) OR ($b==2); if ($string) { do something ; } any ideas? i tried using if (eval($string)) but that just gave me errors. $string = (($a == 1) OR ($b == 2)); regards -- Jason Wong Gremlins Associates www.gremlins.com.hk -- 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] variable if statement
$func_body = return ($a==1 or $b==2); $newfunc = create_function('$a,$b',$func_body); if ($newfunc($first_par,$second_par)){ } or if ($newfunc($a,$b,return (\$a==1 or \$b==2);)){ } or if ($newfunc($a,$b,'return (\$a==1 or \$b==2);')){ } Hope this will help. Andrey Hristov IcyGEN Corporation http://www.icygen.com 99% - Original Message - From: Brian Weisenthal [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 23, 2001 8:14 PM Subject: [PHP-DB] variable if statement i want to do something like this: $string=($a==1) OR ($b==2); if ($string) { do something ; } any ideas? i tried using if (eval($string)) but that just gave me errors. 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] can you help to beginner?
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]
Re: [PHP-DB] variable if statement
? $a=1; $flag = 0; $test = (a==1) OR (b==1); $string = if($test){ $flag =1;}; var_dump($string); eval($string); if( $flag ==1 ) {var_dump($a);} ? Produces: string(28) if((a==1) OR (b==1)){ 0 =1;} Parse error: parse error in c:/apache/htdocs/test2.php(7) : eval()'d code on line 1 Why? Because of using instead of '', or if use the escape the $ Also there is another problem: $test = (a==1) OR (b==1); must be $test = (\$a==1) OR (\$b==1); if it was $test = ($a==1) OR ($b==1); then there will be a substitution. As a side effect this will work because if $a=1 then $test=(1==1) or (what_is_b==1) which given to eval() will work. Andrey Hristov IcyGEN Corporation http://www.icygen.com 99% - Original Message - From: Rick Emery [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 23, 2001 8:27 PM Subject: RE: [PHP-DB] variable if statement eval will work, but the entire thing must be in the eval(). It would look like: $flag = 0; $test = (a==1) OR (b==1); $string = if($test){ $flag =1;}; eval($string); if( $flag ==1 ) {do_something;} I had to resort to this in a similar situation. I read the condition and result action in a MySQL database. 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: Brian Weisenthal [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 23, 2001 12:15 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] variable if statement i want to do something like this: $string=($a==1) OR ($b==2); if ($string) { do something ; } any ideas? i tried using if (eval($string)) but that just gave me errors. 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] Re: Photo Album Schema
The most useful schema would be to have the name of the document be system generated, like i123456789.img and make the database as follows: Image Image_Name varchar(50) primary key Original_Name varchar(50) Description text User User_ID int8 primary key Login char(8) uniques index password varchar(50) encrypted relation User_ID Image_Name Now you have duplicate anems OK, multiple users associated with any picture. You just rename the file as it comes and goes. __ Your mouse has moved. You must restart Windows for your changes to take effect. #!/usr/bin/perl print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10); -- 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: $CompanyBR\n; foreach($ArrayofServices as $Service) { print $ServiceBR\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]
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]
Re: [PHP-DB] can you help to beginner?
I realized that as soon as I hit Send - doh! :) Jonathan Hilgeman wrote: 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] -- 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]
Re: [PHP-DB] Re: Photo Album Schema
I don't know if having multiple users associated with a single image is at all beneficial, and I can see where it might cause all sorts of problems. For example, you and I both have the same image in our album (we are both assciated with it in the DB). What happens when I change the description? Do you change the description field, thus changing the description on both our pages? Do you now have to create another entry in your Image table? In effect anytime I change the description either both of us have to live with my new description or you have to do a lot of work around code (checking to see if more than one person is associated with the image, Adding a new entry into image, changing all my info to reflect the new Image_Name) to avoid this. Therefore, I think for this project, the original DB structure works much better. Sheridan Saint-Michel Website Administrator FoxJet, an ITW Company www.foxjet.com - Original Message - From: grant [EMAIL PROTECTED] To: Sheridan Saint-Michel [EMAIL PROTECTED] Cc: Bill Zeller [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, August 23, 2001 1:48 PM Subject: Re: [PHP-DB] Re: Photo Album Schema The most useful schema would be to have the name of the document be system generated, like i123456789.img and make the database as follows: Image Image_Name varchar(50) primary key Original_Name varchar(50) Description text User User_ID int8 primary key Login char(8) uniques index password varchar(50) encrypted relation User_ID Image_Name Now you have duplicate anems OK, multiple users associated with any picture. You just rename the file as it comes and goes. -- 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] listing
Hello again, Is there oportunity to write this: some php command to loop entries, the way is written bellow HTML php coding.+ MYSQL - 1 entries information end of loop Something like that: here loop begins table tr td first entry information from table companies (name, telephone...) /td /tr /table loop ends THanks. -- Su pagarba, Andrius Jakutis InternetMedia http://www.internetmedia.lt GSM: 370 82 31332 -- 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] listing
Something like: ? for($i=1; $i25; $i++) { ? table tr td ? // php code to output your entry information ? /td /tr /table ? } ? Andrius Jakutis wrote: Hello again, Is there oportunity to write this: some php command to loop entries, the way is written bellow HTML php coding.+ MYSQL - 1 entries information end of loop Something like that: here loop begins table tr td first entry information from table companies (name, telephone...) /td /tr /table loop ends THanks. -- Su pagarba, Andrius Jakutis InternetMedia http://www.internetmedia.lt GSM: 370 82 31332 -- 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]
Re: [PHP-DB] It's just spam...
Gee thanks. I'll get back to you in about 40 years when this will be useful. Thanks! David Balatero - Original Message - From: Jonathan Hilgeman [EMAIL PROTECTED] To: PHP-DB (E-mail) [EMAIL PROTECTED] Sent: Thursday, August 23, 2001 8:36 AM Subject: [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 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] listing
This gives 25 the same entries. I need to list all entries from the table, but with loop. More solutions? Chris Hobbs [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Something like: ? for($i=1; $i25; $i++) { ? table tr td ? // php code to output your entry information ? /td /tr /table ? } ? Andrius Jakutis wrote: Hello again, Is there oportunity to write this: some php command to loop entries, the way is written bellow HTML php coding.+ MYSQL - 1 entries information end of loop Something like that: here loop begins table tr td first entry information from table companies (name, telephone...) /td /tr /table loop ends THanks. -- Su pagarba, Andrius Jakutis InternetMedia http://www.internetmedia.lt GSM: 370 82 31332 -- 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]
Re: [PHP-DB] listing
I think what you want is ?php $query = Select * from companies; if( !($dbq = mysql_query($query,$dblink))) { echo Error querying database.; exit; } while( $row = mysql_fetch_array ($dbq) ) { ? table tr td ?php // php code to output your entry information ? /td /tr /table ? } ? Sheridan Saint-Michel Website Administrator FoxJet, an ITW Company www.foxjet.com - Original Message - From: Andrius Jakutis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 23, 2001 11:22 PM Subject: Re: [PHP-DB] listing This gives 25 the same entries. I need to list all entries from the table, but with loop. More solutions? Chris Hobbs [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Something like: ? for($i=1; $i25; $i++) { ? table tr td ? // php code to output your entry information ? /td /tr /table ? } ? Andrius Jakutis wrote: Hello again, Is there oportunity to write this: some php command to loop entries, the way is written bellow HTML php coding.+ MYSQL - 1 entries information end of loop Something like that: here loop begins table tr td first entry information from table companies (name, telephone...) /td /tr /table loop ends THanks. -- Su pagarba, Andrius Jakutis InternetMedia http://www.internetmedia.lt GSM: 370 82 31332 -- 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 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] listing
Assuming you've opened a MySQL connection and stored connection in $connect: $query=SELECT * FROM mytable; $result = mysql_query($query,$connect) or die(ERROR); print TABLE; while( $row = mysql_fetch($result) { print TRTD.$row['field1'].TD.$row['field2'].TD.$row['field3']./TR ; } print /TABLE; mysql_free_result($result); The above will create a table and output one table row per row in database. Change field1, fiedl2, field3 to the names of fields in the database. 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: Andrius Jakutis [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 23, 2001 11:22 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] listing This gives 25 the same entries. I need to list all entries from the table, but with loop. More solutions? Chris Hobbs [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Something like: ? for($i=1; $i25; $i++) { ? table tr td ? // php code to output your entry information ? /td /tr /table ? } ? Andrius Jakutis wrote: Hello again, Is there oportunity to write this: some php command to loop entries, the way is written bellow HTML php coding.+ MYSQL - 1 entries information end of loop Something like that: here loop begins table tr td first entry information from table companies (name, telephone...) /td /tr /table loop ends THanks. -- Su pagarba, Andrius Jakutis InternetMedia http://www.internetmedia.lt GSM: 370 82 31332 -- 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 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] listing
Okay, but what if I want to use data from two tables not only from companies ? Assuming you've opened a MySQL connection and stored connection in $connect: $query=SELECT * FROM mytable; $result = mysql_query($query,$connect) or die(ERROR); print TABLE; while( $row = mysql_fetch($result) { print TRTD.$row['field1'].TD.$row['field2'].TD.$row['field3']./TR ; } print /TABLE; mysql_free_result($result); The above will create a table and output one table row per row in database. Change field1, fiedl2, field3 to the names of fields in the database. 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: Andrius Jakutis [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 23, 2001 11:22 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] listing This gives 25 the same entries. I need to list all entries from the table, but with loop. More solutions? Chris Hobbs [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Something like: ? for($i=1; $i25; $i++) { ? table tr td ? // php code to output your entry information ? /td /tr /table ? } ? Andrius Jakutis wrote: Hello again, Is there oportunity to write this: some php command to loop entries, the way is written bellow HTML php coding.+ MYSQL - 1 entries information end of loop Something like that: here loop begins table tr td first entry information from table companies (name, telephone...) /td /tr /table loop ends THanks. -- Su pagarba, Andrius Jakutis InternetMedia http://www.internetmedia.lt GSM: 370 82 31332 -- 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 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] listing
Then your select might look like: SELECT * FROM tableA, tableB or SELECT * FROM tableA LEFT JOIN tableB USING(field1) Depends upon what you're trying to do. So far, your requirements have been rather vague. -Original Message- From: Andrius Jakutis [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 23, 2001 11:51 PM To: Rick Emery; [EMAIL PROTECTED] Subject: Re: [PHP-DB] listing Okay, but what if I want to use data from two tables not only from companies ? Assuming you've opened a MySQL connection and stored connection in $connect: $query=SELECT * FROM mytable; $result = mysql_query($query,$connect) or die(ERROR); print TABLE; while( $row = mysql_fetch($result) { print TRTD.$row['field1'].TD.$row['field2'].TD.$row['field3']./TR ; } print /TABLE; mysql_free_result($result); The above will create a table and output one table row per row in database. Change field1, fiedl2, field3 to the names of fields in the database. 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: Andrius Jakutis [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 23, 2001 11:22 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] listing This gives 25 the same entries. I need to list all entries from the table, but with loop. More solutions? Chris Hobbs [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Something like: ? for($i=1; $i25; $i++) { ? table tr td ? // php code to output your entry information ? /td /tr /table ? } ? Andrius Jakutis wrote: Hello again, Is there oportunity to write this: some php command to loop entries, the way is written bellow HTML php coding.+ MYSQL - 1 entries information end of loop Something like that: here loop begins table tr td first entry information from table companies (name, telephone...) /td /tr /table loop ends THanks. -- Su pagarba, Andrius Jakutis InternetMedia http://www.internetmedia.lt GSM: 370 82 31332 -- 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 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] listing
Then you start reading =) http://www.mysql.com/doc/ Sheridan Saint-Michel Website Administrator FoxJet, an ITW Company www.foxjet.com - Original Message - From: Andrius Jakutis [EMAIL PROTECTED] To: Rick Emery [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, August 23, 2001 11:50 PM Subject: Re: [PHP-DB] listing Okay, but what if I want to use data from two tables not only from companies ? Assuming you've opened a MySQL connection and stored connection in $connect: $query=SELECT * FROM mytable; $result = mysql_query($query,$connect) or die(ERROR); print TABLE; while( $row = mysql_fetch($result) { print TRTD.$row['field1'].TD.$row['field2'].TD.$row['field3']./TR ; } print /TABLE; mysql_free_result($result); The above will create a table and output one table row per row in database. Change field1, fiedl2, field3 to the names of fields in the database. 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: Andrius Jakutis [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 23, 2001 11:22 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] listing This gives 25 the same entries. I need to list all entries from the table, but with loop. More solutions? Chris Hobbs [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Something like: ? for($i=1; $i25; $i++) { ? table tr td ? // php code to output your entry information ? /td /tr /table ? } ? Andrius Jakutis wrote: Hello again, Is there oportunity to write this: some php command to loop entries, the way is written bellow HTML php coding.+ MYSQL - 1 entries information end of loop Something like that: here loop begins table tr td first entry information from table companies (name, telephone...) /td /tr /table loop ends THanks. -- Su pagarba, Andrius Jakutis InternetMedia http://www.internetmedia.lt GSM: 370 82 31332 -- 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 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] Store Procedures
no -Original Message- From: Francisco Carvalho [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 23, 2001 4:20 PM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] Store Procedures Newbie question. I've been developing web application in IIS using ASP and Microsoft SQL Server 7.0. I use Stored Procedures quite extensible is there an equivalent in MySQL Thanks. Francisco Carvalho -- 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] pg_exec question.
Hello, I'm new with PHP and PostgreSQL, and can't find a solution to the following problem. I'd like to combine multiple SQL commands into one pg_exec call. For example, I've tried delete ...; insert ...; insert ...; with the appropriate values in the ..., but I'm receiving this error: Warning: Supplied argument is not a valid PostgreSQL link resource Does anyone have any suggestions for this problem? 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: I am really stuck
Matt C [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 1) I would like to pull all entries out of a table that have dates that haven't occured yet. Basically forget anything before the current day. How do I do that? DELETE FROM table WHERE timestamp $now 2) I enter news into a table and would like to display a summary page. Basically it has a list of headlines under the date they were added. Monday 10th August *Item 1 *Item 2 Tuesday 11th August *Item 1 etc How do I do that? This is a wildly recurrent question, which really should be in the FAQ if it's not already (hint, hint...) Note: this is very PHP-like pseudocode; it WILL NOT run as written. // The query MUST BE sorted by the listby field, // so that equal values will end up together. $query = SELECT listbyfield, fieldB [, fieldC etc...] .FROM table ORDER BY listbyfield; $res = mysql_query($query); $lastseen = ; while ($row = mysql_fetch_array($res)) { // only echo the listby field if the value changes if ($row[listbyfield] != $lastseen) { $lastseen = $row[listbyfield]; printNewHeader($lastseen); } printEntry(); } ... you will of course have to define suitable stuff for printNewHeader() and printEntry(). -- 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] Re: Photo Album Schema
Sheridan Saint-Michel [EMAIL PROTECTED] wrote in message 03a901c12c02$c60d4640$[EMAIL PROTECTED]">news:03a901c12c02$c60d4640$[EMAIL PROTECTED]... I don't know if having multiple users associated with a single image is at all beneficial, and I can see where it might cause all sorts of problems. For example, you and I both have the same image in our album (we are both assciated with it in the DB). What happens when I change the description? Do you change the description field, thus changing the description on both our pages? Do you now have to create another entry in your Image table? Just to be nitpicky: I don't see where this would be useful - allowing users to share/transfer pictures? - but it's not overly difficult either. Just split the information between an Image table and an ImageOwner table. -- 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] Variables in MySQL Insert Queries
I am using this code to connect to my database and insert form data from a user: $connect = mysql_connect(myhost,user,pass) or die ( not connected); @mysql_select_db(dbname); $sql=INSERT INTO tablename (id,first,last,age,email,sfuser,sfship,icq,ac,loca,ref) Values(,`$first`,`$last`,'$age',`$email`,`$sfuser`,`$sfship`,`$icq`,`$ac`,`$ loca`,`$ref`); echo (mysql_affected_rows()?success:failure); mysql_close($connect); The script returns success except for it doesn't insert the data ( from a form ). The age column is BLOB, not INT. I would really appreciate the help of someone, as this has really stumped me. Thanks, plague -- 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 on Linux and MS SQL
I successfully compiled PHP to connect to MS SQL 2000 this way: 1. Get FreeTDS (free version of Table Data Stream protocol driver) and install it. 2. Configure installed file interfaces (see doc of FreeTDS), you need just name your connection to SQL 3. Configure PHP with --with-sybase option, compile and install 4. Try your connection ?php if (mssql_connect(named_conn_from_interfaces_file, user, pass)0) print working!; ? Adam Oliver [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Anybody know of a good installation description for connection PHP on linux to MS SQL on a 2000 machine? I've been through about 3 so far and none of them have worked. Adam Premysl Dedic, Need, a.s. - see(k) your needs tel. +420 2 84000111 -- 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 Procedures
no! -- 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] php doesn't work
Hello guys My server was running php4.0 just fine, but I needed to use some new features, so I decided to upgrade to the latest one (php4.06). I followed the normal procedure: ./configure \ --with-apxs=/usr/local/apache/bin/apxs --enable-ftp \ --with-mysql \ --with-dbase \ --with-imap \ --with-yp and then: make and finally: make install I didn't get any error message during the process, however my php pages don't work at all. Any idea? Thanks for your help --- Wilmar Pérez IT Manager - Central Library University of Antioquia Medellín - Colombia tel: ++57(4)2105145 --- -- 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 doesn't work
Copied the .so file into the right location? Restarted apache? First two things I'd check. 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 Thu, 23 Aug 2001, [iso-8859-1] Wilmar Pérez wrote: Hello guys My server was running php4.0 just fine, but I needed to use some new features, so I decided to upgrade to the latest one (php4.06). I followed the normal procedure: ./configure \ --with-apxs=/usr/local/apache/bin/apxs --enable-ftp \ --with-mysql \ --with-dbase \ --with-imap \ --with-yp and then: make and finally: make install I didn't get any error message during the process, however my php pages don't work at all. Any idea? Thanks for your help --- Wilmar Pérez IT Manager - Central Library University of Antioquia Medellín - Colombia tel: ++57(4)2105145 --- -- 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: [PHP-WIN] How to get the content of a file into the valueof a text column
Jack, You just need to check out the fopen and fread functions on php.net/manual Angie Tollerson Alliance Technologies Web Programmer (515)245-7628 [EMAIL PROTECTED] Jack [EMAIL PROTECTED] [EMAIL PROTECTED] 10:02AM Dear all Actually i'm trying to get the content of a file, and make it as a default value of a input text column. Is there anyway could do it? Thx jack [EMAIL PROTECTED] -- PHP Windows 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]