RE: [PHP-DB] write to word..
Better still, Take a look at RTF as a file format. Its readable in Word, looks like a Word doc and can be saved with a '.doc' extension and you can store placeholders that php can use to 'mail-merge' with. Works for me. Cheers George -Original Message- From: Peter Lovatt [mailto:[EMAIL PROTECTED] Sent: 23 July 2003 9:04 am To: Chris Mach; [EMAIL PROTECTED] Subject: RE: [PHP-DB] write to word.. Hi I did it like this ?php //create file here //then output it header (Content-type: application/msword); header (Content-Disposition: attachment; filename=letter.doc); include('letter.htm'); print('done it') ? I wrote the letter to file and then included it, but you can probably just print HTML as you would normally. Word will open HTML files and maintain the format. HTH Peter -Original Message- From: Chris Mach [mailto:[EMAIL PROTECTED] Sent: 23 July 2003 03:01 To: [EMAIL PROTECTED] Subject: [PHP-DB] write to word.. hi, I'm just wondering if it is possible to write to a word document or any other file type that would allow for easy editing(besides txt) with out having to copy and past everything in? I'm looking to have a template perhaps in word and have the code insert variables from the database. If it is possible, could some one point me in the right direction. Like where to look in the manual. Thanks, Chris -- 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-DB] odbc going nuts
Hi all, Just finishing off a site using odbc and Access and it's thrown up a problem that wasn't there yesterday. I have a simple login with a username and password. If either are blank, the user gets bumped to the login page. otherwise the user table is searched for the username and password. my code looks like: $strSQL = select * from user where (Username='$username' and Paswd='$paswd'); I have an error script that kicks in if the query fails, and prints the query to screen. I've pasted the query straight into Access' SQL query window and it worked fine. I just can't see anything wrong with the code, or anything else. Any suggestions (apart from dropping Access in favour of another db - client choice) Cheers George in Oxford -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: odbc going nuts
Pete, Thanks for the tip. I do use $_REQUEST[] and then convert to variables. I moved my code to another machine and it was OK, so I've narrowed it down to a MS upgrade! Obviously tinkered with something. George -Original Message- From: Pete Morganic [mailto:[EMAIL PROTECTED] Sent: 04 July 2003 1:56 pm To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: odbc going nuts Are registed globals off, otherwise u name to change $username to $_POST['username'] Any suggestions (apart from dropping Access in favour of another db - client choice) Oh dear.. Access is a real pain in the butt and we now NEVER deal with a client that selects Access. Never had any complaints since. suggestions - mysql - postgresql - Firebird ... Pete George Pitcher wrote: Hi all, Just finishing off a site using odbc and Access and it's thrown up a problem that wasn't there yesterday. I have a simple login with a username and password. If either are blank, the user gets bumped to the login page. otherwise the user table is searched for the username and password. my code looks like: $strSQL = select * from user where (Username='$username' and Paswd='$paswd'); I have an error script that kicks in if the query fails, and prints the query to screen. I've pasted the query straight into Access' SQL query window and it worked fine. I just can't see anything wrong with the code, or anything else. Any suggestions (apart from dropping Access in favour of another db - client choice) Cheers George in Oxford -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ODBC equiv for mysql_insert_id
Hi, I am connecting to MySQL (4.1) using ODBC (I have my reasons) and am looking for an equivalent to the mysql_insert_id() function so that I can get the ID of the record just created. Cheers George -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Now, how about Roman Numerals?
That's great, but what about the reverse: Roman to Arabic? George in Oxford -Original Message- From: nabil [mailto:[EMAIL PROTECTED] Sent: 11 June 2003 9:26 am To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: Now, how about Roman Numerals? That's is wonderfull Hugh.. Nabil Hugh Bothwell [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] David Shugarts [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Second poser today: How to use either a MySQL select statement or PHP to produce a roman numeral, starting from an arabic (INT) number in a database? In PHP: function RomanDigit($dig, $one, $five, $ten) { switch($dig) { case 0:return ; case 1:return $one; case 2:return $one$one; case 3:return $one$one$one; case 4:return $one$five; case 5:return $five; case 6:return $five$one; case 7:return $five$one$one; case 8:return $five$one$one$one; case 9:return $one$ten; } } function IntToRoman($num) { if (($num 1) || ($num 3999)) return(No corresponding Roman number!); $m = $num / 1000; $c = ($num % 1000) / 100; $x = ($num % 100) / 10; $i = $num % 10; return( RomanDigit($m, 'M', '', '') .RomanDigit($c, 'C', 'D', 'M') .RomanDigit($x, 'X', 'L', 'C') .RomanDigit($i, 'I', 'V', 'X') ); } -- Hugh Bothwell [EMAIL PROTECTED] Kingston ON Canada v3.1 GCS/E/AT d- s+: a- C+++ L+$ P+ E- W+++$ N++ K? w++ M PS+ PE++ Y+ PGP+ t-- 5++ !X R+ tv b DI+++ D-(++) G+ e(++) h-- r- y+ -- 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] ODBC and error management
Nico, I'm using MyODBC to query MySQL (because my client want's it to work in Access, and I don't and this leaves the least amount of code to change). I don't get an error message if the result is empty (no records). I do a while loop and add to a counter and if the counter 1 then its empty otherwise I display the results. I do get the errors though when the query is 'bad' - contains errors. I'm running mine on both WinNT and Win2K with identical results. Hope this helps. George -Original Message- From: Nico Sabbi [mailto:[EMAIL PROTECTED] Sent: 10 June 2003 12:01 pm To: [EMAIL PROTECTED] Subject: [PHP-DB] ODBC and error management Hi, reading both the documentation and the MARC I found two serious misbehaviours: 1) it seems that it's impossible to tell a query that is correct but has no records from a query which is syntactically wrong (and consequently has no records); or at least it seems to be impossibile to distinguish these two cases without using odbc_num_rows, which is buggy itself (because it loses in generality, so can't be used). 2) when using myodbc the string returned by odbc_errormsg() is always non-sense: it doesn't contain the real error msg returned by the db-server, but unixODBC][MySQL][ODBC 3.51 Driver][mysqld-3.23.56-Max-log]Option value changed to default static cursor that obviously doesn't say anything useful. Is there a way to workaround, or even better to solve, these problems? Thanks, Nico -- 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] session and header(location....)
Lars, I'm not sure if this is related (possibly), but I has similar problems with cookies. I doiscovered that the cookie was only being set if the page that set it actually produced HTML. By redirecting, you cut out the HTML-writing. Why not redirect the user if the test fails instead. HTH George -Original Message- From: Lars Rasmussen [mailto:[EMAIL PROTECTED] Sent: 12 March 2003 3:40 pm To: [EMAIL PROTECTED] Subject: [PHP-DB] session and header(location) Hi everyone, Thanks for looking at my question! Well, i just made a script that firstly check's up username and password (log-in script) then next if the user enteret the correct information a session is set like this: session_id($sessid); session_start(); $_SESSION['ngskdsngjkla465gfdh'] = LOGETIN-TRUE; But then when this session is set it changes from the log in page to the real password-protected page. I tried with a normal header location, but it did'nt work, so i tried to look at php.net about sessions, it says that you're had to transfer the sessionid to the next page. Now i'm trying that, but it just wount work... The header location im using looks like this: header(Location: http://www.domain.tld/admin/index.php?PHPSESSID=.sessid); And i also tried with: header(Location: http://www.domain.tld/admin/index.php?PHPSESSID=.$sessid); But none of them will worki hope you will look at it, and tell me if you have a solution. Thanks folks. Regards. Lars Rasmussen -- 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] Query Help...
Scott, 'Group' is a reserved word so you can't use it for a column name. try changing it to 'groups' or soething else that makes sense but is safe. George -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] Sent: 10 March 2003 5:24 pm To: '[EMAIL PROTECTED]' Subject: [PHP-DB] Query Help... I am having a lot of trouble with a query that works fine from a basic SQL command line, but fails in my web script. Here is the portion of code including the query: mysql_select_db($database, $Prod); $query_groups = SELECT name FROM group; $groups = mysql_query($query_groups, $Prod) or die(mysql_error()); Here is the error I am receiving: You have an error in your SQL syntax near 'group' at line 1 I am wondering if for some reason group is trying to be interperetted as the GROUP BY MySQL function? I am running PHP 4.2.3 against a MySQL DB on an Apache 1.3.27 server. Thanks in advance for the help. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- 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] Checkboxes to gather rows to delete
Hi all, Can I raise a point of principle here. My databases never have records deleted - instead they are marked as being deleted in a status field. That way, they are always there for reference. Unless you are running a system that needs the space or has extremely high turnover of deleted records, this makes sesne. Just my 2c. George in Oxford -Original Message- From: Mathieu Dumoulin [mailto:[EMAIL PROTECTED] Sent: 24 February 2003 3:49 pm To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Checkboxes to gather rows to delete It is wrong to use that way of doing it John, cause this will delete ALL lines that where printed with a checkbox And also, if you are using a old version of PHP with register globals OFF, the _POST array will not be available Mathieu Dumoulin 1lt John W. Holmes [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] I have a mysql database with a table using one column as a primary key. (rowID). On a php page I use a query to list all of the rows of the table and have a checkbox beside each row that should be used to check if you would like to delete this row. Can someone give me an example using post to pull the boxes that need to be deleted. Easy one.. :) Make sure your checkboxes have the rowID as their value, then you can simply do this: $query = DELETE FROM table WHERE rowID IN ( . implode(',',$_POST['checkboxes']) . ); and run that query. You'll end up with something that looks like this: DELETE FROM table WHERE rowID IN (1,2,3,4,5) where the numbers will come from only the checkboxes that you selected. ---John Holmes... -- 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] BinaryWrite in PHP?
Stefan, This works for me. Some of my users (and me on some PCs) get a message alerting them about an Active-X component, but if you ignore it, it has no affect, ?php $fpd = path2file . $fp . .pdf; $len = filesize($fpd); header(Content-Type: application/pdf); // change to suit your file type header(Content-Disposition: inline; filename=$fpd); header(Content-Title: $fpd); header(Content-Length: $len); readfile($fpd); ? George -Original Message- From: Ohlson Stefan [mailto:[EMAIL PROTECTED]] Sent: 12 February 2003 10:05 am To: [EMAIL PROTECTED] Subject: [PHP-DB] BinaryWrite in PHP? Hi! I want to let the user to be able to open or save a textdocument with text that I create on the fly with some select-statements. You know when you click on a button or a link and you get a question if you what to Open the file or or Save it. In ASP I can use Response.BinaryWrite, how can I do it in PHP? 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] Code for drop down lists
If the list is something that may change more than just coccasionally, then use the database field value. If its going to be really static, then hard code it into the web form. Now the code: ?php $drop_down_list = select name=HEI_ID; $link = mysql_connect ('localhost', 'user', 'password') // Connects to database server or die (Could not select db); mysql_select_db ('Heronsql') // opens database or die (Could not connect); $query=select distinct Nickname, HEI_ID from Customers where (Nickname '') order by Nickname; // sets up the find $result = mysql_query ($query); // runs the find $num = mysql_num_rows($result); //goes thru each row building the display for ($i = 0; $i $num; $i++) { $HEI = mysql_result($result, $i, Nickname); $HEI_ID = mysql_result($result, $i, HEI_ID); $drop_down_list .= option value=$HEI_ID$HEI/option; } mysql_close($link); $drop_down_list .= /select; echo $drop_down_list; // prints the display ? This works for me on both Linux and Win servers. Cheers George -Original Message- From: Roland Perez [mailto:[EMAIL PROTECTED]] Sent: 11 February 2003 5:03 pm To: Receipt Notification Requested Subject: [PHP-DB] Code for drop down lists I am a novice to PHP and am trying toget a survey with drop down lists. I am stuck as to if I should connect to the DB (MySQL DB) to get the values from a table or do I imbed them in the php file? Thanks for any help in advance. Roland Perez [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
[PHP-DB] Inserting URL into table
Hi, I'm trying to insert a URL into a char field. MySQLFront punts out this error with my compiled query: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '','Yahoo mail','httpNULL/www.yahoo.co.uk/')' Well there's nothing helpful in the MySQL Manual so can someone point me in the right direction. I am expecting that some form of encoding should take place - but which one? Cheers George in Oxford === George Pitcher HERON Technical Manager Ingenta plc 23-38 Hythe Bridge Street, Oxford, OX1 2ET T +44 (0)1865 799137 direct T +44 (0)1865 799000 switchboard F +44 (0)1865 799134 E [EMAIL PROTECTED] www.ingenta.com Ingenta: Empowering the exchange of academic and professional content online. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Inserting URL into table - SOLVED
Well, all I can say is Doh! as Homer would put it! Somehow when I created my table, the link_url field was set is INT with a length of 3! Changing it to a much longer char field sorted it. Cheers George -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] More linking problems but slightly OT
Hi, Now that I can store - and rebuild my link (URL), I'm having a problem displaying them. The links are being displayed into a frame and the link is being prefixed with the default url for the frameset. Does anyone know how I can get rid of the prefix? Cheers George === George Pitcher HERON Technical Manager Ingenta plc 23-38 Hythe Bridge Street, Oxford, OX1 2ET T +44 (0)1865 799137 direct T +44 (0)1865 799000 switchboard F +44 (0)1865 799134 E [EMAIL PROTECTED] www.ingenta.com Ingenta: Empowering the exchange of academic and professional content online. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] More linking problems but slightly OT
RE: [PHP-DB] More linking problems but slightly OTgary, Thanks, I'd just found that worked. Cheers George -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 19 December 2002 5:32 pm To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP-DB] More linking problems but slightly OT Be sure to add http:// to the beginning of your URL, or the browser thinks it is a local URL Gary Every Sr. UNIX Administrator Ingram Entertainment (615) 287-4876 Pay It Forward mailto:[EMAIL PROTECTED] http://accessingram.com -Original Message- From: George Pitcher [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 19, 2002 11:12 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] More linking problems but slightly OT Hi, Now that I can store - and rebuild my link (URL), I'm having a problem displaying them. The links are being displayed into a frame and the link is being prefixed with the default url for the frameset. Does anyone know how I can get rid of the prefix? Cheers George === George Pitcher HERON Technical Manager Ingenta plc 23-38 Hythe Bridge Street, Oxford, OX1 2ET T +44 (0)1865 799137 direct T +44 (0)1865 799000 switchboard F +44 (0)1865 799134 E [EMAIL PROTECTED] www.ingenta.com Ingenta: Empowering the exchange of academic and professional content online. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Dumping MySQL rows into a 2D array
Hi all, I want to grab the resul from a db query and store it in an array so that I can selectively grab the data later. This is what I'm doing: $dbRowCount = mysql_num_rows( $result ); for ($i = 1; $i = $dbRowCount; ++$i) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $dbRow['ev_id']= $row[id]; $dbRow['ev_uid'] = $row[user_id]; $dbRow['ev_title'] = $row[name]; $dbRow['ev_cat'] = $row[category]; $dbRow['ev_sd']= $row[start_day]; $dbRow['ev_ed']= $row[end_day]; } } In my sample database, I have two records which are both found with the query (tested in MySQLFront) but the array ends up with 3 rows each with the last record in it. Any suggestions? George === George Pitcher HERON Technical Manager Ingenta plc 23-38 Hythe Bridge Street, Oxford, OX1 2ET T +44 (0)1865 799137 direct T +44 (0)1865 799000 switchboard F +44 (0)1865 799134 E [EMAIL PROTECTED] www.ingenta.com Ingenta: Empowering the exchange of academic and professional content online. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Dumping MySQL rows into a 2D array
Bastian, That's great - it does the trick perfectly. Many thanks. George -Original Message- From: Bastian Vogt [mailto:[EMAIL PROTECTED]] Sent: 13 December 2002 3:18 pm To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: Dumping MySQL rows into a 2D array Hi, first leave out the loop with for ($i...). then use the loop with while and make sure that you create arrays. you're currently filling the same variables with different results each time. the last one always overwrites the ones bevor. so add those brackets: []: $dbRow['ev_id'][]= $row[id]; $dbRow['ev_uid'][] = $row[user_id]; HTH, Bastian George Pitcher schrieb: Hi all, I want to grab the resul from a db query and store it in an array so that I can selectively grab the data later. This is what I'm doing: $dbRowCount = mysql_num_rows( $result ); for ($i = 1; $i = $dbRowCount; ++$i) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $dbRow['ev_id']= $row[id]; $dbRow['ev_uid'] = $row[user_id]; $dbRow['ev_title'] = $row[name]; $dbRow['ev_cat'] = $row[category]; $dbRow['ev_sd']= $row[start_day]; $dbRow['ev_ed']= $row[end_day]; } } In my sample database, I have two records which are both found with the query (tested in MySQLFront) but the array ends up with 3 rows each with the last record in it. Any suggestions? George === George Pitcher HERON Technical Manager Ingenta plc 23-38 Hythe Bridge Street, Oxford, OX1 2ET T +44 (0)1865 799137 direct T +44 (0)1865 799000 switchboard F +44 (0)1865 799134 E [EMAIL PROTECTED] www.ingenta.com Ingenta: Empowering the exchange of academic and professional content online. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Oracle9i and PHP
Hi, Can anyone point me in the direction of resources on PHP and Oracle9i (Win2K). I have the db installed on my laptop, on which I already have PHP running with IIS5 and would like to use PHP with Oracle. Any tips (even if it's a 'waste of effort' type) would be welcome. George in Oxford === George Pitcher HERON Technical Manager Ingenta plc 23-38 Hythe Bridge Street, Oxford, OX1 2ET T +44 (0)1865 799137 direct T +44 (0)1865 799000 switchboard F +44 (0)1865 799134 E [EMAIL PROTECTED] www.ingenta.com Ingenta: Empowering the exchange of academic and professional content online. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Microsoft Access PHP
Just a thought. Try putting quotes around the 'True'. George (no expert - not even a novice - yet) - Original Message - From: Daniel J Owen-Mcgee [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 04, 2002 2:29 PM Subject: [PHP-DB] Microsoft Access PHP Hi, I'm gleaning microsoft SQL from queries within a MS Access database, for insertion into my PHP pages. This has been working fine but the example below just refuses to work, SELECT ExamPapers.EPaperID, ExamPapers.EPapersText, ExamPapers.[Title of Paper], ExamPapers.Course, ExamPapers.School, ExamPapers.Year, ExamPapers.[Jan/Summer], ExamPapers.[Module Code], ExamPapers.Stage, ExamPapers.[Storage Location], ExamPapers.[Add to Webpage] FROM ExamPapers WHERE (((ExamPapers.School)=Colour and Imaging Institute) AND ((ExamPapers.[Add to Webpage])=True)); I want to pull records from 1 table (ExamPapers). The WHERE line is causing problems i.e if I remove it, my php pages actually show. Can anyone see what I'm doing wrong? Thanks, Daniel Owen-McGee -- 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 a small script
Suman, Firstly, it's a bit longer than necessary. Make your form a 'POST' rather than 'GET' and you'll hide your query and ?php echo $fname; ? will then be the equivalent. I presume that you have been able to display other PHP stuff? Check your php.ini file and make sure that the part that allows you to use the short ? rather than having to always use ?php is enabled. George - Original Message - From: suman [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, June 10, 2002 10:43 PM Subject: [PHP-DB] problem with a small script hi i can't understand whats missing here.thou i knew this ques is asked many times i couldn't find an ans for it. - form method=get action=stuinfo.php firstname: input type=text name=fname size=15 this is te html scrript and the php code is ? $fname=$_GET['fname']; echo $fname; ? --- but on executing this i get a blank page what might be the error suman -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Complicated query on very simple database - pointers sought
Hi all, I want to report some figures to my colleagues. My database (2 fields: Customer, Order date) contains over 15000 records dating back to 1999. I want to be able to show, in a web page, the following information Month Customers placing orders Orders placed Average Orders/Cust Average over prev 12 months. My work with MySQL has never been this detailed. Can anyone give me any pointers? Regards George in Edinburgh -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] csv without line feed
Something I used to do about 17-18 years ago to analyse typeseting code was to use DOS's 'Debug'. It gave a hex value for each character in one panel while scrolling thru the file. Compare this against the Excel printout and you should find what code is being used for lf. Hoping that debug is still available from the C: prompt? George - Original Message - From: Sommai Fongnamthip [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 28, 2002 8:53 AM Subject: [PHP-DB] csv without line feed Hi, I have text file with CSV like format (use # sign separate each field) but there did not have any end of line character. This file could open in m$ excel but if I opened it in any text editor it will display in 1 line. How could I handle this file in PHP code? let see the example it attach file. Sommai Fongnamthip. -- 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: PHP/Access problem
Adam, Thanks for the assist. The query works fine without the ( ) arount the conditions. Now on to the next part. George - Original Message - From: Adam Royle [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, March 26, 2002 10:03 PM Subject: [PHP-DB] Re: PHP/Access problem SELECT * FROM 'Documents'WHERE (CourseRef='4712' AND Valid_From=#26/03/2002# AND Valid_Until=#26/03/2002#) Order by Author,Title should be SELECT * FROM Documents WHERE (CourseRef='4712' AND Valid_From=#26/03/2002# AND Valid_Until=#26/03/2002#) Order by Author,Title your table name should not hae single quotes around it... adam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] variation on(Speed Up Code?)
Hi all, One of the pages in my site takes up to 10 seconds to display (depending on number of records (30 records takes 10 secs). The cause of the problem is the amount of information I am displaying for each record. I do multiple queries for each record to find out different things such as its position in the workflow, its price, etc. None of these are stored in the db, but are calculated on the fly depending on the data held. Apart from storing the result in the db can anyone point me in the direction of some efficient handling routines? Code is available if anyone wants bloat-mail! MTIA George in Edinburgh -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] PHP/Access problem
Hi, I'm working on a small Access 2000-based project and I'm getting a SQL Error . This is the query (built in PHP): SELECT * FROM 'Documents'WHERE (CourseRef='4712' AND Valid_From=#26/03/2002# AND Valid_Until=#26/03/2002#) Order by Author,Title Any clues or pointers? George -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Conflicting results using PHP/Mysql
Doug, Sorry for leaving this so long but I've been tied up in business meetings. It may be that my query is restricting the data retrieval but I cannot see how. If I look at the data I am playing with, I have 3 tables and I want to show transactions from a certain course. I also want to show related information from the bib_extract table and the scanrates (prices) table. I've checked the data in these tables and nothing is odd. Maybe there is a different way to build my query so that it displays the full set of records. Any suggestions? George - Original Message - From: Doug Thompson [EMAIL PROTECTED] To: George Pitcher [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, March 13, 2002 5:59 PM Subject: Re: Conflicting results using PHP/Mysql I would guess it's because only three records match the ANDed tests in the WHERE clause (last 3 lines). Isn't that what you intended? Doug On Wed, 13 Mar 2002 16:08:43 -, George Pitcher wrote: Hi all, Posted this yesterday and got no response. Trying again today. I'm having a small problem with a biggish query. The query: $Itemlistquery= select [a whole load of fields from 3 tables] ending with ; $Itemlistquery.= transactions.Pdownload ; $Itemlistquery.= from bib_extract,scanrates,transactions where ; $Itemlistquery.= (transactions.CourseID = '$Course_ID' and ; $Itemlistquery.= bib_extract.E_ID=transactions.ExtractID and ; $Itemlistquery.= scanrates.finrate=transactions.finrate) ; The problem: If I do a simple count of transactions.CourseID='$Course_ID' I get 18 (for a particular course) and the above query only displays 3 results. Any suggestions? I didn't want to clog the list with the whole query but I can if it's necessary. George, in Edinburgh - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Conflicting results using PHP/Mysql
Thanks to Kevin, who yesterday emailed me with a solution to my JOIN problem. Thanks to all who helped me see the wood for the trees. George - Original Message - From: Doug Thompson [EMAIL PROTECTED] To: George Pitcher [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, March 18, 2002 9:20 PM Subject: Re: Conflicting results using PHP/Mysql Your base table is transactions. I assume you want to do a LEFT JOIN. I think you might see an improvement if transactions were consistently named on the left side of the equalities as: $Itemlistquery.= transactions.Pdownload ; $Itemlistquery.= from bib_extract,scanrates,transactions where ; $Itemlistquery.= (transactions.CourseID = '$Course_ID' and ; $Itemlistquery.= transactions.ExtractID=bib_extract.E_ID and ; $Itemlistquery.= transactions.finrate=scanrates.finrate) ; On Mon, 18 Mar 2002 10:58:02 -, George Pitcher wrote: It may be that my query is restricting the data retrieval but I cannot see how. If I look at the data I am playing with, I have 3 tables and I want to show transactions from a certain course. I also want to show related information from the bib_extract table and the scanrates (prices) table. I've checked the data in these tables and nothing is odd. Maybe there is a different way to build my query so that it displays the full set of records. Any suggestions? George - Original Message - From: Doug Thompson [EMAIL PROTECTED] To: George Pitcher [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, March 13, 2002 5:59 PM Subject: Re: Conflicting results using PHP/Mysql I would guess it's because only three records match the ANDed tests in the WHERE clause (last 3 lines). Isn't that what you intended? Doug On Wed, 13 Mar 2002 16:08:43 -, George Pitcher wrote: Hi all, Posted this yesterday and got no response. Trying again today. I'm having a small problem with a biggish query. The query: $Itemlistquery= select [a whole load of fields from 3 tables] ending with ; $Itemlistquery.= transactions.Pdownload ; $Itemlistquery.= from bib_extract,scanrates,transactions where ; $Itemlistquery.= (transactions.CourseID = '$Course_ID' and ; $Itemlistquery.= bib_extract.E_ID=transactions.ExtractID and ; $Itemlistquery.= scanrates.finrate=transactions.finrate) ; The problem: If I do a simple count of transactions.CourseID='$Course_ID' I get 18 (for a particular course) and the above query only displays 3 results. Any suggestions? I didn't want to clog the list with the whole query but I can if it's necessary. George, in Edinburgh - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Stange 'page-loading' effect
Hi all, I have a part of my development site where the user hits a button, sending a stream of values to a response page. However, on testing, the response page comes up with 'server not found' but when I refresh that error page, it loads the correct page but without any of the transferred values. Any ideas as to where it going wrong? I'm using PHP-4.1.1, Apache (console) on Win 2000Pro. Regards George George Pitcher is Technical Manager for the HERON Project at Napier University, Edinburgh. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Conflicting results using PHP/Mysql
Kevin, Simply, no I'm not sure. To explain fully: I have a web page where a lecturer/librarian can view their reading list. The CourseID holds it together as far as the Course table is concerned and there is also data displayed (or used in calculations from the other two tables which do not necessarily relate just to these records. Hope this clarifies rather than confuses. George - Original Message - From: Kevin Bucknum [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, March 13, 2002 4:17 PM Subject: RE: [PHP-DB] Conflicting results using PHP/Mysql transactions.CourseID='$Course_ID' is not the same as the three part join that you have in that query. Are your sure your other two joins aren't restricting the query? -Original Message- From: George Pitcher [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 13, 2002 10:09 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-DB] Conflicting results using PHP/Mysql Hi all, Posted this yesterday and got no response. Trying again today. I'm having a small problem with a biggish query. The query: $Itemlistquery= select [a whole load of fields from 3 tables] ending with ; $Itemlistquery.= transactions.Pdownload ; $Itemlistquery.= from bib_extract,scanrates,transactions where ; $Itemlistquery.= (transactions.CourseID = '$Course_ID' and ; $Itemlistquery.= bib_extract.E_ID=transactions.ExtractID and ; $Itemlistquery.= scanrates.finrate=transactions.finrate) ; The problem: If I do a simple count of transactions.CourseID='$Course_ID' I get 18 (for a particular course) and the above query only displays 3 results. Any suggestions? I didn't want to clog the list with the whole query but I can if it's necessary. George, in Edinburgh -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Conflicting results using PHP/Mysql
Hi all, Posted this yesterday and got no response. Trying again today. I'm having a small problem with a biggish query. The query: $Itemlistquery= select [a whole load of fields from 3 tables] ending with ; $Itemlistquery.= transactions.Pdownload ; $Itemlistquery.= from bib_extract,scanrates,transactions where ; $Itemlistquery.= (transactions.CourseID = '$Course_ID' and ; $Itemlistquery.= bib_extract.E_ID=transactions.ExtractID and ; $Itemlistquery.= scanrates.finrate=transactions.finrate) ; The problem: If I do a simple count of transactions.CourseID='$Course_ID' I get 18 (for a particular course) and the above query only displays 3 results. Any suggestions? I didn't want to clog the list with the whole query but I can if it's necessary. George, in Edinburgh -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] conflicting result problem with MySQL/php
Hi all, I'm having a small problem with a biggish query. The query: $Itemlistquery= select [a whole load of fields from 3 tables] ending with ; $Itemlistquery.= transactions.Pdownload ; $Itemlistquery.= from bib_extract,scanrates,transactions where ; $Itemlistquery.= (transactions.CourseID = '$Course_ID' and ; $Itemlistquery.= bib_extract.E_ID=transactions.ExtractID and ; $Itemlistquery.= scanrates.finrate=transactions.finrate) ; The problem: If I do a simple count of transactions.CourseID='$Course_ID' I get 18 (for a particular course) and the above query only displays 3 results. Any suggestions? I didn't want to clog the list with the whole query but I can if it's necessary. George, in Edinburgh -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Euro Dates into MySQL
Hi all, I have a site where dates are being displayed and also entered by users. I don't want to offend them by asking them to use the -mm-dd format or to split the date into its constituent parts. I am displaying by using the MySQL Date_Format syntax and that's fine. I get dd/mm/ and I want to be able to have the user enter 'dd/mm'' into a form and have it put into MySQL in the -mm-dd format. Now I have written a function in php to do this but I might be mising an easier, more elegant/efficient way of doing this. Any suggestions? George P, in Edinburgh -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP problem
Bartek, This is snipped from a working form on my site: select name=ASOp option value=cn selectedcontains option value=eqexact match option value=bwbegins with /select and it works. George - Original Message - From: Bartek Pawlik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, February 26, 2002 10:49 AM Subject: Odp: [PHP-DB] PHP problem Unfortunately, it doesn't work, the same situation Sorry to be a little bit off topic i have code that generates: OPTION LABEL=1LONG TEXT 1 use: option value=1long text 1/option mvgr, Joffrey van Wageningen -- .-[ Joffrey van Wageningen | WoLFjuh | [EMAIL PROTECTED] ]-- | Networking Event 2000 - www.ne2000.nl - IRCnet:#ne2000, Undernet:#clue | PGP:1024D/C6BA5863 - 3B93 52D3 CB91 9CB7 C50D FA79 865F 628A C6BA 5863 | * We demand guaranteed rigidly defined areas of doubt and uncertainty. | -- Douglas Adams -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Okresl Swoje potrzeby - my znajdziemy oferte za Ciebie! [ http://oferty.onet.pl ] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Problem displaying dates
Hi all, I've just moved my MySQL db and php scripts over from W2K to Linux and for some reason my dates are coming across as '-00-00' even though, viewing the db in MySQLFront, they look fine (actual dates). When I hosted this on Win2K it worked fine. I use a function to convert the date format from '-00-00' to 'dd/mm'' but have tried displaying the dates with and without the use of this function with no success. Any suggestions? George in Edinburgh -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem connecting to db on Linux
Greg, et al, This is the contents of the include file: ?php $link = mysql_connect ('localhost', 'root', '*') or die (Could not select db); mysql_select_db ('Heronsql') or die (Could not connect); ? I have also tried it with the following: ?php $link = mysql_connect ('localhost', 'root', '*'); echo mysql_errno().: .mysql_error().BR; mysql_select_db ('Heronsql'); echo mysql_errno().: .mysql_error().BR; ? Te results for this were: 0:0 0:0 I have reinstalled my Mandrake (MySQL/PHP4.0.6/Apache) and I am about to retest so I'll report back soon. George - Original Message - From: Greg Donald [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 18, 2002 2:08 PM Subject: Re: [PHP-DB] Problem connecting to db on Linux I've been working with PHP/MySQL on Win NT and Win 2000 for a few weeks. I've now set up a Linux machine (Mandrake 8.1 on Dell laptop) and have moved my files across. I use an include file which logs on to the MySQL server and then connects to the database. It performs the login ok but not the select db part. I tried creating a db using a php script and then selecting it and got the same problem. I'm new on Linux so it might be something in the configuration which needs working on. Any suggestions? Well, if you had posted some code, someone might have seen the error... :( Anyway, here is how i do it: if($db = mysql_pconnect($dbhost, $dbuser, $dbpasswd)){ mysql_select_db($dbname, $db); } else { echo mysql_error(); exit; } Greg Donald - http://destiney.com/ http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/ -- 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 connecting to db on Linux
Rick, I snipped the code from my windoze system. I did have to change the case of the dbname to reflect the Linux version (all lc). The error message I got (not displayed on screen but visible on 'view source') was 'Could not connect' which, to me means that it got past the login to server and stalled on the select db part? George - Original Message - From: Rick Emery [EMAIL PROTECTED] To: 'George Pitcher' [EMAIL PROTECTED]; Greg Donald [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, February 18, 2002 2:31 PM Subject: RE: [PHP-DB] Problem connecting to db on Linux Have you spelled the name of the database correctly, including case sensitivity? What error message are you getting to indicate failure? -Original Message- From: George Pitcher [mailto:[EMAIL PROTECTED]] Sent: Monday, February 18, 2002 8:21 AM To: Greg Donald; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Problem connecting to db on Linux Greg, et al, This is the contents of the include file: ?php $link = mysql_connect ('localhost', 'root', '*') or die (Could not select db); mysql_select_db ('Heronsql') or die (Could not connect); ? I have also tried it with the following: ?php $link = mysql_connect ('localhost', 'root', '*'); echo mysql_errno().: .mysql_error().BR; mysql_select_db ('Heronsql'); echo mysql_errno().: .mysql_error().BR; ? Te results for this were: 0:0 0:0 I have reinstalled my Mandrake (MySQL/PHP4.0.6/Apache) and I am about to retest so I'll report back soon. George - Original Message - From: Greg Donald [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 18, 2002 2:08 PM Subject: Re: [PHP-DB] Problem connecting to db on Linux I've been working with PHP/MySQL on Win NT and Win 2000 for a few weeks. I've now set up a Linux machine (Mandrake 8.1 on Dell laptop) and have moved my files across. I use an include file which logs on to the MySQL server and then connects to the database. It performs the login ok but not the select db part. I tried creating a db using a php script and then selecting it and got the same problem. I'm new on Linux so it might be something in the configuration which needs working on. Any suggestions? Well, if you had posted some code, someone might have seen the error... :( Anyway, here is how i do it: if($db = mysql_pconnect($dbhost, $dbuser, $dbpasswd)){ mysql_select_db($dbname, $db); } else { echo mysql_error(); exit; } Greg Donald - http://destiney.com/ http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/ -- 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] Problem connecting to db on Linux
Greg, et al, Now the re-installation is complete, I am getting past the original error -- only to hit another. My query is as follows (echoed to web page): SELECT DISTINCT Nickname, HEI_ID FROM customers WHERE Nickname '' ORDER BY Nickname I have checked case against db an it is correct. Am I missing something else which is obvious? George - Original Message - From: Rick Emery [EMAIL PROTECTED] To: 'George Pitcher' [EMAIL PROTECTED]; Rick Emery [EMAIL PROTECTED]; Greg Donald [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, February 18, 2002 3:19 PM Subject: RE: [PHP-DB] Problem connecting to db on Linux Do you have your error messages crossed? I ask, because I would think your cannot select message would go with your mysql_select_db() and your cannot connect would go with your mysql_connect() -Original Message- From: George Pitcher [mailto:[EMAIL PROTECTED]] Sent: Monday, February 18, 2002 8:48 AM To: Rick Emery; Greg Donald; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Problem connecting to db on Linux Rick, I snipped the code from my windoze system. I did have to change the case of the dbname to reflect the Linux version (all lc). The error message I got (not displayed on screen but visible on 'view source') was 'Could not connect' which, to me means that it got past the login to server and stalled on the select db part? George - Original Message - From: Rick Emery [EMAIL PROTECTED] To: 'George Pitcher' [EMAIL PROTECTED]; Greg Donald [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, February 18, 2002 2:31 PM Subject: RE: [PHP-DB] Problem connecting to db on Linux Have you spelled the name of the database correctly, including case sensitivity? What error message are you getting to indicate failure? -Original Message- From: George Pitcher [mailto:[EMAIL PROTECTED]] Sent: Monday, February 18, 2002 8:21 AM To: Greg Donald; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Problem connecting to db on Linux Greg, et al, This is the contents of the include file: ?php $link = mysql_connect ('localhost', 'root', '*') or die (Could not select db); mysql_select_db ('Heronsql') or die (Could not connect); ? I have also tried it with the following: ?php $link = mysql_connect ('localhost', 'root', '*'); echo mysql_errno().: .mysql_error().BR; mysql_select_db ('Heronsql'); echo mysql_errno().: .mysql_error().BR; ? Te results for this were: 0:0 0:0 I have reinstalled my Mandrake (MySQL/PHP4.0.6/Apache) and I am about to retest so I'll report back soon. George - Original Message - From: Greg Donald [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 18, 2002 2:08 PM Subject: Re: [PHP-DB] Problem connecting to db on Linux I've been working with PHP/MySQL on Win NT and Win 2000 for a few weeks. I've now set up a Linux machine (Mandrake 8.1 on Dell laptop) and have moved my files across. I use an include file which logs on to the MySQL server and then connects to the database. It performs the login ok but not the select db part. I tried creating a db using a php script and then selecting it and got the same problem. I'm new on Linux so it might be something in the configuration which needs working on. Any suggestions? Well, if you had posted some code, someone might have seen the error... :( Anyway, here is how i do it: if($db = mysql_pconnect($dbhost, $dbuser, $dbpasswd)){ mysql_select_db($dbname, $db); } else { echo mysql_error(); exit; } Greg Donald - http://destiney.com/ http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/ -- 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Problem connecting to db on Linux
Rick, Sorry, here it is: Warning: Supplied argument is not a valid MySQL result resource in /var/www/html/HERONweb/home.php on line 32 I have 'echo mysql_errno();' just after the query is called but no number is being displayed. George - Original Message - From: Rick Emery [EMAIL PROTECTED] To: 'George Pitcher' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, February 18, 2002 3:46 PM Subject: RE: [PHP-DB] Problem connecting to db on Linux what is the error message you get? do you print otu mysql_error() ? -Original Message- From: George Pitcher [mailto:[EMAIL PROTECTED]] Sent: Monday, February 18, 2002 9:42 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Problem connecting to db on Linux Greg, et al, Now the re-installation is complete, I am getting past the original error -- only to hit another. My query is as follows (echoed to web page): SELECT DISTINCT Nickname, HEI_ID FROM customers WHERE Nickname '' ORDER BY Nickname I have checked case against db an it is correct. Am I missing something else which is obvious? George - Original Message - From: Rick Emery [EMAIL PROTECTED] To: 'George Pitcher' [EMAIL PROTECTED]; Rick Emery [EMAIL PROTECTED]; Greg Donald [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, February 18, 2002 3:19 PM Subject: RE: [PHP-DB] Problem connecting to db on Linux Do you have your error messages crossed? I ask, because I would think your cannot select message would go with your mysql_select_db() and your cannot connect would go with your mysql_connect() -Original Message- From: George Pitcher [mailto:[EMAIL PROTECTED]] Sent: Monday, February 18, 2002 8:48 AM To: Rick Emery; Greg Donald; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Problem connecting to db on Linux Rick, I snipped the code from my windoze system. I did have to change the case of the dbname to reflect the Linux version (all lc). The error message I got (not displayed on screen but visible on 'view source') was 'Could not connect' which, to me means that it got past the login to server and stalled on the select db part? George - Original Message - From: Rick Emery [EMAIL PROTECTED] To: 'George Pitcher' [EMAIL PROTECTED]; Greg Donald [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, February 18, 2002 2:31 PM Subject: RE: [PHP-DB] Problem connecting to db on Linux Have you spelled the name of the database correctly, including case sensitivity? What error message are you getting to indicate failure? -Original Message- From: George Pitcher [mailto:[EMAIL PROTECTED]] Sent: Monday, February 18, 2002 8:21 AM To: Greg Donald; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Problem connecting to db on Linux Greg, et al, This is the contents of the include file: ?php $link = mysql_connect ('localhost', 'root', '*') or die (Could not select db); mysql_select_db ('Heronsql') or die (Could not connect); ? I have also tried it with the following: ?php $link = mysql_connect ('localhost', 'root', '*'); echo mysql_errno().: .mysql_error().BR; mysql_select_db ('Heronsql'); echo mysql_errno().: .mysql_error().BR; ? Te results for this were: 0:0 0:0 I have reinstalled my Mandrake (MySQL/PHP4.0.6/Apache) and I am about to retest so I'll report back soon. George - Original Message - From: Greg Donald [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 18, 2002 2:08 PM Subject: Re: [PHP-DB] Problem connecting to db on Linux I've been working with PHP/MySQL on Win NT and Win 2000 for a few weeks. I've now set up a Linux machine (Mandrake 8.1 on Dell laptop) and have moved my files across. I use an include file which logs on to the MySQL server and then connects to the database. It performs the login ok but not the select db part. I tried creating a db using a php script and then selecting it and got the same problem. I'm new on Linux so it might be something in the configuration which needs working on. Any suggestions? Well, if you had posted some code, someone might have seen the error... :( Anyway, here is how i do it: if($db = mysql_pconnect($dbhost, $dbuser, $dbpasswd)){ mysql_select_db($dbname, $db); } else { echo mysql_error(); exit; } Greg Donald - http://destiney.com/ http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http
Re: [PHP-DB] problem with LOAD DATA INFILE for date format
There may be a better way, but in migrating from Filemaker to MySQL, I encountered similar problems. My solution was to pass the data through Excel and use that to convert the dates into the required format (CTRL-1, Custom, -mm-dd). Of course, you ned to watch out for those nasty ' ' ' that Excel puts around any cell containing a comma. So you might need to filter the output from excel in a text editor too but if its a one-off, its worth it. george - Original Message - From: Hendra [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 25, 2002 5:09 AM Subject: [PHP-DB] problem with LOAD DATA INFILE for date format Hi, I have a sample data like below in text file (policy.txt). PolicyNo,DateOfBirth,PaidToDate 0003573607, 9/25/1973, 8/27/2001 708802,11/26/1959, 5/25/1998 0002776507, 3/19/1973,11/18/1999 0002776703, 3/13/1969,11/18/1999 Policy table structure: +---+-+ | Field | Type| +---+-+ | PolicyNumber | char(10)| | DateOfBirth | date| | PaidToDate| date| +---+-+ When I do: LOAD DATA INFILE policy.txt INTO TABLE Policy FIELDS TERMINATED BY ',' ENCLOSED BY '' LINES TERMINATED BY '\n' IGNORE 1 LINES; All data in field DateOfBirth PaidToDate become -00-00 I notice this is because mysql only accept date format in -mm-dd. However, in my text file, the date format is in mm/dd/ format. Any idea? Thanks in advance. Hendra -- 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] Looping advice sought
Hi all, I am about to start on a script page which will loop thru a MySQL table and update records depending on the actions of the user. I propose to loop through, row by row performing a separate UPDATE statement for each row, unless someone can advise me of a better way (2d array?). I am migrating this site from Lasso where I needed to to do two iterations of the script: the first handles a single row input and the other handles multiple row inputs. Do I need to do two with php or will one be able to handle a count of 1 in a loop just as well as a multiple count? MTIA George = George Pitcher Technical Manager, HERON, Napier University, Edinburgh 0131-455 2435 .. [EMAIL PROTECTED] .. [EMAIL PROTECTED] __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.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-DB] Re: Looping advice sought
Miles, It's not as bad as some of my queries. Here's my code so far: = = = = = = $i=1; while $i($howmany + 1) { $activity=($activity . $i); $tr_id=($tr_id . $i); if($activity'' and $activity'Delete' and $activity'Submit'){ if($activity=='Decline') $activity='Declined'; if($activity=='Withdraw') $activity='Withdrawn'; $uquery1 =update Transactions ; $uquery1.=SET (PHEIAction, PHEIAccepts) $uquery1.=VALUES $uquery1.=('$activity', '$d1') $uquery1.= WHERE RecID= '$tr_id' mysql_query($uquery1); }elseif($activity=='Submit' or $submit=='Submit Whole Pack'){ $uquery1 =update Transactions ; $uquery1.=SET (PRequestsubmitted, Packorder) $uquery1.=VALUES $uquery1.=('$d1', '$Packorder') $uquery1.= WHERE RecID= '$tr_id' mysql_query($uquery1); }elseif($activity=='Delete'){ $uquery1 =update Transactions ; $uquery1.=SET CourseID $uquery1.=VALUES $uquery1.=0 $uquery1.= WHERE RecID= '$tr_id' mysql_query($uquery1); } = = = = = = George - Original Message - From: Miles Thompson [EMAIL PROTECTED] To: George Pitcher [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, January 22, 2002 11:49 AM Subject: Re: [PHP-DB] Looping advice sought Good morning George, As always, it depends on the data. Knowing how large your queriesare, can you give us a stripped down example of two iterations? Not code, just an example of what you're wanting to update or insert. Miles At 11:24 AM 1/22/2002 +, George Pitcher wrote: Hi all, I am about to start on a script page which will loop thru a MySQL table and update records depending on the actions of the user. I propose to loop through, row by row performing a separate UPDATE statement for each row, unless someone can advise me of a better way (2d array?). I am migrating this site from Lasso where I needed to to do two iterations of the script: the first handles a single row input and the other handles multiple row inputs. Do I need to do two with php or will one be able to handle a count of 1 in a loop just as well as a multiple count? MTIA George = George Pitcher Technical Manager, HERON, Napier University, Edinburgh 0131-455 2435 .. [EMAIL PROTECTED] .. [EMAIL PROTECTED] __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.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]
Re: [PHP-DB] Looping advice sought
Miles, It's not as bad as some of my queries. Here's my code so far: = = = = = = $i=1; while $i($howmany + 1) { $activity=($activity . $i); $tr_id=($tr_id . $i); if($activity'' and $activity'Delete' and $activity'Submit'){ if($activity=='Decline') $activity='Declined'; if($activity=='Withdraw') $activity='Withdrawn'; $uquery1 =update Transactions ; $uquery1.=SET (PHEIAction, PHEIAccepts) $uquery1.=VALUES $uquery1.=('$activity', '$d1') $uquery1.= WHERE RecID= '$tr_id' mysql_query($uquery1); }elseif($activity=='Submit' or $submit=='Submit Whole Pack'){ $uquery1 =update Transactions ; $uquery1.=SET (PRequestsubmitted, Packorder) $uquery1.=VALUES $uquery1.=('$d1', '$Packorder') $uquery1.= WHERE RecID= '$tr_id' mysql_query($uquery1); }elseif($activity=='Delete'){ $uquery1 =update Transactions ; $uquery1.=SET CourseID $uquery1.=VALUES $uquery1.=0 $uquery1.= WHERE RecID= '$tr_id' mysql_query($uquery1); } = = = = = = George - Original Message - From: Miles Thompson [EMAIL PROTECTED] To: George Pitcher [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, January 22, 2002 11:49 AM Subject: Re: [PHP-DB] Looping advice sought Good morning George, As always, it depends on the data. Knowing how large your queriesare, can you give us a stripped down example of two iterations? Not code, just an example of what you're wanting to update or insert. Miles At 11:24 AM 1/22/2002 +, George Pitcher wrote: Hi all, I am about to start on a script page which will loop thru a MySQL table and update records depending on the actions of the user. I propose to loop through, row by row performing a separate UPDATE statement for each row, unless someone can advise me of a better way (2d array?). I am migrating this site from Lasso where I needed to to do two iterations of the script: the first handles a single row input and the other handles multiple row inputs. Do I need to do two with php or will one be able to handle a count of 1 in a loop just as well as a multiple count? MTIA George = George Pitcher Technical Manager, HERON, Napier University, Edinburgh 0131-455 2435 .. [EMAIL PROTECTED] .. [EMAIL PROTECTED] __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.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] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.314 / Virus Database: 175 - Release Date: 11/01/02 -- 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] 1 query or 2 queries
I have a page that displays a book and some of its chapters (not all chapters are recorded) and I want to do a layout like this: ISN: 012345678X Book Title: A Christmas Carol Book Author: Dickens, C. Publisher:Victorian Press Year: 1934 Dickens, C Chapter One:title 1-33 Last sold for 5p per page Digitised Dickens, C Chapter Two:title34-43 Last sold for 5p per page Digitised Dickens, C Chapter Three:title 44-63 Not Cleared Not Digitised Dickens, C Chapter Six :title 92-114 Last sold for 5p per page Digitised Now, I know I could do 2 queries, 1 against the book table and the other against the chapter table. Would it be possible and if so more efficient to combine them into a single query and still be able to display in this way? MTIA George in Edinburgh (data is fictional in more ways than one) --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.314 / Virus Database: 175 - Release Date: 11/01/02 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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-DB] Problem with BIG MySQL query
If I perform the following query in MySQL_Front, It works but I get no records returned (there should be 10 records). If I use it with php on my web page, I get an error: Supplied argument is not a valid MySQL result resource in [script name] which is probably because of the zero return. The script works fine without the 'scanrates'**' references but not with them. Should I be putting a JOIN instruction in here somwehere to make it work properly? George The select query: Select bib_extract.E_Author, bib_extract.E_Title, bib_extract.Vol, bib_extract.Issue, bib_extract.Page_End_1, bib_extract.Page_End_2, bib_extract.Page_Start_1, bib_extract.Page_Start_2, bib_extract.PDF_Stored, scanrates.price_per_unit, scanrates.pub_digi_fee, transactions.RecID, transactions.CourseID, transactions.SourceID, transactions.ExtractID, transactions.CLClearanceCLA, transactions.CLClearanceAlt, transactions.CLClearanceRoute, transactions.CLClearanceTypeCLA, transactions.CLClearanceTypeAlt, transactions.CLCourseEndAlt, transactions.CLCourseStartAlt, transactions.CLItemOwnedbyHEI, transactions.CLReqNotes, transactions.CLReqType, transactions.CLSubscribe, transactions.CLCFeeWaived, transactions.FinBLDSCCopyfee, transactions.FinCfeeCLA, transactions.FinCfeealt, transactions.FinCurrencyCLA, transactions.FinCurrencyalt, transactions.FinExchangerate, transactions.FinExchangeratealt, transactions.FinFeetype, transactions.FinFeetypealt, transactions.FinFlatfee, transactions.FinFlatfeealt, transactions.FinPaperItemCost, transactions.FinPriceperpage, transactions.FinPubVAT, transactions.FinPubDigiFee, transactions.FinPubDigiFeealt, transactions.FinRate, transactions.FinRateType, transactions.FinSupplementalFee, transactions.HEI_ID, transactions.HEICustNotes, transactions.HEIFailureReason, transactions.PAltsenttopub, transactions.PBLDSCinformed, transactions.PCleardate, transactions.PCleardatealt, transactions.PComplete, transactions.PDocfromBureau, transactions.PDocreceived, transactions.PDocsupplied, transactions.PDoctoBureau, transactions.PHEIaccepts, transactions.PHEIAction, transactions.PHEIInformedofClearance, transactions.PHEIinformedofcompletion, transactions.PHEIRemindedofDocReq, transactions.POriginalreceivedfromHEI, transactions.PRemindersent, transactions.PRequestsenttoCLA, transactions.PRequestsenttoPub, transactions.PRequestsubmitted, transactions.PRqsforOriginaltoHEI, transactions.PTUComplete, transactions.RecCreatedby, transactions.RecCreatedon, transactions.TUResupply, transactions.TUStoragepermitted, transactions.WWHeroninfo1, transactions.WWPrevClear, transactions.WWPrevClearinfo, transactions.PDocmounted, transactions.Pdownload from bib_extract,scanrates,transactions where (transactions.CourseID = '210' and transactions.ExtractID=bib_extract.E_ID and scanrates.rate=transactions.finrate ) order by bib_extract.E_Author, bib_extract.E_Title --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.314 / Virus Database: 175 - Release Date: 11/01/02 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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-DB] Problem with BIG MySQL query
If I perform the following query in MySQL_Front, It works but I get no records returned (there should be 10 records). If I use it with php on my web page, I get an error: Supplied argument is not a valid MySQL result resource in [script name] which is probably because of the zero return. The script works fine without the 'scanrates'**' references but not with them. Should I be putting a JOIN instruction in here somwehere to make it work properly? George The select query: Select bib_extract.E_Author, bib_extract.E_Title, bib_extract.Vol, bib_extract.Issue, bib_extract.Page_End_1, bib_extract.Page_End_2, bib_extract.Page_Start_1, bib_extract.Page_Start_2, bib_extract.PDF_Stored, scanrates.price_per_unit, scanrates.pub_digi_fee, transactions.RecID, transactions.CourseID, transactions.SourceID, transactions.ExtractID, transactions.CLClearanceCLA, transactions.CLClearanceAlt, transactions.CLClearanceRoute, transactions.CLClearanceTypeCLA, transactions.CLClearanceTypeAlt, transactions.CLCourseEndAlt, transactions.CLCourseStartAlt, transactions.CLItemOwnedbyHEI, transactions.CLReqNotes, transactions.CLReqType, transactions.CLSubscribe, transactions.CLCFeeWaived, transactions.FinBLDSCCopyfee, transactions.FinCfeeCLA, transactions.FinCfeealt, transactions.FinCurrencyCLA, transactions.FinCurrencyalt, transactions.FinExchangerate, transactions.FinExchangeratealt, transactions.FinFeetype, transactions.FinFeetypealt, transactions.FinFlatfee, transactions.FinFlatfeealt, transactions.FinPaperItemCost, transactions.FinPriceperpage, transactions.FinPubVAT, transactions.FinPubDigiFee, transactions.FinPubDigiFeealt, transactions.FinRate, transactions.FinRateType, transactions.FinSupplementalFee, transactions.HEI_ID, transactions.HEICustNotes, transactions.HEIFailureReason, transactions.PAltsenttopub, transactions.PBLDSCinformed, transactions.PCleardate, transactions.PCleardatealt, transactions.PComplete, transactions.PDocfromBureau, transactions.PDocreceived, transactions.PDocsupplied, transactions.PDoctoBureau, transactions.PHEIaccepts, transactions.PHEIAction, transactions.PHEIInformedofClearance, transactions.PHEIinformedofcompletion, transactions.PHEIRemindedofDocReq, transactions.POriginalreceivedfromHEI, transactions.PRemindersent, transactions.PRequestsenttoCLA, transactions.PRequestsenttoPub, transactions.PRequestsubmitted, transactions.PRqsforOriginaltoHEI, transactions.PTUComplete, transactions.RecCreatedby, transactions.RecCreatedon, transactions.TUResupply, transactions.TUStoragepermitted, transactions.WWHeroninfo1, transactions.WWPrevClear, transactions.WWPrevClearinfo, transactions.PDocmounted, transactions.Pdownload from bib_extract,scanrates,transactions where (transactions.CourseID = '210' and transactions.ExtractID=bib_extract.E_ID and scanrates.rate=transactions.finrate ) order by bib_extract.E_Author, bib_extract.E_Title --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.314 / Virus Database: 175 - Release Date: 11/01/02 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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-DB] REQ code help for case statement
Hi all, Trying to move code into MySQL rather than php, but can't find any examples of what I want to do. I have a number of fields and want to be able to check a number of fields (most containing workflow dates or text) and return a 'message' for web display. The message will take the form of 'Status of record' followed by a date taken from the appropriate field (not always the same one). The example in the manual doesn't refer to field data at all but to numbers. How do I write the code to do this? I need to do this on two web pages, one for a single record and one which shows a list of records (each will display the 'message'. MTIA George, Edinburgh --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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]
Re: [PHP-DB] convert yyyy/mm/dd to mm/dd/yyyy, how?
Sander, I'm also in Europe but here in the UK we prefer dd/mm/ and I've cobbled together a couple of functions to handle this for me. function dbdate($input) { $today = explode(-,$input); $month = $today[1]; $day = $today[2]; $year = $today[0]; $p_date = $day . / . $month . / . $year ; return $p_date; } function revdate($input) { $today = explode(/,$input); $day = $today[0]; $month = $today[1]; $year = $today[2]; $revdate = $year . - . str_pad($month, 2, 0, STR_PAD_LEFT) . - . str_pad($day, 2, 0, STR_PAD_LEFT); return $revdate; } I've stored these in a file which I include and any call to the db to display dates uses the dbdate() function and if I want to insert or update a date then I use the revdate() function. There are probably better ways to do this. Hope this helps. George in Edinburgh - Original Message - From: Sander Peters [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, January 13, 2002 7:56 PM Subject: [PHP-DB] convert /mm/dd to mm/dd/, how? Hello everybody, convert /mm/dd to mm/dd/, how? MYSQL does everything in /mm/dd. I live in the Netherlands and we are use to the format dd/mm/. What's the best way to display it as mm/dd/ in a table on a query? My first idea whas to split the date up in vars in php and then print the vars in the way I like it Is this a bad idea? Or are there better sollutions? Thanx in advance for answering! -- Met vriendelijke groet / With Greetings, Sander Peters site: http://www.visionnet.nl/ email: mailto:[EMAIL PROTECTED] webmail: mailto:[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] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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-DB] grabbing id from new record
Hi, Is there a way to grab the ID (from ID field) while INSERTing a new record? I am currently doing a separate INSERT then a SELECT query to find the most recently added record by that user: select ID from table where user = '$user' order by ID DESC limit 0,1 This does the trick but it may not be the most efficient way. George --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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]
Re: [PHP-DB] grabbing id from new record
I am sorry, I was not clear in my original request. The id is auto-incremented. I want to grab the id so that I can use it as part of a redirect $q2=select Course_ID from course where HEI_ID = '$inst' order by Course_ID desc limit 0,1; $result2=mysql_query($q2) or die(q2 failed); while ($row = mysql_fetch_array ($result2)) { $recid=$row['Course_ID']; } $redirect=('Location: http://localhost/Mysite/itemlist.php?recid=' . $recid); header($redirect); As I said, it works but maybe there's a better way. George What about Auto_increemnt field ?? Your's id can be auto_increment field. for example: create table dupencja (id int(7) auto_increment not null, primary key(id)); so when you insert records: insert into dupencja values('') - id will be 1 insert into dupencja values('') - id will be 2 this is auto_increment, so your trick isn't need. More in manula of mysql. regards. I piasecki - www.b-c.pl - Original Message - From: George Pitcher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 14, 2002 3:23 PM Subject: [PHP-DB] grabbing id from new record Hi, Is there a way to grab the ID (from ID field) while INSERTing a new record? I am currently doing a separate INSERT then a SELECT query to find the most recently added record by that user: select ID from table where user = '$user' order by ID DESC limit 0,1 This does the trick but it may not be the most efficient way. George --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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] -- Znudzilo Ci sie logo w komorce? Wgraj nowe [ http://komorki.onet.pl/dodatki.html ] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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]
Re: [PHP-DB] grabbing id from new record
Thanks, just what I was looking for. George - Original Message - From: matt stewart [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 14, 2002 3:26 PM Subject: RE: [PHP-DB] grabbing id from new record straight after you do the insert command, use the call: $ID = mysql_insert_id(); The $ID is now the primary key for the record you just inserted. -Original Message- From: George Pitcher [mailto:[EMAIL PROTECTED]] Sent: 14 January 2002 14:56 To: Ireneusz Piasecki; [EMAIL PROTECTED] Subject: Re: [PHP-DB] grabbing id from new record I am sorry, I was not clear in my original request. The id is auto-incremented. I want to grab the id so that I can use it as part of a redirect $q2=select Course_ID from course where HEI_ID = '$inst' order by Course_ID desc limit 0,1; $result2=mysql_query($q2) or die(q2 failed); while ($row = mysql_fetch_array ($result2)) { $recid=$row['Course_ID']; } $redirect=('Location: http://localhost/Mysite/itemlist.php?recid=' . $recid); header($redirect); As I said, it works but maybe there's a better way. George What about Auto_increemnt field ?? Your's id can be auto_increment field. for example: create table dupencja (id int(7) auto_increment not null, primary key(id)); so when you insert records: insert into dupencja values('') - id will be 1 insert into dupencja values('') - id will be 2 this is auto_increment, so your trick isn't need. More in manula of mysql. regards. I piasecki - www.b-c.pl - Original Message - From: George Pitcher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 14, 2002 3:23 PM Subject: [PHP-DB] grabbing id from new record Hi, Is there a way to grab the ID (from ID field) while INSERTing a new record? I am currently doing a separate INSERT then a SELECT query to find the most recently added record by that user: select ID from table where user = '$user' order by ID DESC limit 0,1 This does the trick but it may not be the most efficient way. George --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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] -- Znudzilo Ci sie logo w komorce? Wgraj nowe [ http://komorki.onet.pl/dodatki.html ] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 -- 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] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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]
Re: [PHP-DB] grabbing id from new record
Sam, Thanks, I got the mysql_insert_id() tip a few seconds earlier. However, my alternative method (which I will now drop in the interests of efficiency) is perfectly safe. It is impossible for the same user to go and create another record in that verys small interim period between the two queries. That was why the WHERE user='$user' was there. George - Original Message - From: Sam Masiello [EMAIL PROTECTED] To: George Pitcher [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, January 14, 2002 3:21 PM Subject: Re: [PHP-DB] grabbing id from new record That actually isn't a safe way to do it. Consider the following scenario: Insert A occurs generating row Y in your table. Insert B occurs generating row Z in your table. select occurs (after insert A) to grab last ID inserted...your result is the ID from row Z. select occurs (after insert B), and your result again is the result ID from row Z. So, in both cases you will get the ID from insert B, instead of your intended result (first select gives the ID from row Y and the second from row Z). You didn't mention which database engine that you are using, so I will assume you are using MySQL. There is a function called mysql_insert_id() that will give you the answer that you are looking for. You can find more information about it here: http://www.php.net/manual/en/function.mysql-insert-id.php HTH Sam Masiello Software Quality Assurance Engineer Synacor (716) 853-1362 X289 [EMAIL PROTECTED] - Original Message - From: George Pitcher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, January 14, 2002 9:23 AM Subject: [PHP-DB] grabbing id from new record Hi, Is there a way to grab the ID (from ID field) while INSERTing a new record? I am currently doing a separate INSERT then a SELECT query to find the most recently added record by that user: select ID from table where user = '$user' order by ID DESC limit 0,1 This does the trick but it may not be the most efficient way. George --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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]
Re: [PHP-DB] Concept help required
David, =I'm feeling a little 'at sea' here, because we had established that you want to learn more about joining, yet you recognise the word normalisation straight off. I don't want to insult you by 'talking down'/teaching grandma to suck eggs... Please be sure it is not another one of those words that has a particular definition in the relational world, but was subjugated by wiley marketing people at FM to mean something 'just a little different' (alternatively that my ignorance of the product is the issue). Feel free to realign my approach... No need to feel at sea. After an earlier response from either you or Miles, I read up on normalisation. =Continuing on, in such a situation I am always inclined to try to 'cut corners' (against the 'standard' structured analysis/book approach) - bet this comment gets some of our list colleagues gagging, already thinking I'm long-winded in my methods. Because, as an outsider, I would not have such an intimate understanding of the data items and their inter-relationships as you do, I would probably attempt to take the existing data structures (the tables, and the list of fields/columns in each) and restate/extend these into something called a ELH diagram (entity life history) - the theory of which you will find in any competent structured analysis and design or SSADM text (the latter relevant to your location, SSADM being a British Government initiative, if you'll pardon the oxymoron). I have done these flow charts in the past to demonstrate how my current system should work at a higher level. =The purpose of an ELH diagram is to take a piece of data (in your case, because we are assuming/checking normalisation, I'd 'cheat' and work at the table level - rather than something more atomic like the data-item level). Once again we draw boxes (I have some wonderful s/w for doing these tasks, but it is M$). A single Visio? label/box at the top, featuring the name of the data-unit, and I would guess a minimum of three (must be my favorite number!) boxes in the next row, representing the arrival/creation of the data, its use within the system, and the removal of the data from the system once its usefulness has subsided, respectively. The third row of boxes represents the actual, individual events in the life-cycle/daily operation of the system, and how they alter/update/use the data. Lines drawn between the boxes show how these events relate and where there may be some iteration. =This is an analysis/checking tool. As such it bores the socks off most techies. However it is most useful to ensure that data is being used properly, and for a consistent purpose. In theory it can also be used to check the data structure because by following the uses to which a piece of data is put during its life, you can ensure that it is being represented using the 'best' data type for the purpose. It can certainly be used to ensure that you have the best design of relationships between multiple data items - both in the single table/normalisation sense, but most especially in the relationships between tables. As I go, my diagrams accumulate a bunch of notes around the margins with lead-out lines heading back into/from a point in the diagram - reminding me to check things as the design (or in your case, verification) proceeds. Methodically iterating across dozens of diagrams, the notes are removed - and the system data coalesces. =One of the great things about doing this, is that in examining where the data is coming from, going to, and how it is being used; you are also making a list of all of the db queries that you will need to contain within your system - yes you've guessed it, I have another bunch of boxes scattered around my diagrams (in a different color, just to be petty, er, pretty) which note these needs. If you 'get into' a design book, they will talk about other related diagrams, eg data-flow diagrams, which would normally be used to contain much of the info I'm putting into margin-notes - like I said, I'm short-cutting and I think you'll also get away with it because of your level of knowledge. Feel free to disagree (either way). I will be going through the stages you have mentioned to map out the processes and data requirements. I think that I know the process enough to do this without reference to the 'users' considering that at present this is for purely self-development purposes. =Once the diagrams are finished, or for a little light relief (of the diagram boredom) as I go along, I then use a db admin tool for MySQL to start building the SQL code, and testing them against some sample data. Yes, I could use the MySQL command line, but I am a fan of MySQL-Front because as well as the stark content of diagrams and the code-view of the SQL DDL statements, the package gives me a visual representation of the columns/data - another opportuntity for any incongruities to penetrate this thick skull... Oh, and you've probably guessed
Re: [PHP-DB] Concept help required
David, =ex-Navy guys are always at sea - however they never let me near the ships, but I guess that's another story... ex RAF myself (almost 30 years ago though), so I suppose I might be all 'up in the air'? level). Once again we draw boxes (I have some wonderful s/w for doing these tasks, but it is M$). A single Visio? =yes - but as part of my venturing into LAMPs, I have been pointed to an equivalent package under Linux. =understood - and so whilst you may not 'improve' the system design (the primary objective when developing on a 'green field' site) it will help in your conversion to SQL/relational technology, as per below. I'm sure it will. =correct MySQL does not CURRENTLY have stored procedures, but it is under active discussion (too late for us, but then...). =many people have a very shallow understanding of SQL - particularly [he says generalising like crazy] people who 'fall into it' from (say) PHP programming. Indeed my own initial training course [mumble, mumble] years ago majored on SELECT, charged through INSERT and DELETE, and settled lightly on DML. However there is enormous power in the SELECT statement that belies the usual course topics of SELECT *... and SELECT colName, colName, ... and a bit of format control/changing the column names/labels. In my training course, and many others I've seen since, token gestures are made so that even throwing in MAX(), MIN(), and AVG() seems more an illustration of (the more narrow) GROUP BY clause than it does of the SELECT statement. [rant, rave,...] This shallow understanding means that 'they' will tend to do too much in PHP (assuming they know it better) in preference to SQL - at a cost of efficiency/execution time. =let's make this answer a 'game of two halves': firstly, if you followed my earlier point, after producing ELH diagrams, (my)/the next step is to start writing SQL queries. Thus one tries to pack as much functionality into the SQL statement, as is possible. Each SQL query will feed some response 'back' to the PHP code (that in the finished product, will first call it). Thus if you throw together the system's SQL calls in a previous development step, the only PHP functionality required is that which cannot be accomplished within MySQL - so my terminology may be flawed/deceptive, it is not that I'm taking stuff out of the PHP code (I haven't written any yet/at this stage), it's that it never gets in there in the first place! Remember the mantra: prevailing wisdom says that if you have a choice of doing something in SQL or PHP, do it in SQL. =there's an interesting problem on the list (in fact both PHP and PHP-DB) posed by Brian Tully need help looping through each record with a query -stumped. It is a much smaller/self-contained example than your own. He has presented his 65-line, mainly-PHP code in his statement of the problem. It provided a brain-starting challenge for me this morning, and I have opened my big mouth to suggest that we could get it down to a much less complex single SQL call and one or two nested loops of PHP. To do this, I have requested some clarification of the business rules governing his case. If it suits you, and assuming he gets back to me, I will work through it. Could we then use this as an example of how to shift functionality out of PHP (the 'middle box') and into SQL (the 'left-hand box')? Yes, please do. But if I could interject with a sub-concept question. Much of what I will be scratching my head about can probably be achieved with SQL as it pertains to data held. Can this fuctionality be built into MySQL or is it more a case of still doing it all in SQL but the SQL 'script' resides in the .php page? Just trying to see the trees instead of the wood. George --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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]
Re: [PHP-DB] Concept help required
David, =there's a bunch of fast-mover jockies and helo boys who never have to pay for their drinks when any of my guys are around... Air Traffic Control was my area, though we did have to put up with some of your lot when Ark Royal was in dock as we were a Buccaneer base. =Sorry, misunderstood the 'level' of your question/comment... =Yes you are correct, the SQL code 'resides'/is kept within the PHP code. Borrowing an example (and editing a little) from Brian's post: $query = SELECT Month, Score FROM scores WHERE Username = '$Username' ; $result = mysql_query($query2) or die( Cannot execute query . mysql_error () ) ; =This is PHP code. The first line of which builds a SQL SELECT statement where the contents of the PHP variable $Username will be substituted inside the single quotes, eg SELECT Month, Score FROM scores WHERE Username = 'George Pitcher' =The second line throws the query at MySQL and receives two results by return. Firstly the logical: did the call work or not? which may fire the 'or' clause (returning an error msg and number); and secondly the handle of the MySQL resultset. (the next step being to retrieve the actual data, as required/appropriate from the resultset) =So at the code-level, the SQL commands/script is/are contained within the .php page. =At the logic level, the functionality to retrieve only the single record (that fulfills the stated criteria) from amongst all those in the database, is contained within the SQL command. =but I'm still not sure which one is wood, and which trees! =Ok now? Yes, that clarifies a lot. I can stop looking for some place where it might exist in MySQL and concentrate on the design until you are ready for the SQL building. I think that some of my queries might be a bit of a challenge and might require revisiting the design and data structure. I'm not looking for anyone to solve my problems, just to help me along while I learn the basics and then the tricks. George --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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]
Re: [PHP-DB] MySQL Result Resource
I was having something similar and solved it by wrapping the column names in parentheses: select password, 1 as auth from acl where (username='andrewd' and password=MD5(andrewd.madonna)); It might help. or eliminate something if I'm not right. George - Original Message - From: Necro [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, January 10, 2002 4:09 PM Subject: RE: [PHP-DB] MySQL Result Resource Yep, andrewd is the username im trying to get this script to work with, its an authentication script.. The result of echo $arg is the following: select password, 1 as auth from acl where username='andrewd' and password=MD5(andrewd.madonna)1109 : Unknown table 'andrewd' in where clause Andrew -Original Message- From: Miles Thompson [mailto:[EMAIL PROTECTED]] Sent: Friday, 11 January 2002 3:08 AM To: Necro; [EMAIL PROTECTED] Subject: RE: [PHP-DB] MySQL Result Resource Can you try this puppy at the MySQL console? I'd dearly love to know where andrewd is coming from, it sounds like your username. Before executing mysql_query(), echo $arg and see what it prints. This is strange, but better than what we had - Miles Thompson At 02:54 AM 1/11/2002 +1100, Necro wrote: Ok, I have tried a few things now. I finally got it to echo the errors, firstly there was still a prob with MD5 values being in the apostrophes. Then next error was no db was selected. So i added a mysql_select_db statement. Now i get this: 1109 : Unknown table 'andrewd' in where clause andrewd being the username I am trying to get it to accept. Following lines are the current bit: $arg = select password, 1 as auth from acl where username='$username' and password=MD5($username.$password); $result = mysql_query( $arg ) or die(mysql_errno(). : . mysql_error() ); $row = mysql_fetch_array($result); Andrew -Original Message- From: Miles Thompson [mailto:[EMAIL PROTECTED]] Sent: Friday, 11 January 2002 2:36 AM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] MySQL Result Resource Break up the code. I assume you are connecting to the database with mysql_connect() or mysql_pconnect(). If not, do that. Echo your query so that you know it contains valid values. Break $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg )); into $result = mysql_query( $arg ) or die(mysql_errno(). : . mysql_error() ); $row = mysql_fetch_array($result) ) then do whatever processing you need with the array $row. Miles PS Just reply to the list, if you reply directly to me I have one more message to delete. g /mt At 02:10 AM 1/11/2002 +1100, Necro wrote: Yeh, I notice now the MD5 was wrong. But I still get the same error on line 104. If I try and replace it with the current query function then I get two errors. e.g. Warning: Supplied argument is not a valid MySQL-Link resource in d:\htdocs\infekt\packages\auth.inc on line 104 Warning: Supplied argument is not a valid MySQL result resource in d:\htdocs\infekt\packages\auth.inc on line 104 Andrew -Original Message- From: Miles Thompson [mailto:[EMAIL PROTECTED]] Sent: Friday, 11 January 2002 2:05 AM To: Necro; [EMAIL PROTECTED] Subject: Re: [PHP-DB] MySQL Result Resource The use of the MD5 function in the query doesn't look quite right. Shouldn't it be MD5('$password') or MD5('$username'.'$password') if concatenating? Also, mysql_db_query() has been a deprecated function for some time now, mysql_query() is recommended. Hope this gets you going - Miles Thompson At 01:33 AM 1/11/2002 +1100, Necro wrote: Lo all, Slight problem on an auth script... Warning: Supplied argument is not a valid MySQL result resource in d:\htdocs\infekt\packages\auth.inc on line 104 Line 26: define( DATABASE, imanager ); Line 103: $arg = select password, 1 as auth from acl where username='$username' and password=MD5('$username','$password'); Line 104: $row = mysql_fetch_array(mysql_db_query( DATABASE, $arg )); Can anyone help get this to work?? Thankyou. Andrew -- 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] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To
Re: [PHP-DB] Concept help required
David, =Prevailing wisdom in system design suggests that the data should be 'designed' first, and 'code'/processing only later (relational or structured design philosophy, even object-oriented design). Accordingly I recommend considering which parts of your current files should be converted into MySQL tables, and what might need to be added/subtracted to ensure that the relationships between tables is adequately expressed/because that makes other 'old data' unnecessary. As you would seem to have identified your data, and grouped/categorised it into tables, you might be able to go straight into the process of 'normalising' your data - a series of steps/techniques which enable you to analyse the data and structure it into a 'relational' form. (if you are not familiar with this term: it's back to the books) Actually the Filemaker system is fairly 'normalised' having been developed over a couple of years, our previous web developer (commercial partner) pulled out of our service an I stepped in to deliver the goods and in doing so, went through the analysis and re-design process. It may well be that there could be some marginal improvement in doing it again. I'll have a look anyway - its part of the learning process. =Have I misunderstood? It seems to me that you are not offering this data to the web, ie I can't get to it; you are only offering it to the copyright fee-paying clients. Hence the publishers' argument seems illogical/ignorant... Yes, exactly, but they control what happens and we are not mature enough as a service to hit them over the heads yet. I run a dual site with a main 'Live' service and a Training service allowing users to play with the processes before they get near the real thing. =and now a third environment: for development, and a fourth: for system testing... I did omit to say that my server hosts a development solution (Filemaker/Lasso) and that as well as the dev databases being on my laptop, so is the MySQL/PHP solution. New laptop expected within a couple of weeks and this one will then be switched to Linux. Regards George --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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]
Re: [PHP-DB] Concept help required
DL Neil (I presume you have a first name tucked away inside there), Your comments are appreciated. I am becoming more and more comfortable with what I am doing with MySQL/PHP. With reference to the 3-box trick, I thought that the bulk of my work would be inthe centre box but as you point out that would be inefficient if the work can be pre-processed in the RDBMS box. A simple explanation of my Filemaker system follows. But first, a description of what the service provides might help. Our members (50+ uk universities) can request material (usually book chapters or journal articles) to be delivered electronically (or rarely, by paper) to their students. We handle copyright clearance through the UK rights agency (CLA) and through publishers/authors. We pass the prices back to the clients via the web interface and the client accepts/declines. We then source originals from the British Library which are digitised by a bureau and put into PDF before a front page is attached (currently automated using Applescript but hope to use PDFlib in future) and delivered to the university. We invoice monthly for items completed, not by course. We have a success rate of 60% mainly due to the reluctance of publishers having their material mounted on the web. Now the system: (number of current records in parentheses) Transactions (15000+) [contains a record for each requested extract with workflow and cost information] Course (900+) [Holds data for courses such as student numbers, dates etc] Bib_source (6000+) [Book or journal data held here at title level] Bib_extract (9000+) [Chapter/article level data held] Publishers (18000+) [Rightsholder details data bought in] Customers (50+) [Client details] Buyers (200+) [Individuals who can make purchasing decisions at clients] Illustrations (150+) [Illustrations require special handling and there can be several per extract] Invoices (300+) [data taken from Transactions and Customers to produce PDF invoices] Userlog (4000++) [log of users accessing main system] Weblog (500+) [covers whole site and started in December] Staff (10+) [Staff names, addresses, emails etc] Scanrates [CLA-provided table to store pre-priced material - covers about 40% of requests] Helpdesk-general [General helpdesk alloowing LAN-wide staff access and direct responses to users] Helpdesk-transactional [As above but specifically set up to handle problems about individual transactions] I run a dual site with a main 'Live' service and a Training service allowing users to play with the processes before they get near the real thing. I'll need to leave now to pick the kids up from school as the wife is ill. I'll see your comments tomorrow when I get back in. Regards George - Original Message - From: DL Neil [EMAIL PROTECTED] To: George Pitcher [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, January 08, 2002 1:07 PM Subject: Re: [PHP-DB] Concept help required George, =As a general comment, it is always dangerous to replicate when shifting platforms, better to reverse engineer and then implement anew and taking advantages of the strengths of the new tools. This particularly when moving into the relational field... Perhaps the use of the word 'replicate' was wrong. I am in fact re-engineering based on my knowledge of how the whole operation is performed (as I designed and built the original Filemaker/Lasso system) and trying to preserve the look and feel of the web pages. =makes perfect sense =you will need to describe the 'internal calculations' before this question can be easily/sufficiently answered. However many people fail to appreciate that the (My)SQL language offers a lot of power/functionality. In your case you are going for the PHP combination so I will be quite surprised if you 'run out' of functionality! The original Filemaker (FM) databases use calculations stored internally. You define a field to store the result of a calculation. This could be something quite complex or a static number (or string) or data from a related database. Filemaker requires a separate database to represent the equivalent of a table in standard SQL databases. Some calculation fields can be indexed and some cannot (esp those containing related data). I expect that I can replace these calculations with functions which I define. =it sounds as if you are still getting to grips with the advantages and power that SQL and relational databases bring to 'filing' tasks. There also is a terrible possibility of terminology pollution/confusion. When I last looked at FM (many, many moons ago), I consigned it to file 13 as being too much of a 'shoebox' style 'database', and my being more interested in something PC-ish that would run something more like a table-relational model (if not SQL), eg Paradox or even Access (make signs for protection and mutter incantations to ward off the evil eye...) The problem with 'shoe box' packages
[PHP-DB] Concept help required
Hi all, In trying to learn PHP (and MySQL), I am attempting to replicate a database-web solution built previously using Filemaker Pro and Lasso (on NT). I am currently working with PHP/MySQL on NT and will be moving this to Linux before the end of January. Filemaker is able to perform calculations internally and therefore I guess I will need to write functions to mimic this externally. Am I right here? One of the features of the FMPro solution is that when a user is looking at a list of resources (in fact, university course packs) each row will display the number of associated records from the 'books' database. Now which is the best method to do this (speed/efficiency)? I have tried performing a row-level query on the related db but its very slow and times out before the second row can be displayed. Alternately, I could set the main db to increase/decrease a number field when adding or deleting books from the list. Which is recommended? Dates I played around with my learning site over the holidays and found that I was not able to easily handle dates between the format required by users (dd/mm/) and that used by MySQL (-mm-dd) and therefore I wrote functions to parse the data both ways. All the example I could find on Dates used 'today' as the example. I want to be able to play around with stored dates. Is my function method the correct way or is there another way? MTIA George in Edinburgh --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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]
Re: [PHP-DB] Concept help required
Miles, Thanks for the response. My description of the Filemaker solution was very simple. In fact it is 13 databases with some containing up to 18000 records. At the centre is a Transaction database containing 15000 'book' records. Each transaction record contains a pack ID field and this is what is queried to produce the 'count' but its painfully slow. The MySQL version of this table contains some 160 fields. In practice, this db table will grow by approx 300 records per week as new transactions are added by users (all UK universities). I also have other queries which need to be carried out to produce the information needed to provide good feedback to users. For instance, each transaction has a 'state': unsubmitted, submitted and complete. I want to be able to show the state of the pack as 'unsubmitted' when all transactions are 'unsubmitted', 'partially submitted' when some have been submitted and others not, 'submitted' when all transactions have been submitted and 'complete' when all transactions are at the 'complete' stage. So with the overall count, that would be 5 queries and I can think of at least one other query which would be needed to cover another process. If a single query is taking so long, what will 6 do to my database's overall performance? Would indexing help? George - Original Message - From: Miles Thompson [EMAIL PROTECTED] To: George Pitcher [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, January 07, 2002 1:29 PM Subject: Re: [PHP-DB] Concept help required George, Suggestions interspersed below Miles At 12:53 PM 1/7/2002 +, George Pitcher wrote: Hi all, In trying to learn PHP (and MySQL), I am attempting to replicate a database-web solution built previously using Filemaker Pro and Lasso (on NT). I am currently working with PHP/MySQL on NT and will be moving this to Linux before the end of January. Filemaker is able to perform calculations internally and therefore I guess I will need to write functions to mimic this externally. Am I right here? MySQL doesn't have stored procedures, if that's what you mean. If they are really important you might want to consider PostgreSQL. Double-check the MySQL docs, and a newer version might have this. One of the features of the FMPro solution is that when a user is looking at a list of resources (in fact, university course packs) each row will display the number of associated records from the 'books' database. Now which is the best method to do this (speed/efficiency)? I have tried performing a row-level query on the related db but its very slow and times out before the second row can be displayed. Alternately, I could set the main db to increase/decrease a number field when adding or deleting books from the list. Which is recommended? Don't do the second. You're creating a maintenance headache. I'm no SQL wizard. Are you fetching information from a courses table, and displaying the number of associated books for each course to get results like this, w/o formatting ... The Athenian Galley U. Stroke 2 Grecian Roots and Folk Clothing C. Me. Bare 4 where the number at the end is the number of books for the course? select course_name, instructor_name, count(books) from courses, books where books.course_id = courses.course_id and (whatever other criteria you are using to select the course) But something tells me that won't work and I'm no SQL wizard. Something tells me that we're venturing into GROUP BY or HAVING territory. Dates I played around with my learning site over the holidays and found that I was not able to easily handle dates between the format required by users (dd/mm/) and that used by MySQL (-mm-dd) and therefore I wrote functions to parse the data both ways. All the example I could find on Dates used 'today' as the example. I want to be able to play around with stored dates. Is my function method the correct way or is there another way? Yes - but why can't we convert the world to that oh-so-simple date format of year,month,day which sorts and indexes so beautifully and is completely unambiguous. Cheers - Miles Thompson MTIA George in Edinburgh -- 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] --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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]
Re: [PHP-DB] Concept help required
DL Neil, Thanks for your response. =As a general comment, it is always dangerous to replicate when shifting platforms, better to reverse engineer and then implement anew and taking advantages of the strengths of the new tools. This particularly when moving into the relational field... Perhaps the use of the word 'replicate' was wrong. I am in fact re-engineering based on my knowledge of how the whole operation is performed (as I designed and built the original Filemaker/Lasso system) and trying to preserve the look and feel of the web pages. =you will need to describe the 'internal calculations' before this question can be easily/sufficiently answered. However many people fail to appreciate that the (My)SQL language offers a lot of power/functionality. In your case you are going for the PHP combination so I will be quite surprised if you 'run out' of functionality! The original Filemaker (FM) databases use calculations stored internally. You define a field to store the result of a calculation. This could be something quite complex or a static number (or string) or data from a related database. Filemaker requires a separate database to represent the equivalent of a table in standard SQL databases. Some calculation fields can be indexed and some cannot (esp those containing related data). I expect that I can replace these calculations with functions which I define. =as you can see, without giving a little more information, it is very difficult to give a satisfactory answer. How about listing your table definitions/schema. Almost any retrieval operation that does not select all of the records in a table will speed up when indexes are employed. If speed is a concern then that argues against the earlier suggestion of PostGres. I think that the table definition list would be far too long for this list. Speed is an issue as at the moment I am doing all this under my own steam in my own time (partly to extend my skills) and hope to be able to persuade my bosses that this would be a beneficial move (they are very conservative). Performance improvements would help. =you are talking as if there are numerous queries. What's wrong with performing a join, or am I missing some significance? No but I probably am. I have been working almost exclusively with Filemaker for the past 7 years moving from Mac to Win NT in the process, with a short flirtation with MS Access and ASP. I'm really a SQL newbie and am gradually getting to grips with what is possible. JOINs are alien to me and I'll ned to read up and experiment with them to see how they work and how I can best use them. Dates I played around with my learning site over the holidays and found that I was not able to easily handle dates between the format required by users (dd/mm/) and that used by MySQL (-mm-dd) and therefore I wrote functions to parse the data both ways. All the example I could find on Dates used 'today' as the example. I want to be able to play around with stored dates. Is my function method the correct way or is there another way? Yes - but why can't we convert the world to that oh-so-simple date format of year,month,day which sorts and indexes so beautifully and is completely unambiguous. =Are you talking about functions implemented in PHP? Refer above, my earlier comments on the power of SQL, check out: SELECT DATE_FORMAT( colNm, format ) FROM tblNm in the manual at 6.3.4 Date and Time Functions. I'll be surprised if the long list of 'formats' doesn't give you more than enough options to keep (even Uni students) quiet! I wrote my own functions to handle dates in the way I am comfortable with. In dbdate() $input is the date pulled from MySQL and in revdate() $input is the dd/mm/ date being grabbed from the users form data. function dbdate($input) { $today = explode(-,$input); $month = $today[1]; $day = $today[2]; $year = $today[0]; $p_date = $day . / . $month . / . $year ; return $p_date; } function revdate($input) { $ztoday = explode(/,$input); $day = $ztoday[0]; $month = $ztoday[1]; $year = $ztoday[2]; $revdate = $year . - . str_pad($month, 2, 0, STR_PAD_LEFT) . - . str_pad($day, 2, 0, STR_PAD_LEFT); return $revdate; } By the way, my site is for university staff not sudents. I welcome any comments and hope to learn by implementation. Regards George --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.307 / Virus Database: 168 - Release Date: 11/12/01 _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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]
Re: [PHP-DB] newbie having problem
Jason, Having tried your suggestion, I see that I can connect to the server but cannot select the db. Where do I go from here? George - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, September 03, 2001 4:39 PM Subject: Re: [PHP-DB] newbie having problem - Original Message - From: George Pitcher [EMAIL PROTECTED] To: Torgil Zechel [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, September 03, 2001 11:19 PM Subject: Re: [PHP-DB] newbie having problem if( $result == FALSE ) { echo mysql_error(); } Yes - progress - its telling me that no database was selected. My code again: ?php mysql_connect ('pingu','root@localhost',''); mysql_select_db ('Bizplanes'); if ($Serial == ) {$Serial = '%';} if ($Type == ) {$Type = '%';} if ($Con == ) {$Con = '%';} $result=mysql_query (SELECT * FROM biz WHERE ID LIKE '%$Serial%' AND Type LIKE '%$Type%' Con LIKE '%$Con%' ORDER BY ID); ? You haven't specified a password when connecting to the server -- does it require one? Have you tried the code as per manual: $link = mysql_connect(mysql_host, mysql_login, mysql_password) or die (Could not connect); print (Connected successfully); mysql_select_db (my_database) or die (Could not select database); to ensure that you *are* able to connect to the server and also *select* the database? hth -- Jason Wong Gremlins Associates www.gremlins.com.hk Tel: +852-2573-5033 Fax: +852-2573-5851 -- 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!? Get your free @yahoo.com address at http://mail.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]
Re: [PHP-DB] newbie having problem
Oops, I forgot to say that I can handle this db as a client on the command line and it shows up under mysqlshow. George - Original Message - From: George Pitcher [EMAIL PROTECTED] To: Jason Wong [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, September 05, 2001 7:46 AM Subject: Re: [PHP-DB] newbie having problem Jason, Having tried your suggestion, I see that I can connect to the server but cannot select the db. Where do I go from here? George - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, September 03, 2001 4:39 PM Subject: Re: [PHP-DB] newbie having problem - Original Message - From: George Pitcher [EMAIL PROTECTED] To: Torgil Zechel [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Monday, September 03, 2001 11:19 PM Subject: Re: [PHP-DB] newbie having problem if( $result == FALSE ) { echo mysql_error(); } Yes - progress - its telling me that no database was selected. My code again: ?php mysql_connect ('pingu','root@localhost',''); mysql_select_db ('Bizplanes'); if ($Serial == ) {$Serial = '%';} if ($Type == ) {$Type = '%';} if ($Con == ) {$Con = '%';} $result=mysql_query (SELECT * FROM biz WHERE ID LIKE '%$Serial%' AND Type LIKE '%$Type%' Con LIKE '%$Con%' ORDER BY ID); ? You haven't specified a password when connecting to the server -- does it require one? Have you tried the code as per manual: $link = mysql_connect(mysql_host, mysql_login, mysql_password) or die (Could not connect); print (Connected successfully); mysql_select_db (my_database) or die (Could not select database); to ensure that you *are* able to connect to the server and also *select* the database? hth -- Jason Wong Gremlins Associates www.gremlins.com.hk Tel: +852-2573-5033 Fax: +852-2573-5851 -- 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!? Get your free @yahoo.com address at http://mail.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] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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-DB] newbie having problem
Hi all, I'm doing some basic php/MySQL stuff (LinuxPPC on Mac7100). I'm gettin g the following error when I search for somthing. Supplied argument is not a valid MySQL result resource in /usr/local/apache/htdocs/bizflyer/Bizflyer_R1.php on line 32 Here's my relevant code: ?php mysql_connect ('pingu','root@localhost',''); mysql_select_db ('Bizplanes'); if ($Serial == ) {$Serial = '%';} if ($Type == ) {$Type = '%';} if ($Con == ) {$Con = '%';} $result=mysql_query (SELECT * FROM biz WHERE ID LIKE '%$Serial%' AND Type LIKE '%$Type%' Con LIKE '%$Con%' ORDER BY ID); ? TABLE STUFF HERE ?php if ($row=mysql_fetch_array($result)) { # this is line 32 do { print (TRTD); print $row['ID']; print (TD); print $row['Type']; print (TD); print $row['Con']; print (TD); print $row['Operator']; print (/TD/TR); } while ($row=mysql_fetch_array($result)); } else {print (Sorry, no aircraft matching your criteria were found.);} ? = Any suggestions as to where I'm going wrong? Regards George Pitcher Technical Manager HERON Project Napier University Edinburgh EH10 5DT [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] http://www.heron.ac.uk programmer - A device for transmuting caffeine into code. _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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]
Re: [PHP-DB] newbie having problem
I did this directly into MySQL on the LinuxPPC box: mysql select * from biz where - ID LIKE '%AXD%' AND - Type LIKE '%' AND - Con LIKE '%' - ORDER BY ID; and this is the response: ++-+-+--+-+---+ | ID | Type| Con | Operator | History | Notes | ++-+-+--+-+---+ |DC | Piper Aztec | 27-4169 | | G-AXDC | |DL | Piper Twin Comanche | 30-1856 | | G-AXDL | |DM | BAE HS 125/400B | 25194 | | G-AXDM | ++-+-+--+-+---+ In these records, what is actually in the ID field is also being displayed in 'History'. Not sure if this clarifies things? George - Original Message - From: Torgil Zechel [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, September 03, 2001 11:38 AM Subject: SV: [PHP-DB] newbie having problem Check if mysql_query returns false. If it does (and im pretty sure it do), use mysql_error to check whats wrong... (Another way is to echo the query and paste it into the mysql command line client..) $result = mysql_query(...); if( $result == FALSE ) { echo mysql_error(); } I'm doing some basic php/MySQL stuff (LinuxPPC on Mac7100). I'm gettin g the following error when I search for somthing. Supplied argument is not a valid MySQL result resource in /usr/local/apache/htdocs/bizflyer/Bizflyer_R1.php on line 32 Here's my relevant code: ?php mysql_connect ('pingu','root@localhost',''); mysql_select_db ('Bizplanes'); if ($Serial == ) {$Serial = '%';} if ($Type == ) {$Type = '%';} if ($Con == ) {$Con = '%';} $result=mysql_query (SELECT * FROM biz WHERE ID LIKE '%$Serial%' AND Type LIKE '%$Type%' Con LIKE '%$Con%' ORDER BY ID); ? TABLE STUFF HERE ?php if ($row=mysql_fetch_array($result)) { # this is line 32 do { print (TRTD); print $row['ID']; print (TD); print $row['Type']; print (TD); print $row['Con']; print (TD); print $row['Operator']; print (/TD/TR); } while ($row=mysql_fetch_array($result)); } else {print (Sorry, no aircraft matching your criteria were found.);} ? = Any suggestions as to where I'm going wrong? Regards George Pitcher Technical Manager HERON Project Napier University Edinburgh EH10 5DT [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] http://www.heron.ac.uk programmer - A device for transmuting caffeine into code. _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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] Compiling MySQL Database on LinuxPPC
Hi all, Frustrated by failing compile: This is the message I get: c++: Internal compiler eror: program cc1plus got fatal signal 15 make[3]: ***[field.o] Error 1 make[3]: Leaving directory '/usr/src/mysql-3.23.37/sql' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory '/usr/src/mysql-3.23.37/sql' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/usr/src/mysql-3.23.37' make: *** [all-recursive] Error 2 Any suggestions Regards George Pitcher Technical Manager HERON Project Napier University Edinburgh EH10 5DT [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] http://www.heron.ac.uk programmer - A device for transmuting caffeine into code. _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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]
Re: [PHP-DB] Compiling MySQL Database on LinuxPPC
Justin, Thanks. It appears to happen in the same place each time I try (4 attempts as its not that quick [about 1 hr each try]). So should I download a new compiler (is it the gcc++ or if not, what?)? George - Original Message - From: Justin Buist [EMAIL PROTECTED] To: George Pitcher [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, August 27, 2001 3:33 PM Subject: Re: [PHP-DB] Compiling MySQL Database on LinuxPPC One of a few things: - Broken compiler. If it happens in the same place everytime it's in the software. - Out of memory. If you made it with something like 'make -j 200' this is likely. If you only allowed a single g++ process to run with just 'make' this likely isn't the case. - Bad memory. If you tyoe 'make' again and things keep moving along and die in a later spot, this is probably it. 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 Mon, 27 Aug 2001, George Pitcher wrote: Hi all, Frustrated by failing compile: This is the message I get: c++: Internal compiler eror: program cc1plus got fatal signal 15 make[3]: ***[field.o] Error 1 make[3]: Leaving directory '/usr/src/mysql-3.23.37/sql' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory '/usr/src/mysql-3.23.37/sql' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/usr/src/mysql-3.23.37' make: *** [all-recursive] Error 2 Any suggestions Regards George Pitcher Technical Manager HERON Project Napier University Edinburgh EH10 5DT [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] http://www.heron.ac.uk programmer - A device for transmuting caffeine into code. _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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] _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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-DB] displaying related data from MySQL
Hi all, This sounds to me like a common question but I haven't found quite what I want anywaher (maybe I've been looking in the wrong place). So apologies from a complete newbie. I have built a database with 6 tables. The Master table contains keys to the other 5 tables. I want to be able to display related data when I display search results. This is the code I've been using (trial and error) but although I get a row for each fount record, I get an error in every table cell. $result=mysql_query (select * from MASTER,ACFTREF where MASTER.MFR_MDL_CODE=ACFTREF.CODE AND MASTER.N_NUMBER LIKE '$Serial%' AND MASTER.SERIAL_NUMBER LIKE '$Con%' ORDER BY MASTER.N_NUMBER ); ? table width=100% tr valign=top td colwidth=15%Serial td colwidth=35% align=rightMaufacturer td colwidth=35% align=leftModel td colwidth=15%Con /td/tr ?php if ($row = mysql_fetch_array($result)) { do { print (TR valign=topTD bgcolor=yellowN); print $row['MASTER.N_NUMBER']; print (td); print $row['ACFTREF.MFR_NAME']; print (td); print $row['ACFTREF.TYPE_ACFT']; print (td); print $row['MASTER.SERIAL_NUMBER']; print (p/TD/TR); } while ($row = mysql_fetch_array($result)) ; } else {print Sorry, no results found!;} } ? Just for info, the Master db holds 340,000+ records. MTIA George in Edinburgh _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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-DB] Re: displaying related data from MySQL [SOLVED]
Hi all, Well, I played about abit more and discivered that I as overcomplicating things by specifying the tablename in field to be displayed. Once I set it to just display the fieldname it worked swimmingly. Now I can really get going. George - Original Message - From: George Pitcher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, August 20, 2001 1:57 PM Subject: displaying related data from MySQL Hi all, This sounds to me like a common question but I haven't found quite what I want anywaher (maybe I've been looking in the wrong place). So apologies from a complete newbie. I have built a database with 6 tables. The Master table contains keys to the other 5 tables. I want to be able to display related data when I display search results. This is the code I've been using (trial and error) but although I get a row for each fount record, I get an error in every table cell. $result=mysql_query (select * from MASTER,ACFTREF where MASTER.MFR_MDL_CODE=ACFTREF.CODE AND MASTER.N_NUMBER LIKE '$Serial%' AND MASTER.SERIAL_NUMBER LIKE '$Con%' ORDER BY MASTER.N_NUMBER ); ? table width=100% tr valign=top td colwidth=15%Serial td colwidth=35% align=rightMaufacturer td colwidth=35% align=leftModel td colwidth=15%Con /td/tr ?php if ($row = mysql_fetch_array($result)) { do { print (TR valign=topTD bgcolor=yellowN); print $row['MASTER.N_NUMBER']; print (td); print $row['ACFTREF.MFR_NAME']; print (td); print $row['ACFTREF.TYPE_ACFT']; print (td); print $row['MASTER.SERIAL_NUMBER']; print (p/TD/TR); } while ($row = mysql_fetch_array($result)) ; } else {print Sorry, no results found!;} } ? Just for info, the Master db holds 340,000+ records. MTIA George in Edinburgh _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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]