Re: [PHP-DB] Date Time 90 minutes ago
$date_90_minutes_ago = date('m/d/Y',mktime()-(60*90)); $time_90_minutes_ago = date('h:i:s',mktime()-(60*90)); 60 seconds * 90 minutes. =C= | | Cal Evans | http://www.calevans.com | | We get our best customers from referrals. | We would appreciate you referring any of your | friends or co-workers that need web hosting. | | Ron Piggott (PHP) wrote: Would someone be able to help me with the DATE command syntax to know what the date and time was 90 minutes ago? I am trying to assign these values into two variables: $date_90_minutes_ago $time_90_minutes_ago I am not sure how to handle midnight where if the time is 00:10:00 ninety minutes earlier is a day before. Thanks. Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How can I solve this?
try $x =pathinfo($_SERVER['PHP_SELF']); echo $x['dirname']; =C= | | Cal Evans | http://blog.calevans.com | | Chris Payne wrote: Hi everyone, I am using PHP_SELF in order to get the current path on a dynamically created webpage. This gives me the following: /my_website/index.php My problem is, ALL I NEED is the directory name - no / or no index.php, how can I strip these out to leave JUST the folder name the file is located in? I need this because the page is dynamically created, and it gets templated information from a database and needs to use the foldername as the identifier between the DB entry to use for grabbing the information and the pages inside the directory. Any help would be really appreciated and I'm certain it's something REALLY obvious. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] problem of transmiting variabl into another page?
Using the code below, when you click on the link for A it will go to alpha.php?artist=A In alpha.php, you should be able to query $_GET['artist'] to get the letter clicked on. You could also check $_REQUEST['artist'] for the same info. Is that what you needed or are you having other problems? =C= | | Cal Evans | http://www.calevans.com | Mohamed Yusuf wrote: I am transmitting variable from one of my pages and I would like to match that variable into mysql data. it won't return data. my code is this. ?php for ($j=A; $j = Z; $j++) { echo | ba href='alpha.php?artist=$j'$j/a/b |; if ($j == Z) { break; } } ? this code in my index page prints alphabetical letters from A-Z. and I woul like to transmit that variable into my alpha.php page and select mysql database what ever the value of $j is, but i have problem I can't figured out what is wrong. can somebody help me. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] how to reuse DB results
adodb has a moveFirst() function. You should be able to use it to display x rows then $rs-moveFirst() and then use a while loop to display all of them. HTH, =C= : : Cal Evans : Evans Internet Construction Company : 615-260-3385 : http://www.eicc.com : Building web sites that build your business : Aaron Wolski wrote: Hi All, Got this logic problem I don't know how to solve. Is there any way I can make a call to the DB for some records. Display some info from a column or two say at the top of the page and then display the full result set in a while() loop? Right now, I am making two calls to the Db to get the data I need to display at the top of the page and then a second query to retrieve the full result set. I'm confused! Thanks for any help! Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] SQL Statement
Jimi, PHP does not return an error because it knows nothing about valid sql. It's just knows if it's a valid PHP statement. (which it is because you've got the 's in the right place and a ; at the end. ) :) It's up to MySQL to return an error. As to your statement. 1: It's easier and valid in PHP to write it: $sqlwrk = SELECT pk_phone_reports, SUM(calls) AS total_calls, date, calls , fk_ph_num FROM phone_reports WHERE (pk_phone_number = {fk_phone}) AND (date BETWEEN '{$my_startdate}' AND '$my_enddate') GROUP BY pk_phone_reports, fk_ph_num, date, calls; In reformatting the string I found a couple of PHP things that are probably what's tripping you up. PHP used the . as a string concatonator. You were missing several of them. Notice that I remove them all. Because we enclosed the entire statement in a sing pair, we can use {$variable} for substitution. Makes life a lot easier when building sql statements. Also, I removed all the back-tiks. Not because they were wrong but they annoy my and in 99% of the cases are not necessary. Oh and welcome to PHP/MySQL. I hope you'll find the language easy and the people friendly. Finally, a could of things that will make life easier for you if you are going to be doing much database work in PHP/MySQL. http://php.weblogs.com/ This is the best database abstraction layer I've found. Even if you only use MySQL, it's worth the investment in time to learn it. (mainly for the debug feature.) www.sqlyog.com Best FE for MySQL on Windows I've ever found. It's $49.00 (I think...I forget) but it's worth it. It's got it's bugs but overall it's a killer tool. http://www.fabforce.net/dbdesigner4/ A killer, open source tool for designing databases. If you are used to the commercial tools costing $4k+ then you'll feel right at home with this. (It's my understanding that MySQL has purchased this project, but I may have my story wrong.) Finally, you've already found the greatest tool for debugging MySQL/php, the lists. See ya round. =C= : : Cal Evans : Evans Internet Construction Company : 615-360-3385 : http://www.eicc.com : Building web sites that build your business : Thompson, Jimi wrote: For some background, I've been tasked with building a marketing tracking application by the PHB's who think that being able to write SQL means you can code. I know how to get data into a database and I can do thing with it once it's in there, but this is one of my first attempts at extracting anything remotely end-user-ish. Since the only server I can get is an old cobalt RAQ 2, the only database I can run is MySQL. Im not terribly familiar with MySQL (spent more time working with commercial databases) and Im a complete newbie at PHP, so please dont flame me yet Im not even sure what information Ill need to provide you so here goes: Platform Red Hat 9.0 Linux on a BogoMIPS CPU PHP Version - 4.3.3 Apache Version - 1.3.28 MySQL Version - 4.0.14 Heres my SQL statement which works fine from a DBA perspective (meaning that I can execute it from the command line against the database and obtain the desired results), but Im obviously missing something in the syntax in converting this to an acceptable PHP SQL statement. I know that I can connect to the database and can extract other records, but I keep getting unable to parse error message and dont know enough to know which thing Im doing is wrong. SELECT phone_reports.pk_phone_reports, SUM(phone_reports.calls) AS total_calls, phone_reports.fk_ph_num, phone_reports.`date`, phone_reports.calls FROM phone_reports WHERE (phone_reports.fk_ph_num = 1) AND (phone_reports.`date` BETWEEN '2004/05/17' AND '2004/07/05') GROUP BY phone_reports.pk_phone_reports, phone_reports.fk_ph_num, phone_reports.`date`, phone_reports.calls Heres the PHP SQL statement built from the SQL statement above ?php if ($fk_phone != NULL) { $sqlwrk = SELECT `pk_phone_reports`, `date`, `calls` , `fk_ph_num` FROM `phone_reports`; $sqlwrk .= WHERE `pk_phone_number` = . $fk_phone; $rswrk = mysql_query($sqlwrk); if ($rswrk $rowwrk = mysql_fetch_array($rswrk)) { echo $rowwrk[number]; } @mysql_free_result($rswrk); } ? This seems to work ok, but doesnt return any results (which I expected) but it does parse! So then I try do this ?php if ($fk_phone != NULL) { $sqlwrk = SELECT `pk_phone_reports`, SUM(`calls`) AS `total_calls`, `date`, `calls` , `fk_ph_num` FROM `phone_reports`; $sqlwrk .= WHERE `pk_phone_number` = . $fk_phone; $rswrk = mysql_query($sqlwrk); if ($rswrk $rowwrk = mysql_fetch_array($rswrk)) { echo $rowwrk[number]; } @mysql_free_result($rswrk); } ? Note that this shouldnt
Re: [PHP-DB] Impact of MySQL Queries
If both services are running on the same machine then no, the number of queries per page will not affect bandwidth. It will however, affect you processor usage. Without having seen your code, I can only make generalizations. 20 queries is a bit excessive but it's still manageable if the server is not being hit too heavy. To answer your question directly, yes, it will start to slow down as you have more people using the system. I would suggest you consider the following. 1: Use ADODB as your abstraction layer. It has built in query caching and could dramatically improve page speed as well as lower processor usage. 2: Take a hard look at your code and make sure you actually need 20 queries on a page. Would a single query be possible and then spin through the result set? 3: Consider moving to a Linux box. (Sorry, had to be said) Without the overhead of a GUI, your processor will be more available for mysql and your web server. 4: Make sure you have the proper indexes set. If you do need 20 queries, 20 fast queries are better than 20 slow queries. :) HTH. Let me know how I may be of service, =C= * Cal Evans * http://www.eicc.com * We take care of your IT, * So you can take care of your business. * * I think inside the sphere. Marcjon Louwersheimer wrote: I have IIS 4.x and MySQL running on the same machine. So do queries use up bandwidth? Does it matter if I have 20 queries per page? Will that slow it down if many people started using my site? Currently only I, and some friends for testing, use it. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How to print doc
Agreed. It is possible to print things on the server side. I made the (incorrect) assumption that he wanted to control client-side printing from PHP. Let me know how I may be of service, =C= * Cal Evans * http://www.eicc.com * We take care of your IT, * So you can take care of your business. * * I think inside the sphere. Sai Hertz And Control Systems wrote: Dear Cal Evans, Assuming you mean from PHP, you can't directly do that. PHP is server side, Printing is client side. If you are working in a Printing is possible on server side PHP has some print functions but that works on Windows only that also on serverside not the client side In javascript you may do something like a href=# OnClick='window.print()'Click to print /a Regards, Vishal Kashyap -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] How to print doc
Assuming you mean from PHP, you can't directly do that. PHP is server side, Printing is client side. If you are working in a browser environment, you can explore your options within Javascript. Let me know how I may be of service, =C= * Cal Evans * http://www.eicc.com * We take care of your IT, * So you can take care of your business. * * I think inside the sphere. wan wrote: Hi all, How to print document without display/open that document, Only click the button print, document printing. TQ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Saving arrays to databases?
The easy way (but not the recommended way) would be to serialize() the array and then stuff it into a TEXT field for later retrival and unseralize(). This would work if you are just storing the array for later use and don't need to select on it's contents. Personally, before I would go that route, I would re-exaim your datamodel and see if tere wasn't a way to properly store it. Let me know how I may be of service, =C= * Cal Evans * http://www.eicc.com * We take care of your IT, * So you can take care of your business. * * I think inside the sphere. Jeroen Wasteels wrote: Is it possible to save an array to a database? And if so, how can I display the entire array when I retreive it from the database? If not, is there some other way to store several data in one colomn/row? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Planetside
What is the Planetside database? Let me know how I may be of service, =C= * Cal Evans * http://www.eicc.com * We take care of your IT, * So you can take care of your business. * * I think inside the sphere. Madaleno wrote: Hi, can someone help me on how to access Planetside database to get some character info? Thanks -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mssql and resource handling
Michael, Don't store resources in your session. They die when the page is finished rendering. Variables you can store in your session. Even objects can be stored in your session. But do not store resources. I would suggest a couple of things. 1: Use ADOdb instead of just raw my_sql statements. (php.weblogs.com) It has pagination functions that will make your life easier. (It also has a cool caching system, transactional support and a bunch of stuff that takes the hassle out of database programming. 2: If you won't do #1 then the first time you execute the query, spin through the entire recordset and store the records as an array. The array you can save in your session. note if your record set is more than 100 records I would not do this. Let me know how I may be of service, =C= * Cal Evans * http://www.eicc.com * We take care of your IT, * So you can take care of your business. * * I think inside the sphere. Michael Lewis wrote: I have a fairly common problem that I have not been able to find the solution for in the documentation and FAQs. I have to access a MSSQL box from a LAMP box using PHP. That part works fine (thank you freetds.org). I need to display results from user queries 10 at a time with the basic NEXT and BACK logic. I can use the mssql_data_seek function to move amongst the record set. The problem is how do I save the results variable between web page updates? I cannot save the record set variable in my session because it always returns as zero. Consider the following code: ?php session_start(); include(localsettings.php); $s = mssql_connect($Server, $User, $Pass) or die(Couldn't connect to SQL Server on $Server); mssql_select_db($SDB, $s) or die(Couldn't open database $SDB); $sql=select * from products where prod_id='95038'; $ress=mssql_query($sql) or die(mssql_get_last_message()); $_SESSION['ress']=$ress; print $ress.\n; $ress=$_SESSION['ress']; print $ress.\n; ? The first time I print RESS is comes back as RESOURCE OBJECT #12, the second time as 0. When I look in the session file, it is zero. Help! How can I pass this variable and its contents so they are usable to the next web page? Thanks in advance. Michael -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] nested sets?
Chapter 28 (or 29) in Joe Celko's SQL for Smarites. The chapter on nested sets alone is worth the price of the book. At the very end of the chapter (after taking you through the details of a nested set) he gives a very simple and easy to implement solution for nested sets. Let me know how I may be of service, =C= * Cal Evans * http://www.eicc.com * We take care of your IT, * So you can take care of your business. * * I think inside the sphere. ma wrote: hi everybody! i try to make a clickable menu. it should be outputed as XML. i found a solution to make it possible to decend only the selected menues. but is there a easier solution? my goal is to first show only the first (level=0) level. if the user clicks on the menu it should select the second (level=1) level, but only from the menu he clicked. (so HAVING level=1 doesn't help :( ) does anybody know a solution or a good reference for nested sets? (don't have the possibility to use pear - unfortunately cause there are some great tools) here's my db-structure: id (int) unsigned auto_increment left (int) unsigned right (int) unsigned level (int) unsigned (default: 0) title (varchar) link (varchar) menu (int) unsigned (default: 0) heres my solution (using singleton registry pattern and a sql-class working with adodb-functions): ### $reg = registry::instance(); $sql = $reg::getEntry('sql'); # $_GET['menu'] = 'About/Company/History' // - something like this $qry ='SELECT `first`.`left`, `first`.`id`, `first`.`link`, `first`.`title`, `first`.`level`, ROUND((`first`.`right`-`first`.`left`-1)/2) AS `children` FROM `'.$grz-cnf['tablePluginPrefix'].'menu` AS `first`, `'.$grz-cnf['tablePluginPrefix'].'menu` AS `second` '; $open = array(); if(isset($_GET['menu'])) { $open = explode(';', $_GET['menu']); $or = join(' OR `third`.`id`=', $open); $qry .=',`'.$grz-cnf['tablePluginPrefix'].'menu` AS `third` WHERE (`first`.`left` BETWEEN `second`.`left` AND `second`.`right` AND `first`.`left` BETWEEN `third`.`left` AND `third`.`right` AND `first`.`level`=`third`.`level`+1 AND (`third`.`id`='.$or.')) OR (`first`.`left` BETWEEN `second`.`left` AND `second`.`right` AND `first`.`level`=0) '; } else { $qry .='WHERE `first`.`left` BETWEEN `second`.`left` AND `second`.`right` AND `first`.`level`=0 '; } $qry .='AND `first`.`menu`='.$menuID.' GROUP BY `first`.`left` ORDER BY `first`.`left` '; $res = $sql-query($qry); ### thx a lot for taking your time, help would be warmly appretiated... -ma # life would be easier if i knew the source code... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Read file
Jason Wong wrote: On Tuesday 18 November 2003 09:58, Ng Hwee Hwee wrote: the reason i don't want to read from the server is because i don't want to use up too much space and processing time on the server.. the file has 50,000 records of information.. is there another way other than uploading on the server side?? Two options: 1) You can recompile PHP with the startrek module and use startrek_transport() to instantly transfer anything (data, even physical objects) from anywhere to anywhere else. This requires lib-dilithium.so.6 and it's currently only in the devel branch. (So I wouldn't run it in a production environment.) Let me know how I may be of service, =C= * Cal Evans * http://www.eicc.com * We take care of your IT, * So you can take care of your business. * * I think inside the sphere. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Read file
I've seen it done with some creative javascript. (i.e. caching to a tmp dir and accessing the txt file onChange.) But you cannot (REPEAT CANNOT) execute php on a client machine unless you load php and a web server onto that client machine. PHP is still a server side script. And 10k cookies is out of the question. I imagine it would bring down your browser. You are correct to be concerned about people bringing down 10k records each time. I suggest you re-think your database strategy so that you bring down a smaller subset. If done right, you can use Javascript and a hidden window to fetch records from the database and return them to the currently running page without refreshing the page. (It can be done. It's ugly and it's a bugger to maintain, but it can be done.) Let me know how I may be of service, =C= * Cal Evans * http://www.eicc.com * We take care of your IT, * So you can take care of your business. * * I think inside the sphere. Ng Hwee Hwee wrote: what about using cookies? my problem is this: i have about 10,000 hotels records and each of them has information about its location, its hotel code, its hotel tel, its country code etc... i would like to load this into the clients computer so that when they enter a hotel code, all the information will be reflected in the form using onChange()... if 50 employees were to query the database always for these 10,000 records, i'm afraid the server can't take the traffic and die.. so i was thinking of uploading a CSV file into my client's computer and then have my scripts find the file and read the file for Javascript to process... since the information in the file changes ususally only once a year, i don't have to worry that they will have back-dated information.. i'm desperate for enlightenment! thanx!! :o) blessings, hwee - Original Message - From: Michael Scappa [EMAIL PROTECTED] To: 'Ng Hwee Hwee' [EMAIL PROTECTED] Sent: Tuesday, November 18, 2003 10:01 AM Subject: RE: [PHP-DB] Read file If you are publishing it on the web, it has to get to the server eventually, so your answer is no. There is really no way around it. If the file is often used, pump it into a DB and search it that way, it'll be much quicker. -Original Message- From: Ng Hwee Hwee [mailto:[EMAIL PROTECTED] Sent: Monday, November 17, 2003 8:58 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Read file the reason i don't want to read from the server is because i don't want to use up too much space and processing time on the server.. the file has 50,000 records of information.. is there another way other than uploading on the server side?? thanx! hwee - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 18, 2003 9:54 AM Subject: Re: [PHP-DB] Read file On Tuesday 18 November 2003 09:29, Ng Hwee Hwee wrote: can anyone enlighten me on how i can use PHP to read the contents of a file from the client's machine?? for eg, the client has a CSV file in his MyDocuments directory, how can I read the contents and publish them on the web? You have to ask them to upload it to the server: manual Handling file uploads -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] how to connect to access using ado library
checkout http://php.weblogs.com/ They have a database abstraction layer that works like ADO. It may do what you want. Let me know how I may be of service, =C= * Cal Evans * http://www.eicc.com * We take care of your IT, * So you can take care of your business. * * I think inside the sphere. Sandeep wrote: Hi I m new to php and want to connect to ms access without dsn can anyone provide me sample code or link where i can get more help -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Hyperlinking to a new page
script.php?key=valuekey=valuekey=value i.e. http://www.yourserver.com/yourscript.php?city=mobilestate=al or http://www.yourserver.com/yourscript.php?cityid=666 This will allow you to use $_REQUEST['city'] in the page you are calling to retrieve the city from the first example. You can also use $_GET['city'] but I use $_REQUEST because it contains both $_POST and $_GET. The variable names are case sensitive and must be exactly what you put on the URL. $_REQUEST['City'] != $_REQUEST['city'] HTH, =C= * Cal Evans * http://www.eicc.com * We take care of your IT, * So you can take care of your business. * * I think inside the sphere. Rob wrote: I believe what you want to do is just add the variable onto the URL, like this... script.php?variable or script.php?variablevariable Does that help? Thanks, Robert Gillen http://www.GifArt.com - Original Message - From: Shiloh Madsen To: [EMAIL PROTECTED] Sent: Thursday, October 09, 2003 3:41 PM Subject: [PHP-DB] Hyperlinking to a new page Ok, I know this should be easy, but im just blanking on how to do it. I have a webpage where you put in a city name, and it queries a database of all the cities in the US and brings back all cities matching that name. This part works just fine. What I want to do now is to create a hyperlink for each city name which, when clicked on will then call up a second page listing the details of that city. What I need to do is pass this page the city id (or any other identifying variable) to the detail page, but I cant for the life of me remember how to pass the data from one page to another outside of a form. Any help would be appreciated. -- 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] Problem with php/mysql and ISS on windows XP profeesional
Sounds like you left off a $ when using a variable. I would take a look at line 158, find the variable name and make sure it's $name. Disabling the error will cause the message to go away but not fix the problem. humbly, =C= * Cal Evans * http://www.christianperformer.com * Stay plugged into your audience * The measure of a programmer is not the number of lines of code he writes but the number of lines he does not have to write. * - Original Message - From: Ahmed Abdelaliem [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 02, 2003 9:50 AM Subject: [PHP-DB] Problem with php/mysql and ISS on windows XP profeesional hi i use php and mysql on IIS server on windows xp professional when i select anything from the database i get this : Notice: Use of undefined constant name - assumed 'name' in d:\inetpub\wwwroot\EGYCDS\index.php on line 158 Spy Hunter while evrything is going fine when i upload it on the web and it returns only Spy Hunter i think i have to disable this eroor message only can any one tell me how i disable that error message _ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail -- 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] Problem with php/mysql and ISS on windows XPprofeesional
Again, changing the error reporting level will not fix the problem. Since he is getting a warning AND his code is acting unexpectedly, he probably needs to concentrate on fixing the problem. (At least I assume that there is a problem. It sounds like there is from his description.) humbly, =C= * Cal Evans * http://www.christianperformer.com * Stay plugged into your audience * The measure of a programmer is not the number of lines of code he writes but the number of lines he does not have to write. * - Original Message - From: Adam Voigt [EMAIL PROTECTED] To: Ahmed Abdelaliem [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, June 02, 2003 9:59 AM Subject: Re: [PHP-DB] Problem with php/mysql and ISS on windows XPprofeesional If your missing the dollar sign then add it, if your not, then set error_reporting in your php.ini to E_ALL ~E_NOTICE. On Mon, 2003-06-02 at 10:52, Cal Evans wrote: Sounds like you left off a $ when using a variable. I would take a look at line 158, find the variable name and make sure it's $name. Disabling the error will cause the message to go away but not fix the problem. humbly, =C= * Cal Evans * http://www.christianperformer.com * Stay plugged into your audience * The measure of a programmer is not the number of lines of code he writes but the number of lines he does not have to write. * - Original Message - From: Ahmed Abdelaliem [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 02, 2003 9:50 AM Subject: [PHP-DB] Problem with php/mysql and ISS on windows XP profeesional hi i use php and mysql on IIS server on windows xp professional when i select anything from the database i get this : Notice: Use of undefined constant name - assumed 'name' in d:\inetpub\wwwroot\EGYCDS\index.php on line 158 Spy Hunter while evrything is going fine when i upload it on the web and it returns only Spy Hunter i think i have to disable this eroor message only can any one tell me how i disable that error message _ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Adam Voigt ([EMAIL PROTECTED]) Linux/Unix Network Administrator The Cryptocomm Group -- 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] Can't Insert more than 1 record
HAR! Ok, seriously though, does your script return an error of any kind? Sounds like you are violating a primary or unique key in the second insert. What database engine are you using? =C= - Original Message - From: Leif K-Brooks [EMAIL PROTECTED] To: Keven Jones [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, April 03, 2003 5:13 PM Subject: Re: [PHP-DB] Can't Insert more than 1 record I haven't used my psychic powers for a while, but I think the problem is on line 35. Keven Jones wrote: Hello All, I am having a problem inserting records into my Database. I am passing fields from a FORM to my php program that adds 1 record to my DB. It will create the first attempt just fine, however any attempt after the 1st fails. I have to delete the existing row in order to add a new record. Anyone know what I am doing incorrectl? KJ _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- 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] print new account name on new account page?
I don't use the mysql functions anymore (look into php.weblogs.com) but I believe what you are looking for is $row['firstName'], not $firstName. (The extract MAY put them into variables for you but if it does, it's not necessary, just use the $row array. Also, tail the log file on your SQL server to make sure that the select is being executed properly. =C= * * Cal Evans * Stay plugged into your audience. * http://www.christianperformer.com * -Original Message- From: Addison Ellis [mailto:[EMAIL PROTECTED]] Sent: Saturday, January 18, 2003 1:58 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] print new account name on new account page? hello, i have a form someone fills out. on submit it takes them to a new accounts page that say welcome new member. how can i get their name to print on the new page from the form they just filled out? i have been trying the following but it keeps giving me error messages regardless of how i manipulate the following. thank you for your time. addison ? include(config.php); $sql = SELECT firstName,lastName FROM accounts WHERE email='$logname'; $result = mysql_query($sql) or die(Couldn't execute query 1.); $row = mysql_fetch_array($result,MYSQL_ASSOC); extract($row); echo headtitleNew Account Welcome/title/head h2 align='center' style='margin-top: .7in' Welcome $firstName $lastName/h2\n; ? here is an example of the errors: Warning: extract() expects first argument to be an array in /users/infoserv/web/register/ca/new_account.php on line 82 -- Addison Ellis small independent publishing co. 114 B 29th Avenue North Nashville, TN 37203 (615) 321-1791 [EMAIL PROTECTED] [EMAIL PROTECTED] subsidiaries of small independent publishing co. [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Drawing chart
check www.zend.com www.freshmeat.net http://www.planetsourcecode.com/vb/default.asp?lngWId=8 to start with. * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: Matthias Steiner [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 01, 2003 5:28 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Drawing chart I'd like to have PHP drawing a chart based on temperature data in a mySQL database. Before I start inventing the wheel: does anybody know about finished code which produces a *.png-Chart from a table of values in a database? Gruss, Matthias -- Steiner Matthias Student of Telematics University of Technology, Graz, Austria http://web.utanet.at/steiner/ -- 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] Next/Prev 10 lines
check out php.weblogs.com ADODB does this for you. =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: Steve Dodkins [mailto:[EMAIL PROTECTED]] Sent: Friday, December 20, 2002 9:16 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Next/Prev 10 lines Has anyone got some code that will correctly display the next 10 line of a table with prev and next working? Or point me in the right direction for help? Regards Steve Dodkins IMPORTANT NOTICE The information in this e-mail is confidential and should only be read by those persons to whom it is addressed and is not intended to be relied upon by any person without subsequent written confirmation of its contents. ebm-ZIEHL (UK) Ltd. cannot accept any responsibility for the accuracy or completeness of this message as it has been transmitted over a public network. Furthermore, the content of this e-mail is the personal view of the sender and does not represent the advice, views or opinion of our company. Accordingly, our company disclaim all responsibility and accept no liability (including in negligence) for the consequences of any person acting, or refraining from acting, on such information prior to the receipt by those persons of subsequent written confirmation. In particular (but not by way of limitation) our company disclaims all responsibility and accepts no liability for any e-mails which are defamatory, offensive, racist or in any other way are in breach of any third party's rights, including breach of confidence, privacy or other rights. If you have received this e-mail message in error, please notify me immediately by telephone. Please also destroy and delete the message from your computer. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message is strictly prohibited. If you have received this E-mail in error, or suspect that the message may have been intercepted or amended, please notify ebm-ZIEHL (UK) Ltd on +44(0)1245 468555. ebm-ZIEHL (UK) Ltd Chelmsford Business Park, Chelmsford, Essex CM2 5EZ -- 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] trees in MySQL
http://froogle.google.com/froogle?q=%22SQL+for+Smarties%22btnG=Froogle+Sear ch Chaps 28 29. (ok, I had to read both but it sounds like you already understand the concepts.) The end of chap 29 he gives a simple example for maintaining what you are talking about. I used it to write a dynamic menu system for a web portal for a client. It is possible to do and not terribly difficult. Given the lack of stored procedures you do end up executing 8-10 sql commands one after the other but if you are using a transaction safe table type (*COUGH*InnoDB*COUGH*) then it works pretty good. Unlike one of the suggestions I read here, this system doesn't like holes in the numbers. But he gives code for adding and subtracting nodes. By combining the two, I actually made it so the client could move entire branches. HTH, =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: José Moreira [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 19, 2002 10:45 AM To: Php-Db (Correio electrónico) Subject: [PHP-DB] trees in MySQL hello im implementing a portal and im choosing between the 'Nested Set' and 'Adjacency Lists tree' models. http://users.starpower.net/rjhalljr/Serve/MySQL/traer.html im perfectly aware of the 'Adjacency Lists tree' model how-to and I am studying the 'Nested Set', example follows : CREATE TABLE LanguageTree ( Language VARCHAR(255) PRIMARY KEY , Parent VARCHAR(255) , Lft LONG , Rgt LONG , INDEX idxLft (Lft) , INDEX idxRgt (Rgt) ) Comment = Related languages; A[1 12] / \ /\ B[2 3] C[4 11] / \ /\ D[5 8] F[9 10] | E[6 7] my doubt is that if i want to insert a new node, for example 'G' under 'A' A[1 12] / | \ / \ B[2 3]G[] C[4 11] / \ / \ D[5 8] F[9 10] | E[6 7] i have? to update almost every left,righ fields after that node, resulting in a website performance downgrade help? even if thjats the only way, how can i do it? perhaps im getting it wrong ... best regards José Moreira TEGOPI S.A. http://www.tegopi.pt -- 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] Catalog
Don't be offended: SQL For Dummies One of the best SQL primers I've ever read. I STILL keep my copy handy. Once you get through that and a few thousand queries under your belt, Joe Celko's SQL for Smarties is a great reference. (I recommended it earlier today to someone, dig that out and it's got a URL) Depending on the products in your catalog, this could be a daunting. I've got 1 catalog system that has 10 tables just to describe the products. (All interrelated, makes for a pretty ER diagram!) But if your needs are simple AND well defined, it could be a good starter project. Oh, and don't forget Paul Dubois book on MySQL. I've not yet purchased a copy (sorry Paul) but the parts I've leafed through at the bookstore looked very good. Also, join the MySQL mailing list. (Paul actually hangs out over there) =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: Hynek Semecký ME [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 11, 2002 4:55 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Catalog Hi list, I am trying to develop a product catalog using MySQL and PhP. A long time I was looking for some tips for the database structure. The idea is to have a powerfull and as much as possible universal DB application. Does anyone have an idea of a book, e-book, site, resource please ? Thanks Hynek -- 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] Email Encryption?
Instead of emailing them the login and password info, setup a fax gateway and fax it to them. I used this in a situation that needed to be HIPA compliant. (If security is still an issue, fold the fax before sending it.) :) HTH, =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: Friday, November 15, 2002 10:47 AM To: 'Hutchins, Richard'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? The user account is setup via the Admin util. The details are emailed to the account holder. Profile and Login information are contained within. Aaron -Original Message- From: Hutchins, Richard [mailto:Richard.Hutchins;GetingeCastle.com] Sent: November 15, 2002 11:43 AM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? Can you explain how e-mail fits into the Admin solution? What is the e-mail used for? Setting up the accounts/passwords or sending the account/password to the user? -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: Friday, November 15, 2002 11:39 AM To: 'Aaron Wolski'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Email Encryption? Just thinking here.. PGP is not an option as it would mean EACH user being setup would need the company's public key to decrypt. Not possible as they setup a few hundred accounts each month. Hmm.. anything else? Argh :( Aaron -Original Message- From: Aaron Wolski [mailto:aaronjw;martekbiz.com] Sent: November 15, 2002 11:36 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Email Encryption? OFFTOPIC Sorry for the off topic guys.. But I've just been informed that an application we developed for a client whereby they use an Admin tool to setup user accounts into their store needs to have the login (username and password) encrypted. I am thinking PGP for this but to be honest I've never really worked with PGP and wouldn't have the first clue. Does anyone have any experience with this or can offer and advise at all? Again, sorry for the OT discussion. Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Separating content from style
My $0.02 worth, For the purposes of sanity (mine) I treat a combination of PHP/HTML in the web page as the middle tier (Controller), the browser and any JavaScript as the front-end (View) and a combination of PHP objects and the database as the backend (Model). This warped view of MVC allows me to incorporate some PHP in the HTML so I can avoid things like tag libraries and template engines. (Nothing wrong with them, they are just one MORE level of abstraction) As a rule, I do not allow the code that is in my web page to access the database. All database access is done through objects. I also do not let objects (with 1 exception, my FormBuilder class) generate HTML. Depending on the project, I may code mysql_* commands in my objects or (my preferred method) utilize ADODB as my database abstraction layer. (BTW, I don't use it because I switch databases a lot, I use it because I like the feature set.) Therefore, my web pages usually: Instantiate the objects necessary to build the page. Manipulate the objects and wrap them in HTML. Destroy the objects and send the page to the browser. It's not true MVC or pure OOP but it's the best compromise I've come up with. =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: Dave Smith [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 10:27 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Separating content from style Folks, I've just learned a bit about Java Beans and how they are useful in separating content from style. They let you do XSLT'ish stuff in your HTML to grab data while not bogging down your HTML with database-related function calls. I've heard this setup referred to as templates and 3-tier. It has all kinds of advantages, the biggest of which is probably the ability to specialize: Allow your web-designer to work with HTML/CSS and your DBA to work with SQL, with no overlap. Obviously, PHP doesn't really lend itself to this sort of setup at first. At least, I haven't found a good way to do it. Does anyone have any good docs on how to setup a 3-tier templated system in PHP that separates content from style? If not, how about a few words on this idea? What are your thoughts? How can PHP tackle this problem? advTHANKSance, Dave -- 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] search question
it depends on how you design your database. When I know I will have this situation, I design a table named keyWords. Put one work per record and assign each word an ID number. Then I create a join table between keyWords and whatever table they relate to. The join table only contains 2 fields, the pk from keyWords and the pk from the other table. Then I ad 1 record to the join table for each keyword that relates to each record in the other table. It's simple then to join the 3 tables in such a manner as to quickly find the records in the other table that relate to a specific key word. HTH, =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: Meltem Demirkus [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 17, 2002 3:20 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] search question Hi, Is there any other efficient way (--except using LIKE)of searching a keyword in mysql ... thanks -- 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] Form question.......
That's a toughie. I've done it once where I used a small popup window (opening it with JavaScript) to go to the server, perform the query to retrieve the information, stuff it into a JavaScript array and then return the array to the calling page and close the window. It works but the user will see a small window pop-up. Other than that, it is possible to use a Java Applet to do it as well. HTH, =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: Rodrigo [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 04, 2002 7:30 PM To: PHP Subject: [PHP-DB] Form question... Hi, i have a question, it may be dumb, but i´m very new with php and mysql, i need help. how can i check a form when i change from one field to another I want make a condition.if the number i typed is allready in the database, not just when i finish filling out the hole form...clickin in submit and then make the conditionshelp heheheh Rodrigo Corrêa [EMAIL PROTECTED] Obs: Sorry about the english, i´m from Brazil...so my english isn´t good -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Indepth Tutorial... need help.
I must concur, Chapters 28 29 are worth the price of the book! =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: Ignatius Reilly [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 03, 2002 9:49 AM To: [EMAIL PROTECTED]; Matt Zur Subject: Re: [PHP-DB] Indepth Tutorial... need help. For a SQL tutorial, I would recommend that you get yourself a copy of Joe Celko's SQL for smarties. Best investment I ever made. Everything you need to know is there. Bon courage! - Original Message - From: Matt Zur [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 03, 2002 3:08 PM Subject: Re: [PHP-DB] Indepth Tutorial... need help. Right well that's what I'm asking I need a tutorial and haven't found a good one. -Matt Rasmus Lerdorf wrote: Most of this stuff is actually just SQL and has little to do with PHP. So look for an SQL tutorial. From the PHP side all you need to know is mysql_connect(), mysql_select_db(), mysql_query() and mysql_fetch_row().'' All queries are sent to the database via mysql_query(). It doesn't matter to PHP if you are adding, deleting, modifying, searching, sorting, filtering, or whatever. You just put the SQL code in the mysql_query() call. -Rasmus On Tue, 3 Sep 2002, Matt Zur wrote: Can someone point me in the direction of an online tutorial for php mysql that covers the following: - Teaches me how to use php to access mysql - Creating a db that is structured to be efficient - How to add, modify, and delete records in a database - How to search for records - How to filter records - How to sort records, by a certain field, alphabetical, descending etc. - Indexes - how to create them, how to keep the updated with changes in the db a beginners look to in-depth approach. Yes I've visited PHP.net, and mysql.com. I need a dumbed down version that pretty much holds my hand and is very detailed. I've searched the net for a while now, and all the tutorials I have found... although simple... they don't go in-depth and move on to more advanced features. Any help at all will be greatly appreciated. -Matt -- Matt Zur [EMAIL PROTECTED] http://www.zurnet.com Need a Web Site??? - Visit... www.zurnet.com 1997 - 2002 - 5th Anniversary!!! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Matt Zur [EMAIL PROTECTED] http://www.zurnet.com Need a Web Site??? - Visit... www.zurnet.com 1997 - 2002 - 5th Anniversary!!! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] SQL query prob
It would unless you told it not to. Set a flag $lastContactType=''; Then on the first page you display something where then display it and then if ($lastContactType != $row['contactType']){ echo $row['contactType']; $lastContactType=$row['contactType']; } // if ($lastContactType != $row['contactType']) When contactType changes again, you'll display it again and reset the flag again. HTH, =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: Russ [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 17, 2002 8:44 PM To: PHP DB Mailing List (E-mail) Subject: [PHP-DB] SQL query prob I'll try that one again I have a query: $sql = SELECT * FROM contacts ORDER BY ContactType; There are two types of contacts: * Commissioners * Staff As they are ordered by the ContactType then 'Commissioners' are displayed first followed by 'Staff'. I'd like to be able to display a heading on the page at the point of the FIRST instance of 'Commissioners' and at the FIRST instance of 'Staff'. As I'm using a while loop in my PHP script then at present such a heading would be displayed atop *each* item would it not? I think I need to use some kind of COUNT() but am unsure how to deploy it. Can anyone help me out? Cheers. Russ Mr Russ Michell Web Applications Developer Itomic.com Email: [EMAIL PROTECTED] Tel: +61 (0)8 9321 3844 Fax: +61 (0)8 6210 1364 Post: PO Box 228, Innaloo, WA 6918, Australia Street: Suite 24, 158 William St, Perth, WA 6000, Australia No proof of existence is not proof of non-existence. (Physicist: Stanton T. Friedman on Debunking Ufology) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Unified DB Query function
Casy, try php.weblogs.com ADODB. It is a database abstraction layer that supports Sybase. (Among other db backends.) HTH, =C= * * Cal Evans * Journeyman Programmer * Techno-Mage * http://www.calevans.com * -Original Message- From: Casey Allen Shobe [mailto:[EMAIL PROTECTED]] Sent: Monday, July 01, 2002 3:04 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Re: Unified DB Query function On Monday 01 July 2002 01:55 pm, Manuel Lemos wrote: Why do you re-invent the wheeel and don't you use a database abstraction package that handles the database differences of you, like for instance Metabase. Because I had never heard of it. It doesn't appear to have a sybase module anyways, and they appear to be separate classes for each database, whereas I wanted one for all. Perhaps however I am misreading the site, but it won't let me very far without a username and password. -- Casey Allen Shobe / Network Security Analyst PHP Developer SecureWorks, Inc. / 404.327.6339 x169 / Fax: 404.728.0144 [EMAIL PROTECTED] / http://www.secureworks.net Content is my own and does not necessarily represent my company. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] how to create a graph from a db?
never done it myself but look into the png/jpg routines built into PHP. You can use them to dynamically create an image. What you DO with the image is up to you. :) Seriously, there are some tutorials out there about this very topic. hit phpbuilder.com or google.com to find them. =C= * * Cal Evans * Journeyman Programmer * Techno-Mage * http://www.calevans.com * -Original Message- From: Chris Payne [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 05, 2002 12:01 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] how to create a graph from a db? Hi there everyone, I have a db and the last column is id2 this adds a 1 everytime a banner is clicked so that I can track which banners are being clicked the most that works great, no problems but how can I get the result out as a chart on the screen? Id like to list the 5 most popular banners on the screen, that I can do, but how do I display the numbers as images in a chart? Any help would REALLY be appreciated. Thanks Chris Payne --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.368 / Virus Database: 204 - Release Date: 5/29/2002 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Check Boxes
I usually store the value as a 0 (unchecked) or a 1(checked) in a char(1) field. Then, in populating the form my input has something like ?PHP echo (fieldname==1?' CHECKED ':'';? There are other ways of doing it. (Warning, I'm not actually LOOKING at my code at the moment so YMMV.) HTH, =C= * * Cal Evans * Journeyman Programmer * Techno-Mage * http://www.calevans.com * -Original Message- From: Julio Cuz, Jr. [mailto:[EMAIL PROTECTED]] Sent: Monday, April 29, 2002 10:33 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-DB] Check Boxes Hi-- Does anyone have any suggestions, SAMPLES, or ideas on how to STORE, RETRIEVE, AND PROCESS values for Check Boxes w/PHP Postgresql? Thanks! Julio Cuz, Jr. Riverside Community College [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Keeping autoincrement ID 2 digits. Possible?
Not within the construct of auto_increment. You could , however write your own Serial Assigned Key (SAK) routine in PHP to enforce these business rules. =C= * * Cal Evans * Journeyman Programmer * Techno-Mage * http://www.calevans.com * -Original Message- From: Andy [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 28, 2002 5:21 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Keeping autoincrement ID 2 digits. Possible? Hi there, I am wondering if it would be possible to have a autoincrement field which is only 2 digits long. The idea is, that as soon as 99 is reached the next value will be a free one withing 0-99. E.g. A forum has not more than 99 different forums. So lets say we will keep the ID 2 digits. Forums can be deleted and created by the admin. As soon as one is deleted, there is an empty number. E.g. 5 So we reach 99 and the next number should be not 100 but 5! I did set the type of the field to int(2), but it does not change anything. Still 100. Has anybody a good idea? Thanx Andy PS: if somebody is wondering why 2 digits... I am passing this value like that : viewforum/01.html -- 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] classes and sessions
Yes. You can create your class, instantiate it and store it in the session like any other variable. However. before you issue a Session_start() you MUST have already included the class definition in your page. If you start the session and have not, it will throw an error because it will not know how to use your class. Am I making sense? (I don't think the coffee has kicked in yet.) Cal http://www.calevans.com -Original Message- From: Steve Brett [mailto:[EMAIL PROTECTED]] Sent: Monday, March 26, 2001 6:59 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] classes and sessions hi, i'm busily rewriting an exisitng calendar system that is in use at work. we're using UML as a design tool and hope to have an OO version of the system we have at the minute that wil 'fit in' with future devs. our system at the moment makes heavy use of postgresql and i am hoping to populate various object from the data in the db. our system also relies on session for passing data between pages and the site as a whole. what i need to know is this in a kind of yes or no fashion: will php allow me to create a class and then have access to the class from other pages and scripts ? Steve Brett Internal Development EMIS Ltd. "Privileged and /or Confidential information may be contained in this message. If you are not the original addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, please delete this message, and notify us immediately. Opinions, conclusions and other information expressed in this message are not given or endorsed by my firm or employer unless otherwise indicated by an authorised representative independently of this message." Egton Medical Information Systems Limited. Registered in England. No 2117205. Registered Office: Park House Mews, 77 Back Lane, Off Broadway, Horsforth, Leeds, LS18 4RF -- 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] reading a URL...
Try: $sqlStatement = "Select * from newStories where id = ".$GLOBALS['HTTP_GET_VARS']['id']. " order by whateverValue"; Then execute that statement. The value ID that you passed in on the URL is stored in the associative array $HTTP_GET_VARS. Check the manual at www.php.net, there's a section on variables and it has a list of re-defined variables. HTH, Cal http://www.calevans.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Monday, March 26, 2001 8:26 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-DB] reading a URL... 'ello, Is it Possible, in PHP to read a URL? What I am trying to do is this... I have many news stories in a database, and a single static news page, that calls the story, and the corresponding headline. I have looked about on-line, and seen a common URL,... http://www.arandomsite.com/news_story.php?id=123 I have adopted this method, and it only displays the top most story in my database, no matter what news ID I use. Can I get the ID number from the URL?, and then pass that to the SQL statement? I cannot find a tutorial or similar on-line anywhere. Hope you can help, Tris... P.S, after getting this all set up, my boss asked me to turn everything into .jsp pages. SO, I am off to buy a "JSP in 20 seconds" Type books, any ideas? ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. ** -- 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] MySQL for Billng Question
Jeff, Check www.freshmeat.net There are a couple of packages out there that already do this. Some of them use MySQL. If nothing else, you can borrow their database schema. Cal http://www.calevans.com -Original Message- From: Jeff Oien [mailto:[EMAIL PROTECTED]] Sent: Monday, March 26, 2001 11:45 AM To: PHP-DB Subject: [PHP-DB] MySQL for Billng Question I want to have a database for my hours for my clients. I want to create a report where it shows only the hours back to the last time I was paid. I have no idea how to go about this. Any help would be appreciated. Jeff Oien PHP start here http://www.webdesigns1.com/php/ -- 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] table 1 to table 2
insert into table2 Select * from table1 where myConditionIsMet; Cal http://www.calevans.com -Original Message- From: Tobe Johnson [mailto:[EMAIL PROTECTED]] Sent: Monday, March 26, 2001 1:41 PM To: PHP-DB Subject: [PHP-DB] table 1 to table 2 Using PHP, I need to run a query against one MySQL database table (table1) and transfer the results into another identical MySQL database table (table2). Am I simply overlooking something simple on how to do this? Can someone give me input or direction on the best way to do this? Thanks in advance Tobe -- 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] delete registers..
Depends on what registers are. If they are people then I would just shoot then and get it over with. :) Seriously, if you mean how do you delete records form a table that are more than a month old (let's say 30 days to make it simply) then you need to have a timestamp field in your table. Then in a nightly sweep, delete from table where today - timestamp_filed30. HTH, Cal http://www.calevans.com -Original Message- From: Romeo Manzur [mailto:[EMAIL PROTECTED]] Sent: Friday, March 23, 2001 9:44 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] delete registers.. How could I automatly delete registers from a table that have a month old??? -- -- Romeo Manzur Web Application Developer iSilicom Av. 27 de Febrero 904-A Desp 1, Centro C.P.:86000 Villahermosa, Tabasco, Mexico Tel.:(52)(9)3-12-4790 -- -- 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] MySQL connection problem - need help from expert
Greetings and Salutations Ian, Somewhere in your code you are going to have a line similar to this: $currentConnection = mysql_connect ($server, $userName,$password) $server is going to be either the name or the IP address of your server $userName is going to be the MySQL user name you use to connect to MySQL $password is going to be the password for your username. an example would be: $currentConnection = mysql_connect ('192.168.0.1', 'foo','bar'); This would create a connection to a MySQL server on 192.168.0.1 for user foo with password bar and store it in $currentConnection for you to use. This assumes that: 1: There IS a MySQL server on 192.168.0.1 2: That it is running on the standard port. (3306?) 3: That [EMAIL PROTECTED] has an account on that server 4: That foo's password is bar. HTH, Cal http://www.calevans.com -Original Message- From: Ian [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 22, 2001 7:50 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] MySQL connection problem - need help from expert Please help me !!! Description :- Server 1 is installed MySQL which located in US. Server 2 is located in Singapore, and doesn't install Mysql. Both of them are installed PHP and Acaphe. Case:- I would like to set the server 2 connect to Server 1's MySQL database. What should I do? Thank you in advance. Ian. -- 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 on modifications / subscribe / unsubscribe script
I'll take the easy one... #3: instead of: input type="TEXT" name="password" use input type="PASSWORD" name="password" Cal http://www.calevans.com -Original Message- From: Marc Bragg [mailto:[EMAIL PROTECTED]] Sent: Saturday, March 10, 2001 11:46 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] help on modifications / subscribe / unsubscribe script Am using the following subscribe/unsubscribe script with great success, but it does not have all the functionality I would like. Any one have any ideas on how to: 1. open in a java window, and once info is put, and person is subscribed, java window closes and a selected http page comes up? 2. compare information submitted in this table, with same variable in another table, and if data is not there, then include it? 3. make the password show up as * characters in the browser rather than the lettters typed by user, and add a portion of script to compare to what is in database, and if there, is it correct. 4. how to add minute and seconds to date stamp. Thanx Marc ?php // connect to db $db = mysql_connect("x","yyy") or die ("Couldn't connect."); mysql_select_db("law", $db) or die ("Couldn't select db."); // get a date stamp $add_date = date("Y-m-d"); if ($op != "ds") { //they need to subscribe or unsubscribe $text_block = " form name=\"form\" method=post action =\"subscribe.phtml\" input type=hidden name=op value =ds pstrongEnter Your e-Mail Address. This will be your User Name:/strongbr input type=text name=\"email\" size=25/p pstrongEnter a Password./strongbr input type=text name=\"password\" size=25/p pstrongClick your selection:/strongbr input type=radio name=\"action\" value=\"sub\" checked Subscribe input type=radio name=\"action\" value=\"unsub\" Unsubscribe/p pinput type=submit name=\"submit\" value=\"Subscribe / Unsubscribe Now\"/p /form "; } else if (($op == "ds") ($action == "sub")) { // check they're not already subscribed // then subscribe them or return message $check = "select email from subscribe where email = \"$email\""; $check_result = mysql_query($check) or die("Can't execute check email address."); $check_num = mysql_num_rows($check_result); if ($check_num == 0) { // if $check_num is 0, then no match was found, // and the user should be subscribed $sql = "insert into subscribe (email, password, add_date, sub_id) values(\"$email\", \"$password\", \"$ add_date\", \"\")"; @mysql_query($sql) or die ("Couldn't insert email."); $text_block = " ph1centerfont color=greenThanks for Joining Bid Attorney!/h1/center/font/p "; } else { // if $check_num is not 0, then the user is // already subscribed, and let them know it. $text_block = " pfont color=greenbYou are already a member of Bid Attorney. Thank you!/b/font/p "; } } else if (($op == "ds") ($action == "unsub")) { // check they're already subscribed, // then unsubscribe them or return message. $check = "select email from subscribe where email = \"$email\""; $check_result = mysql_query($check) or die("Can't execute check e-mail address."); $check_num = mysql_num_rows($check_result); if ($check_num == 0) { // if $check_num is 0, then no match is found, // and the user cannot be unsubscribed $text_block = " pfont color=redbCouldn't find your e-mail / user name on the list./b/font/p piYou haven't been unsubscribed because the e-Mail you entered is not in the database./i"; } else { // if $check_num is not 0, then the user is on the list, so can be unsubscribed. $sql = "delete from subscribe where email = \"$email\""; @mysql_query($sql) or die ("Couldn't delete email."); $text_block = " pfont color=blackb You are unsubscribed from the Bid Attorney Database!i Hope to see you back s oon!/i/b/font/p "; } } ? html head titleForm: Join the Bid Attorney Database / username - password/title /head body h1font color=bluecenterUse this Form to Subscribe / Unsubscribebr to the brBid Attorney Database./ce nter/font/h1 ?php echo "$text_block"; ? /body /html -- 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] my sql text query
Nope, you change the field to not null then it won't allow null values in the database. Since the data already has null values, the Alter Table would probably fail. I'm still trying to figure out what any of this has to do with an index? Do you have an index on this description field? Cal http://www.calevans.com -Original Message- From: Phil Driscoll [mailto:[EMAIL PROTECTED]] Sent: Friday, March 09, 2001 7:59 AM To: Steve Brett; [EMAIL PROTECTED] Subject: Re: [PHP-DB] my sql text query Good heavens, another PHP developer in Leeds:) I think (I haven't tried this!) you could change the field type to not-null - then your array should get populated with empty strings for any records where this field is not set. Cheers -- Phil Driscoll Dial Solutions +44 (0)113 294 5112 http://www.dialsolutions.com http://www.dtonline.org -- 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] using ID
Ohh, Ohh, OOHH! [waving hand wildly in the air] :) Because primary key should always be system generated and not a value that the user ever sees, can modify, or that means anything to anyone other than the system. usernames can change. PK's should never change. In this case, if username is to be unique then it would be considered a Candidate Key. (Would have been the Primary Key if it were not for the hanging Chads!) :) Cal http://www.calevans.com -Original Message- From: JJeffman [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 07, 2001 2:14 PM To: Brandon Feldhahn; [EMAIL PROTECTED] Subject: Re: [PHP-DB] using ID What for you need a ID if you have already the username which I guess may a unique key ? HTH. Jayme. http://www.conex.com.br/jjeffman -Mensagem Original- De: Brandon Feldhahn [EMAIL PROTECTED] Para: [EMAIL PROTECTED] Enviada em: segunda-feira, 5 de fevereiro de 2001 22:00 Assunto: [PHP-DB] using ID When i make a table with four field (id, name, username, and password) what do i do with the i id, how do i make it assign to each password? -- 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]