Re: [PHP-DB] Error with addition of second
echo Score 1; You'll get an error here too...missing quotes () On Sat, 18 Sep 2004 22:07:37 -0700, Cole S. Ashcraft [EMAIL PROTECTED] wrote: It doesn't like the }; On Sat, 2004-09-18 at 19:04, Mark wrote: --- [EMAIL PROTECTED] wrote: Dear friends, With 4 radio buttons and php snippet, it gives desired output, however when I add second question in the html form and variable for the same like $variable =$_POST['q'] in Php snippet it gives me error. I have pasted php code when it works and when it gives error. Did you read the error? It's pretty explicit. Any guidance, please. -- Error -- --- Parse error: parse error, unexpected ',' in C:\HOME\doctorbush\quiz.php on line 10 -- - php snnipet, code which it works with Q-1 --- ?php $variable = $_POST['R'] ; if ($variable == 3) { echo Score 1; } else { echo Score 0; }; ? -- php snippet when it gives error with addition of second question ?php $variable = $_POST['R'] ; $secondvar = $_POST['q'] ; if ($variable == 3, $secondvar== 4) { This is not a valid PHP statement. Do you mean AND, or OR? the error said line 10, right? This must be line 10. There is only one comma in it. Depending on what you mean, either use: 1- if ($variable == 3 AND $secondvar== 4) { or 2 if ($variable == 3 OR $secondvar== 4) { echo Score 1; } else { echo Score 0; ? -- Html form code --- html head title/title /head body form method=POST action=quiz.php Q-1)Law of diminished return is ;br input type=radio value=4 checked name=R Medical concept BR input type=radio value=3 checked name=R Economic BR input type=radio value=2 checked name=R Agriculture BR input type=radio value=1 checked name=R Computers BR p Also, you shouldn't have all of the radio buttons associated with the same variable checked. In fact, if this is a quiz, none should be checked. And this last question doesn't even make sense :-) Q-2)Once there is inflation ;br input type=radio value=4 checked name=q Government has to print extra currency BR input type=radio value=3 checked name=q Inflation is good for economy BR input type=radio value=2 checked name=q Inflation is diastrous for economyBR input type=radio value=1 checked name=q Inflation is not of much concern BR INPUT TYPE=SUBMIT NAME=submit VALUE=See Score /form/body /html = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a right unless you are willing to fight to death to defend everyone else's right to the same thing. *** __ Do you Yahoo!? Y! Messenger - Communicate in real time. Download now. http://messenger.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- randy [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL: Problem optimizing multi-table row deletion ... errors out :(
If the threadID column is an int, you don't need to wrap the $threadID variable in quotes. HTH ~randy On Tue, 14 Sep 2004 00:05:56 +0200, -{ Rene Brehmer }- [EMAIL PROTECTED] wrote: hi gang I'm working on optimizing the SQL for my forum system, but have run into a problem trying to optimize the function for deleting a thread with accompanying stats data and posts from the database using 1 query. The current function, that works, looks like this: // delete all traces of a thread function delThread($threadID) { $result = mysql_query(DELETE FROM hf_threads WHERE `threadID`='$threadID'); $result = mysql_query(DELETE FROM hf_thread_stats WHERE `threadID`='$threadID'); $result = mysql_query(DELETE FROM hf_posts WHERE `threadID`='$threadID'); } I went through the MySQL manual, to try and find a way to optimize this, and came up with this variant: // delete all traces of a thread function delThread($threadID) { $result = mysql_query(DELETE FROM hf_threads,hf_thread_stats,hf_posts WHERE `threadID`='$threadID') or die('Unable to delete threadbr'.mysql_error()); } only it doesn't work at all ... the error output says this: Unable to delete thread You have an error in your SQL syntax near 'hf_thread_stats,hf_posts WHERE `threadID`='85'' at line 1 (Obviously I attempted to delete the thread with ID 85 here) I'm dealing with MySQL 3.23.56-log and PHP 4.3.0 ... Any ideas for optimizing this will be greatly appreciated, esp since I'm not all that great with the more complex SQL syntax... TIA Rene -- Rene Brehmer aka Metalbunny If your life was a dream, would you wake up from a nightmare, dripping of sweat, hoping it was over? Or would you wake up happy and pleased, ready to take on the day with a smile? http://metalbunny.net/ References, tools, and other useful stuff... Check out the new Metalbunny forums at http://forums.metalbunny.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- randy [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: Another newbie question -- ANSWERED!!
On Tue, 7 Sep 2004 13:16:20 -0400 (EDT), Pete Holsberg [EMAIL PROTECTED] wrote: With a Unix shell programming background, I'm puzzled by the use of 'tics' (single quotes, apostrophes' around %$search_string%. I would have though that they would have removed the special meaning of the $. Since you started the string with dbl quotes ($sql), any variables you use in that string will work even if you wrap it in single quotes (tics). If you use single quotes for the $sql string, you have to 'step out' of the string (or whatever you call it). $sql = SELECT * FROM $table; // works $sql = 'SELECT * FROM '.$table; // works $sql = 'SELECT * FROM $table'; // doesn't work randy -- randy [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: This is awesome
I'm confused. How does this pertain to php-db? Let's keep this shit off the list please. Yours Truely, Randy On Sun, 5 Sep 2004 17:47:15 +0200, Torsten Roehr [EMAIL PROTECTED] wrote: Theeb Basheer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, If you have been marketing on the Internet for any length of time, chances are you have heard of Corey Rudl. Corey is one of the most successful REAL-LIFE Internet marketing experts online today. As one of my mentors, I have learned more about the hard- hitting Internet marketing strategies that really work directly from Corey than any other so-called Internet marketing expert. So when I saw Corey's newest idea it only took me a few minutes before I was once again amazed by the POWERFUL STRATEGIES he had uncovered. I am talking about a monthly publication that gives you the NO BS EXAMPLES of real people making real money and the exact STEP-BY-STEP DETAILS of how they're doing it! Corey introduces you to people just like you and me -- real people who are making real money on the Internet -- and shows you the exact strategies they have used to generate incomes in excess of $100,000 to $600,000 online every year... most of them working from home! I was in his new private site just yesterday, and even though I've personally been marketing on the `Net for quite some time, I learned some killer new tricks from people like... Robert who turned his $275 a week paycheck into a site of online investigative resources that takes him only 2 hours each day to run... while earning him OVER $250,000 A YEAR in profits! Ellen, a work-at-home mom who generates a great income by simply selling her homemade soaps from her site! Ken who made $300,000+ IN HIS SECOND YEAR OF BUSINESS by teaching people how to daytrade on the Internet... all from his beachfront condo in Hawaii. Andy, who makes $600,000 a year educating others about the hairloss industry and showing people how he managed to reverse his own hairloss! ... and these are just a few of the people that have already been EXTENSIVELY INTERVIEWED for Corey's brand new private web site. With his monthly subscription you will be exposed to 2 additional interviews every single month. IMPORTANT NOTE: These are not the typical amateur interviews... You will hear these people answer some extremely tough questions about the exact strategies, software, and tools they used to start, build, and grow their businesses to their current success. You'll even hear about the mistakes they made, and how they suggest YOU avoid them! So if you want to skip the failing promotions and get a personal tour of REAL WEB SITES built by REAL PEOPLE making REAL PROFITS on the Internet, then go to... http://dynamic.secretstotheirsuccess.com/t.cgi/823254 ... and take advantage of the invaluable tips and tricks that these Internet successes reveal so that you can start applying them to your business today. All the best, P.S. As an extra bonus, you'll also have the opportunity to enter a special draw for a site review done by Corey and his team (valued at $5,000). Each month, a member's site is drawn and then reviewed by Corey and his team, who dissect the site and give tips and tricks they can use to really accellerate their growth and sales. PLUS! Even if your site isn't chosen, you get the benefit of seeing all of the profitable suggestions that Corey and his team make -- many of which will likely apply to your site, too! Wow, we'll all be billionaires in a fortnight!!! ;) Torsten -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- randy [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP working but now Disobedient
?php echo($SSN[$i-1]; ? You can get rid of the open paren in the echo statement. ?php echo $SSN[$i-1]; ? randy On Wed, 1 Sep 2004 10:24:07 -0700 (PDT), Judy Picard [EMAIL PROTECTED] wrote: --- Judy Picard [EMAIL PROTECTED] wrote: Date: Wed, 1 Sep 2004 09:25:08 -0700 (PDT) From: Judy Picard [EMAIL PROTECTED] Subject: PHP working but now Disobedient To: [EMAIL PROTECTED] Thank you for your help in getting PHP working. Apparently it was working but I was loading it as a file into the browser instead of as http://. I now have two unresolved problems: Prob 1: I am getting the following error: Parse error: parse error, unexpected ';' in c:\inetpub\wwwroot\PTMemorandum6.php on line 89 Prob 2: Before the above error started, The following section was not creating 10 rows. TR?php $count=10; for ($i=0; $i $count; $i++): ? TDINPUT TYPE=Text NAME=SSN[] VALUE= size=9/TD!-- POP UP Lookup up SSN window here -- TDINPUT TYPE=Text NAME=Title[] VALUE= size=30/TD TDINPUT TYPE=Text NAME=CrsDesig[] VALUE= size=6/TD TDINPUT TYPE=Text NAME=CourseNo[] VALUE= size=3/TD TDINPUT TYPE=Text NAME=Section[] VALUE= size=3/TD TDINPUT TYPE=Text NAME=CrHrs[] VALUE= size=4/TD TDINPUT TYPE=Text NAME=FTE[] VALUE= size=6/TD TDINPUT TYPE=Text NAME=Salary[] VALUE= size=5/TD TD ALIGN=centerINPUT TYPE=Text NAME=Install[] VALUE= size=1 width=3/TD TD ALIGN=centerINPUT TYPE=Text NAME=Letter[] VALUE= size=1 width=3/TD TD ALIGN=centerINPUT TYPE=input type=text name=Other value= size=1 onClick=window.location.href='Attachments.php?count=?php echo ($count); ?'/TD/TR ? endfor ? !-- // get values back from pop up window -- !-- LINE 89 next -- TRtd1 Trying ?php echo($SSN[$i-1]; ?/td !-- next line for testing only -- TD2 Testing ?php echo($i); ?/TDTD3 Testing ? echo($SSN[$1]); ?/TD/TR __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com __ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- randy [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] DATABASE Error on form submission
//check for required fields from the form if ((!$_POST[topic_owner]) || (!$_POST[topic_title])|| (!$_POST[post_text])) { header(Location: addtopic.html); exit; } The $_POST is an associative array and the key names need to be wrapped by commas. The same error is happening on your local machine, but you notices turned off in your php.ini file. Your code should look like this... $_POST['topic_owner'] On Tue, 31 Aug 2004 01:41:32 EDT, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Dear friends, My form works on localhost and writes to mysql database with php script, however when I use same form on server over the internet, it writes to mysql database, that means no connection problem, however it gives me error stated below. Guidance, please. Error --- Notice: Use of undefined constant topic_owner - assumed 'topic_owner' in \\premfs15\sites\premium15\mrbpeace\webroot\do_addtopic.php on line 3 Notice: Use of undefined constant topic_title - assumed 'topic_title' in \\premfs15\sites\premium15\mrbpeace\webroot\do_addtopic.php on line 3 Notice: Use of undefined constant post_text - assumed 'post_text' in \\premfs15\sites\premium15\mrbpeace\webroot\do_addtopic.php on line 3 Warning: Cannot modify header information - headers already sent by (output started at \\premfs15\sites\premium15\mrbushforpeace\webroot\do_addtopic.php:3) in \\premfs15\sites\premium15\mrbpeace\webroot\do_addtopic.php on line 4 -- -- code of php file -- -- ?php //check for required fields from the form if ((!$_POST[topic_owner]) || (!$_POST[topic_title])|| (!$_POST[post_text])) { header(Location: addtopic.html); exit; } //connect to server and select database $conn = mysql_connect(orf-mysql1.briter.com, mr, p) or die(mysql_error()); mysql_select_db(meace,$conn) or die(mysql_error()); //create and issue the first query $add_topic = insert into forum_topics values ('', '$_POST[topic_title]', now(), '$_POST[topic_owner]'); mysql_query($add_topic,$conn) or die(mysql_error()); //get the id of the last query $topic_id = mysql_insert_id(); //create and issue the second query $add_post = insert into forum_posts values ('', '$topic_id','$_POST[post_text]', now(), '$_POST[topic_owner]'); mysql_query($add_post,$conn) or die(mysql_error()); //create nice message for user $msg = PThe strong$topic_title/strong topic has been created./p; ? html head titleNew Topic Added/title /head body h1New Topic Added/h1 ?php print $msg; ? /body /html - Form code -- ?php include 'menufile.php'; ? htmlcenter head titleAdd a Topic/title /head body h1Add a Topic/h1 form method=post action=do_addtopic.php pstrongYour E-Mail Address:/strongbr input type=text name=topic_owner size=40 maxlength=150 pstrongTopic Title:/strongbr input type=text name=topic_title size=30 maxlength=150 PstrongPost Text:/strongbr textarea name=post_text rows=8 cols=30 wrap=virtual/textarea Pinput type=submit name=submit value=Add Topic/p/center /form /body /html -- randy [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mac and mysql
On Tue, 31 Aug 2004 15:38:59 -0700, michael [EMAIL PROTECTED] wrote: Mac users, please forgive such a Windows-centric question, but I need your help. And you can educate me in the process. I am helping a student of mine set up a development environment with php, mysql, and a webserver, and she uses a Mac. Are there any installation issues unique to mac that I should warn her about? OS X already has Apache 1.3 installed. All she has to do is turn on web sharing. The DOCUMENT_ROOT is /Library/WebServer/Documents/. OS X also comes with a precompiled version of PHP (with MySQL support enabled). I forget which version at the moment, but it's somewhere around 4.2. So the only thing left is the MySQL part. mysql.com has a package installer for OS X. It's pretty painless to install. As long as you read the install docs for OS X. It's all there. There are other ways to install MySQL on OS X (manual compile, http://fink.sf.net/, http://darwinports.opendarwin.org/ and a handfull of others), but they require a little more effort than the packaged version at mysql.com. http:/www.entropy.ch used to maintain the OS X version of MySQL and Marc still has documentation on how to set everything up (he also has precompiled version of PHP for OS X users as well). Can you recommend a simple web server - she is brand new to server-side work and I am trying to make this as painless as possible. Usually I recommend that students use Xitami, but I don't believe it comes in a Mac flavor. Does the Mac OS come with a server, such as IIS on Windows? Does Apache work well with Mac? Is there anything simpler? And here's a question I've never thought about. If she installs MySQL on a Mac, and she wants to admin the server through a command line --- does Mac have a command line tool to work with? Typically, when you think command line you think of the old dos prompt. What does the Mac have that will give us command line access? Funny, when I think of 'command line' I think of UNIX. Interesting. Oh, OS X is UNIX based by the way... look in /Applications/Utilities/ and you'll find your 'Terminal' app for all your command line needs. You may need to add the location of the `mysql` binary to your $PATH (unless you want to type /usr/local/mysql/bin/mysql everytime you want to use the command line). Again, please excuse my ignorance, but here is an opp to educate those of us stuck in a MS POV. Thank you in advance. NP. Hope this helps. Michael -- randy [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] I have a CR-LF problem when pulling stuff out of my DB
Maybe I'm missing something...but why not do this with PHP (seeing as how this is a PHP list)? ereg_replace('(\r|\n)', ' ', $string) Just a thought On Thu, 19 Aug 2004 12:01:46 -0400, Michael Cortes [EMAIL PROTECTED] wrote: I found part of the answer.. when doing a search in vim you can hit ctrl-m as long as you hit ctrl-v first. ctrl-v tells vim to treat the following as a character, not to do the action i.e... carriage return. Now I need just one more piece, if anyone has the answer: ctrl-m is a carriage return. Does anyone know what ctrl seqence is line feed? Thanks On Thursday 19 August 2004 09:49 am, Michael Cortes wrote: That didn't work. Here's why. This is not a dos file. It is a unix file but when dumping the data from my db, some fields had a trailing CR and LF. So what I ended up with was a ^M showing in the middle of a line when I open the file in vim. And... the lines will also end where they shouldn't. What is supposed to be one line, then continues on the next. While dos2unix did strip out the ^m, it left the LF (is it return or linefeed in unix) at the end of the line, starting a new one. I need to actually do a search on ^M followed by LF and replace it with nothing so I get my full line back. But I don't know how to enter in LF or CR in a vim search string. Hope this clarifies. -- Michael Cortes Fort LeBoeuf School District 34 East Ninth Street PO Box 810 Waterford PA 16441-0810 814.796.4795 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- randy [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Check Boxes
If one of the checkboxes is NOT checked, then your query will break as ift will look something like this: SELECT xxx,,yyy FROM form; Name your checkboxes like so: ch[] input type=checkbox name=ch[] value=Enter_Date/ Then you can loop through the checkbox array and run your query that way $chkboxes = $_POST['ch']; $sql = 'SELECT '; foreach($chkboxes as $k = $v) { $sql .= $v; if($k (sizeof($chkboxes) - 1)) { $sql .= ', '; } } $sql .= ' FROM form'; On Wed, 18 Aug 2004 15:01:01 +0530, balwantsingh [EMAIL PROTECTED] wrote: i am using following coding $a1 = $_POST['ch1']; $a2 = $_POST['ch2']; $a3 = $_POST['ch3']; if ($a1 or $a2 or $a3) { $query = SELECT $a1, $a2, $a3 FROM form; [EMAIL PROTECTED] ($query); } Enter_Dateinput type=checkbox name=ch1 value=Enter_Date Opening_Unitsinput type=checkbox name=ch2 value=Opening_Units Unit_Consumedinput type=checkbox name=ch3 value=Unit_Consumed -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 18, 2004 5:43 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Check Boxes balwantsingh wrote: can somebody advise me i want to use checkboxes on my website, i want that if user selects some checkboxes (there will be more than 20 checkboxes), checkbox's value will be stored in variables and than SELECT query command will be run using these variables through PHP. but my problem is that in SELECT query command after each column name comma (,) is required and if i use the same than it is displaying You have an error in your SQL syntax near 'FROM form' at line 1 How about showing us some code kind of hard to help without that... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- randy [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Check Boxes
yeah yeah...it's damn near 4 in the morning here...my brain isn't exactly on at the moment. :) On Wed, 18 Aug 2004 11:35:59 +0100, Ford, Mike [LSS] [EMAIL PROTECTED] wrote: On 18 August 2004 11:24, randy wrote: $chkboxes = $_POST['ch']; $sql = 'SELECT '; foreach($chkboxes as $k = $v) { $sql .= $v; if($k (sizeof($chkboxes) - 1)) { $sql .= ', '; } } $sql .= ' FROM form'; $sql = 'SELECT ' . implode(', ', $chkboxes) . 'FROM form'; Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- randy [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: MySQL denying access to everything
you need to ditch the 'data' directory (in the MySQL installation root) and start from scratch. If you just re-install the MySQL server, I don't think it will overwrite your data directory. On Wed, 18 Aug 2004 10:30:25 EDT, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Look I'm totally new to this, so all this MySQL stuff you are sending me too is like an alien language to me. Can you just tell me how to delete all this MySQL stuff so I can start again or something? Because even when I reinstall MySQL and delete my old MySQLgui.exe, it still gives me the same problem... -- randy [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL to EXCEL?
You could always use phpMyAdmin...I believe it will export to Excel (if not, CSV file). http://phpmyadmin.sourceforge.net/ On Tue, 17 Aug 2004 15:36:49 -0400, Chris Payne [EMAIL PROTECTED] wrote: Hi there everyone, I'm having a dilemma (Now that I have power back after the hurricane hit us directly in Orlando). Anyway, I need to export a database table to Excel, I can do it as a .txt file without a problem, but I can't seem to get it to put each column into a separate cell when I try to export as an .xls form, I think I have this line formed incorrectly for an XLS file, can anyone see if I need to use any special characters rather than a comma? fwrite($filesession,$id,$new,$recno,$category,$product,$description,$unit,$ certificate,$instock,$orderpt,$ordernow,$vendor,$unitcost,$unitsell\015\012 ); Thank you. Chris -- randy [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: AW: [PHP-DB] Re: Subject: LOAD DATA LOCAL INFILE
This is a setting in MySQL that you have to explicitly turn on at compile time. --enable-local-infile Enable LOAD DATA LOCAL INFILE (default: disabled) I suspect that's what _might_ be happening. On Mon, 16 Aug 2004 15:33:37 +0200, Daniel Kradolfer [EMAIL PROTECTED] wrote: mysql_error() says: 1148:The used command is not allowed with this MySQL version The same Script worked fine before we updated PHP and MySQL. The query works at the mysql shell prompt. But here it is: LOAD DATA LOCAL INFILE '/[Path]/inc/../in/wbsuser.src' REPLACE INTO TABLE user fields terminated by ';' LINES TERMINATED BY '\r\n' (userid,username,gruppe,knr,anrede,vorname,name,firma,firma2,strasse,plz,ort , land,telefon,telefax,email,www,kennwort,zahlbed,la_anrede,la_vorname,la_name , la_firma,la_firma2,la_strasse,la_plz,la_ort,la_land,la_telefon,la_telefax, onlineupd,bank,blz,kontonr,kontoinh,aktiv,loeschen,zusatz,ustid) ; (I replaced [Path] for security reasons) This php code is generated by a Windows App and i don't have the possibilty to change some thing. Thanks Dani I often had trouble getting the syntaxt just right with PHP, it's easy to end up with the wrong number of slashes around the -lines terminated by '- parts of this. When you ran your query, what did mysql_error() say about it ? That would be a line you add directly after the line mysql_query($link,$query) Usually this will tell you immediately if you have an error in your SQL, and echoing the $query string you passed to MySQL is a good idea too, it can be more obvious to diagnose when it's printed on screen. Cheers - Neil At 12:41 16/08/2004 +, you wrote: From: Daniel Kradolfer [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: Mon, 16 Aug 2004 14:40:49 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: LOAD DATA LOCAL INFILE Hello I'm new to this list. I diden't found anything in the archive and by googleing to solve my problem. We have updated our server to PHP 4.3.8 and MySQL 4.0.2. Some of our clients run a shop software that need 'LOAD DATA LOCAL INFILE' to store its data to MySQL. MySQL itself supports the command. I can run it from mysql-client. That works. I have read about the fix on php.net (http://www.php.net/ChangeLog-4.php / http://bugs.php.net/28632). Until now, i couldn't find a solution to get it work. Is there way to get it work? Regards Dani CaptionKit http://www.captionkit.com : Production tools for accessible subtitled internet media, transcripts and searchable video. Supports Real Player, Quicktime and Windows Media Player. VideoChat with friends online, get Freshly Toasted every day at http://www.fresh-toast.net : NetMeeting solutions for a connected world. -- 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 -- randy [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MAILING LIST QUESTION
/script encoding. ; Some encoding cannot work as internal encoding. ; (e.g. SJIS, BIG5, ISO-2022-*) ;mbstring.internal_encoding = EUC-JP ; http input encoding. ;mbstring.http_input = auto ; http output encoding. mb_output_handler must be ; registered as output buffer to function ;mbstring.http_output = SJIS ; enable automatic encoding translation accoding to ; mbstring.internal_encoding setting. Input chars are ; converted to internal encoding by setting this to On. ; Note: Do _not_ use automatic encoding translation for ; portable libs/applications. ;mbstring.encoding_translation = Off ; automatic encoding detection order. ; auto means ;mbstring.detect_order = auto ; substitute_character used when character cannot be converted ; one from another ;mbstring.substitute_character = none; ; overload(replace) single byte functions by mbstring functions. ; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(), ; etc. Possible values are 0,1,2,4 or combination of them. ; For example, 7 for overload everything. ; 0: No overload ; 1: Overload mail() function ; 2: Overload str*() functions ; 4: Overload ereg*() functions ;mbstring.func_overload = 0 [FrontBase] ;fbsql.allow_persistent = On ;fbsql.autocommit = On ;fbsql.default_database = ;fbsql.default_database_password = ;fbsql.default_host = ;fbsql.default_password = ;fbsql.default_user = _SYSTEM ;fbsql.generate_warnings = Off ;fbsql.max_connections = 128 ;fbsql.max_links = 128 ;fbsql.max_persistent = -1 ;fbsql.max_results = 128 ;fbsql.batchSize = 1000 [Crack] ; Modify the setting below to match the directory location of the cracklib ; dictionary files. Include the base filename, but not the file extension. ; crack.default_dictionary = c:\php\lib\cracklib_dict [exif] ; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS. ; With mbstring support this will automatically be converted into the encoding ; given by corresponding encode setting. When empty mbstring.internal_encoding ; is used. For the decode settings you can distinguish between motorola and ; intel byte order. A decode setting cannot be empty. ;exif.encode_unicode = ISO-8859-15 ;exif.decode_unicode_motorola = UCS-2BE ;exif.decode_unicode_intel= UCS-2LE ;exif.encode_jis = ;exif.decode_jis_motorola = JIS ;exif.decode_jis_intel= JIS ; Local Variables: ; tab-width: 4 ; End: -- randy [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: MySQL executes several times the same request
I'm not sure where the value of $counter is coming from, but it you're getting it from a SQL SELECT query, it would be more efficient to just use: UPDATE statistics SET VALUE(`counter` = `counter`+1) It's just one less query on the DB, which could make a difference if you're getting heavy traffic. $counter++; $SQL = UPDATE statistics SET VALUE (`counter` = $counter) $res = mysql_query($SQL); mysql_closedb($DB); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Multiple word queries
By Shiloh's description, I think you want to replace AND with OR - using AND will only return rows that contains every word, while using OR will match any row that has any of them. On Wed, 30 Jun 2004 23:22:04 -0400, John W. Holmes [EMAIL PROTECTED] wrote: For that simple example, you can just explode the string on the space and create a WHERE clause entry for each word. For example: $words = explode(' ',$_GET['search_text']); foreach($words as $word) { $query .= AND column LIKE '%$word%' ; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] International Addresses and Telephones
I have a form which captures US addresses ( address, city, state ) and telephone numbers ( 10 digit ) and am writing this data to a MySQL table. I need to expand this to capture non-US info, so I was hoping for some guidance on forms and table structures. I have googled this to death and still haven't come up with anything.
[PHP-DB] PHP, MySQL and Flash
Does anyone know of any articles on integrating PHP, MySQL and Flash to perform a drag and drop routine for updating a db? Specifically, I have a client who is _INSISTING_ that I integrate a drag and drop feature into his railcar storage application. He wants to be able to view two railcar storage tracks, Track A and Track B, then drag and drop cars from Track A to Track B ( or Track B to Track A ). Once he positions ( orders ) all the cars properly on each track, I need to update a MySQL db to reflect the changes. I have already developed the above feature so that he can do this 'textually', but he is _determined_ that he must have the graphic 'drag and drop' feature. There may be another method ( Javascript ? ) to accomplish the same effect. I am certainly open to any advice and/or opinions. Any pointers would be _greatly_ appreciated. Thanks, Randy Rankin
RE: [PHP-DB] Datetime help in an INSERT...
If you are using MySql with the date field is of type timestamp, you should have to insert anything using the query. It will update automatically when the record is inserted and/or updated. ie; $denylog = INSERT INTO deny (account, td ) VALUES ($tmp, $td ); Randy -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 1:47 PM To: '[EMAIL PROTECTED]' Cc: '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Datetime help in an INSERT... The error I am receiving is: You have an error in your SQL syntax near ' NOW())' at line 1 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 1:45 PM To: NIPP, SCOTT V (SBCSI) Subject: Re: [PHP-DB] Datetime help in an INSERT... what kind of error are you getting? I am stumbling across something that I thought I have done before, and I am not having any luck finding an example of this. Basically, I am wanting to timestamp the date and time into new entries in a simple database table. The following section is the actual code for this, and I cannot figure out how to get the date/time stamp to populate into the database. Thanks in advance for the help. I suspect this is a very simple fix. $denylog = INSERT INTO deny (account, td, date) VALUES ($tmp, $td, NOW()); $denylog_result = mysql_query($denylog, $Prod) or die(mysql_error()); 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] Datetime help in an INSERT...
Correction ( I typed this in a hurry ) ... If you are using MySql and the date field is of type timestamp, you should _not_ have to insert anything using the query. It will update automatically when the record is inserted and/or updated. ie; $denylog = INSERT INTO deny (account, td ) VALUES ($tmp, $td ); Randy -Original Message- From: Rankin, Randy [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 1:56 PM To: '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Datetime help in an INSERT... If you are using MySql with the date field is of type timestamp, you should have to insert anything using the query. It will update automatically when the record is inserted and/or updated. ie; $denylog = INSERT INTO deny (account, td ) VALUES ($tmp, $td ); Randy -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 1:47 PM To: '[EMAIL PROTECTED]' Cc: '[EMAIL PROTECTED]' Subject: RE: [PHP-DB] Datetime help in an INSERT... The error I am receiving is: You have an error in your SQL syntax near ' NOW())' at line 1 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 1:45 PM To: NIPP, SCOTT V (SBCSI) Subject: Re: [PHP-DB] Datetime help in an INSERT... what kind of error are you getting? I am stumbling across something that I thought I have done before, and I am not having any luck finding an example of this. Basically, I am wanting to timestamp the date and time into new entries in a simple database table. The following section is the actual code for this, and I cannot figure out how to get the date/time stamp to populate into the database. Thanks in advance for the help. I suspect this is a very simple fix. $denylog = INSERT INTO deny (account, td, date) VALUES ($tmp, $td, NOW()); $denylog_result = mysql_query($denylog, $Prod) or die(mysql_error()); 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] Generating view of tree?
If I understand correctly and you have the data all in one table, you can just query all the data that goes into the report, sorted by categories, and output the data in a loop. This code will give you an ordered list indented and numbered by level. It's not perfect, but give you the idea... $qstr=SELECT * FROM table ORDER BY cat1, cat2, cat3; $rslt=mysql_query($qstr); $cat1=x; $cat2=x; $cat3=x; while ($row = mysql_fetch_array($rslt)) { if ($cat1!=$row['cat1']) { $indent=1-; $cat1=$row['cat1']; echo $indent $cat1BR; } if ($cat2!=$row['cat2']) { $indent=nbsp;nbsp;2-; $cat2=$row['cat2']; echo $indent $cat2BR; } if ($cat3!=$row['cat3']) { $indent=nbsp;nbsp;nbsp;nbsp;3-; $cat3=$row['cat3']; echo $indent $cat3BR; } } Hope that helps. -- Best regards, Randy Wednesday, March 26, 2003, 8:18:50 PM, you wrote: I have a table with a tree. Thing is, I need to generate a view of it like: Category Sub-category Sub-sub-category Another sub-category Another category Sub-category Any way to do this, without using a huge number of queries? Using MySQL. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Help with MySQL Logic
Thanks to everyone for your help. I was able to work out the logic last night based on your fine suggestions and all is well! Thanks again. Randy -Original Message- From: 1LT John W. Holmes [EMAIL PROTECTED] Sent: Monday, March 03, 2003 10:30 AM To: Rankin, Randy; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Help with MySQL Logic A client of mine, a rail car storage company, has asked that I create a PHP/MySQL application in which they will maintain and track rail cars. I am having a bit of trouble however working through one of thier requirements. They need to know in what position the rail car is on each track. For example, they might have a track called X which will hold 30 rail cars. They would enter the car information for 30 cars and associate each of them with track X. If one of the car owners decides to move car 3 out of storage, then the remaining 29 cars must be re-numbered ( ie; car 1 and 2 would remain and car 4-30 would become car 3-29 ). In the same manner, I need to be able to add a car to the track once an empty slot is available. For example, If the new car goes at the front of the track then it would become car 1 and the remaining cars, originally numbered 1-29 would become 2-30. Not sure if this helps or if you already realize this... Say you have a table that identifies the track_id and car_id. Now, you delete the car_id for car #3, like you've said. So, that row is deleted and you've got a hole now. You can run a query such as: UPDATE table SET car_id = car_id - 1 WHERE car_id BETWEEN 4 AND 30 AND track_id = XX to adjust all of the other car_id numbers. Now, say you want to add a new car to the beginning. UPDATE table SET car_id = car_id + 1 WHERE track_id = XX and then insert your new car at position #1. Throw in some checks to make sure you don't go over 30 cars and you should have it. You can get a count of how many cars are on a certain track with: SELECT COUNT(*) AS c FROM table WHERE track_id = XX Hope that helps. It sounds like a fun project. ---John Holmes...
[PHP-DB] Help with MySQL Logic
Hello All, This may be a bit off topic. If so, my apololgies. A client of mine, a rail car storage company, has asked that I create a PHP/MySQL application in which they will maintain and track rail cars. I am having a bit of trouble however working through one of thier requirements. They need to know in what position the rail car is on each track. For example, they might have a track called X which will hold 30 rail cars. They would enter the car information for 30 cars and associate each of them with track X. If one of the car owners decides to move car 3 out of storage, then the remaining 29 cars must be re-numbered ( ie; car 1 and 2 would remain and car 4-30 would become car 3-29 ). In the same manner, I need to be able to add a car to the track once an empty slot is available. For example, If the new car goes at the front of the track then it would become car 1 and the remaining cars, originally numbered 1-29 would become 2-30. I hope I explained thourougly. Any suggestions would be appreciated. Randy
Re: [PHP-DB] mysql_insert_id() vs. last_insert_id()
on 1/28/03 11:42 AM, John W. Holmes at [EMAIL PROTECTED] wrote: The reason I ask is, if you use mysql_insert_id() on a busy server and it does not function on a per-connection basis, don't you run the risk of getting the last ID of somebody else's INSERT query on the server? Yes, they are both on a per-connection basis. They'd be useless otherwise. I agree. Although, the MySQL docs are confusing on the distinction between these two functions in my opinion. The one thing that jumps out at me is that if you insert multiple rows at the same time with an insert statement, LAST_INSERT_ID() returns the value for the first inserted row only, whereas MYSQL_INSERT_ID() returns the last id inserted. Am I reading that right? I guess the question is: Why is it useful to only store the first id? When would you want that? -- Randy Phillips www.phillips-it.com phillipsIT, L.L.C. voice: 636.390.9468 Senior Web DevelopereFax: 501.423.3817 -- Get SideKick - for MySQL - http://www.phillips-it.com/sidekick -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] mysql_insert_id() vs. last_insert_id()
Hi I've been checking the last_insert_id() function out and I am curious. The MySQL docs say to use the mysql_insert_id() function after an insert into query to grab the key value. Both seem to work; however, there are some subtle differences. Which is the best one to use after a single insert statement, or does it matter? -- Randy Phillips www.phillips-it.com phillipsIT, L.L.C. voice: 636.390.9468 Senior Web DevelopereFax: 501.423.3817 -- Get SideKick - for MySQL - http://www.phillips-it.com/sidekick -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Looking for Beta testers
Hi, I have been developing a Java Swing UI for MySQL and I am to a point where I need to have some PHP developers try it out. This is NOT an interface that manages your databases, tables and columns. What it does is allows you to connect to a database on your MySQL server, select a table and get a list of its column names. You then select an HTML form element from a pull down menu, such as, a text field or radio button, and drag and drop the column name into your text editor. It concatenates the column name, the html and the PHP for you. I am especially interested in having the PHP code that the application writes evaluated. I want it to be generic enough to accommodate a lot of different coding styles but not so simple that it does not save the developer any time writing repetitive code, which is the point. It should run on any Java virtual machine supporting JDBC-1.2 or JDBC-2.0 (JDK-1.2 or higher) and connect to any MySQL server supporting version 9 or 10 of the MySQL protocol. I have tested it on MacOSX and Windows 2000. I would like to know how it behaves on Linux or other systems running the latest JVM. If you would like to test a demo feel free to contact me off list. Thanks, -- Randy Phillips www.phillips-it.com phillipsIT Voice: 636.390.9468 Senior Web DevelopereFax: 501.423.3817 -- - Interesting Technology For Your Business - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Broken Links 2
Thanks to everyone for the help. For those interested, I have posted the final code below. It functions beautifully with one exception: the resized image quality is rather poor. I am now reading through the php manual and newsgroups for a solution, but if anyone knows how to handle this it would be great to hear from you. Thanks again for all your help! Randy - BEGIN CODE -- ? if( $image_id ) { $sql=SELECT image_bin_data from IMAGES where image_id='$image_id'; $result=db_query ( $sql ); $record=db_fetch_object ( $result ); $image=$record-image_bin_data; $new_w=75; $new_h=75; Header(Content-type: image/png); $src_img=ImageCreateFromString($image); $dst_img=ImageCreate($new_w, $new_h); ImageCopyResampled($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img) ,ImageSY($src_img)); ImagePng($dst_img); ImageDestroy($dst_img); };? - END CODE --
[PHP-DB] First record of array not being echoed
Good morning all. I am attempting to create a table in which there is a title cell populated with a training wave number and then I would like to echo all members of each training wave below the title cell (See example below for clarification). All seems to be working with one exception. The first record of each array is not being echoed. If I run the query in MySQL, all rows are returned, so it must just be something I am not seeing in the code (which is posted below). Thanks in advance for any help. Randy -- START EXAMPLE --- Training Wave: I-02 Brumley, Kennith Dillard, Lori Hamilton, Don Larsen, Gerry Robinson, Bobby Sarabi, Ray Shaddix, Kirby Springer, Leon Training Wave: II-02 Boles, Scooby Deloney, Jerald Russell, Roger Smith, Martha Stockman, Joe Williams, Ed ETC, ETC, ... -- END EXAMPLE --- BEGIN CODE SNIPET - ? $sql = SELECT u.last_name, u.first_name, w.wave_id, w.wave_num FROM USERS u, WAVES w WHERE w.wave_id = u.wave_id AND u.plant_id = '$plant_id' ORDER BY w.wave_id ASC, u.last_name ASC; $result = db_query ( $sql ); for ( $i = 0; $i db_num_rows ( $result ); $i++ ) { $record = db_fetch_object ( $result ); if ( $record-wave_num != $prior_wave ) { $prior_wave = $record-wave_num; ? table width=375 cellpadding=0 cellspacing=0 border=0 tr td colspan=2 height=10?php echo FILLER; ?/td /tr tr height=20 bgcolor=? echo $color2; ? tdb class=bGraybnbsp;Training Wave: ? echo $prior_wave; ?/b/td td align=rightnbsp;/td /tr tr td colspan=2 height=10?php echo FILLER; ?/td /tr /table ? } else { ? table width=575 cellpadding=0 cellspacing=0 border=0 tr tdnbsp; ? echo $record-last_name . , . $record-first_name; ?/td /tr /table ? } } } } ? - END CODE SNIPET -
RE: [PHP-DB] First record of array not being echoed
Thanks Marco! It's working now. Based on your suggestion, here is waht I came up with. It's working now. Randy SNIP table width=375 cellpadding=0 cellspacing=0 border=0 tr td colspan=2 height=10?php echo FILLER; ?/td /tr tr height=20 bgcolor=? echo $color2; ? tdb class=bGraybnbsp;Training Wave: ? echo $prior_wave; ?/b/td td align=rightnbsp;/td /tr tr td colspan=2 height=10?php echo FILLER; ?/td /tr -- ADDED THIS HERE --- tr tdnbsp; ? echo $record-last_name . , . $record-first_name; ?/td /tr --- END ADDED CODE /table ? } else { ? table width=575 cellpadding=0 cellspacing=0 border=0 tr tdnbsp; ? echo $record-last_name . , . $record-first_name; ?/td /tr /table -- END SNIP -Original Message- From: Marco Tabini [EMAIL PROTECTED] Sent: Monday, October 14, 2002 7:17 AM To: Rankin, Randy Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] First record of array not being echoed It seems to me that the first time you go through the loop, if $record-wave_num is != $prior_wave then you print the wave number but not the person's name--but you already have a record there with a person's name! Try taking out the else statement--if you follow the code from there you should be able to fix it up. Of course, I'm also doing this by just looking at your code, so I may be wrong (the odds are not in my favor) :-) On Mon, 2002-10-14 at 07:58, Rankin, Randy wrote: Good morning all. I am attempting to create a table in which there is a title cell populated with a training wave number and then I would like to echo all members of each training wave below the title cell (See example below for clarification). All seems to be working with one exception. The first record of each array is not being echoed. If I run the query in MySQL, all rows are returned, so it must just be something I am not seeing in the code (which is posted below). Thanks in advance for any help. Randy -- START EXAMPLE --- Training Wave: I-02 Brumley, Kennith Dillard, Lori Hamilton, Don Larsen, Gerry Robinson, Bobby Sarabi, Ray Shaddix, Kirby Springer, Leon Training Wave: II-02 Boles, Scooby Deloney, Jerald Russell, Roger Smith, Martha Stockman, Joe Williams, Ed ETC, ETC, ... -- END EXAMPLE --- BEGIN CODE SNIPET - ? $sql = SELECT u.last_name, u.first_name, w.wave_id, w.wave_num FROM USERS u, WAVES w WHERE w.wave_id = u.wave_id AND u.plant_id = '$plant_id' ORDER BY w.wave_id ASC, u.last_name ASC; $result = db_query ( $sql ); for ( $i = 0; $i db_num_rows ( $result ); $i++ ) { $record = db_fetch_object ( $result ); if ( $record-wave_num != $prior_wave ) { $prior_wave = $record-wave_num; ? table width=375 cellpadding=0 cellspacing=0 border=0 tr td colspan=2 height=10?php echo FILLER; ?/td /tr tr height=20 bgcolor=? echo $color2; ? tdb class=bGraybnbsp;Training Wave: ? echo $prior_wave; ?/b/td td align=rightnbsp;/td /tr tr td colspan=2 height=10?php echo FILLER; ?/td /tr /table ? } else { ? table width=575 cellpadding=0 cellspacing=0 border=0 tr tdnbsp; ? echo $record-last_name . , . $record-first_name; ?/td /tr /table ? } } } } ? - END CODE SNIPET -
[PHP-DB] Confused
I have two MySQL tables, groups and users: groups: group_id, group_name users: user_id, user_name, group_id, etc. I would like to produce one table for each group which will list all the members for that particular group. For example: Blue (group_id 1) Tom (group_id 1) Nancy (group_id 1) Jim (group_id 1) Red (group_id 2) Bob (group_id 1) Susan (group_id 1) James (group_id 1) ... My question is, do I need to run 2 queries? The first to select all the groups and the second to select all the users in each group based on the group_id? How would I loop through to create a table for each group? Thanks inadvance for any help. Randy Rankin
RE: [PHP-DB] Determine last quarter
If anyone is interested, this is what I finally came up with. I'm not sure how graceful it is, but it works ;) ? $quarter = ceil(date('n')/3); if ($quarter = 1) { $period_first_day = date(Y-m-d, mktime(0,0,0,10,1,date(Y)-1)); $period_last_day = date(Y-m-d, mktime(0,0,0,12,31,date(Y)-1)); } elseif ($quarter = 2) { $period_first_day = date(Y-m-d, mktime(0,0,0,1,1,date(Y))); $period_last_day = date(Y-m-d, mktime(0,0,0,3,31,date(Y))); } elseif ($quarter = 3) { $period_first_day = date(Y-m-d, mktime(0,0,0,4,1,date(Y))); $period_last_day = date(Y-m-d, mktime(0,0,0,6,30,date(Y))); } elseif ($quarter = 4) { $period_first_day = date(Y-m-d, mktime(0,0,0,7,1,date(Y))); $period_last_day = date(Y-m-d, mktime(0,0,0,9,30,date(Y))); } echo Start of Period: $period_first_daybr; echo End of Period: $period_last_day; ? -Original Message- From: Rankin, Randy [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 19, 2002 8:57 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Determine last quarter Hello all, Does anyone know how I might determine the start date and end date of the previous calendar quarter based on today's date. For example, today is 2002-03-19, so the previous quarter start date would return 2001-10-01 and the previous quarter end date would return 2001-12-31. I am trying to determine these dates for a report that generates previous quarter sales based on today (whatever 'today' might be). Hope that's clear. Thanks in advance, Randy Rankin
[PHP-DB] Determine last quarter
Hello all, Does anyone know how I might determine the start date and end date of the previous calendar quarter based on today's date. For example, today is 2002-03-19, so the previous quarter start date would return 2001-10-01 and the previous quarter end date would return 2001-12-31. I am trying to determine these dates for a report that generates previous quarter sales based on today (whatever 'today' might be). Hope that's clear. Thanks in advance, Randy Rankin
RE: [PHP-DB] increase date()
Try this: $six_months_from_now = date(Y-m-d, mktime(0,0,0, date(m)+6, date(1), date(Y))); echo Six Months From Now: $six_months_from_nowP; -Original Message- From: its me [mailto:[EMAIL PROTECTED]] Sent: Sunday, March 17, 2002 12:28 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] increase date() i have: $nowdate=date(Y-m-d); and i want to increase it by 6 months,how can i do that?? Rehab M.Shouman - Express yourself with a super cool email address from BigMailBox.com. Hundreds of choices. It's free! http://www.bigmailbox.com - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] creating a drop down menu from mysql categories
Chad, Try something like this: - ? $qry = SELECT category_id, category_name from tblCategories; $result = mysql_query($query); ? form method=POST name=criteria action=my_postpage.php select name=categories ? while ($category_array = mysql_fetch_array($result)) { print OPTION value=.category_array[category_id]. $category_array[category_name]/OPTION; } ? /select - Randy -Original Message- From: chad kellerman [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 6:47 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] creating a drop down menu from mysql categories Hello everyone, I am a little new to the list. I have been reading a lot of the posts but have not submitted yet. But I ran into a problem I was hoping I might get e little help or at least get a point in the right direction. I have a table called tblCategories with field category_ID with is auto_incremented and another field called category_name. I wish to have a drop down menu on an html page that is generated automatically with Category_name as the option and the option value=category_ID. It is going in a form which I submit and adds to a mysql database. Everything is working fine except I cannot create the drop down menu out of php. I would rather not have to edit my html page when ever I add a category. Is there any place I can look to see how someone else has accomplished this? Or is there any specific function I should research in the php.net manual pages? I have been looking but not too successfull. thank you for any help you can offer. -chad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Dynamic Drop Down Box
Does anyone know how I might populate a drop down box based on the users selection from a previous drop down box? For example, if I have a table called 'autos' with 2 fields, 'make' and 'model'. I select distinct 'make' and populate the first drop down box. Based on the user selection, the 2nd drop down box would be populated with the distinct 'make' for that model (ie; if the user selects Ford in the first drop down, the 2nd drop down would be populated with Explorer, Expedition, Ranger, etc.). Thanks, Randy Rankin
[PHP-DB] Dynamic Table Columns
I have a form (criteria.php) that includes two drop down lists from which a user can select a start period and an end period from a MySQL table. This form posts to a form called order_summary.php on which I am using the $start_period and $end_period variables from the criteria.php form to pull data from another MySQL table which will produce a summary of sales for those periods as illustrated by the following example: $start_period $end_period$total - Order Type | APR-00| MAY-00| Total | - Widget 1 | $100 | $200 | $300 | Widget 2 | $300 | $200 | $500 | . . . OK. Fine and good. I have this working. My problem is this: How can I create a table which will dynamically adjust the number of columns based on the users request. That is, if the user requests APR-00 through MAY-00, the table will be built as illustrated above. If the user requests JAN-01 through JUN-00, the table will be built as illustrated below: $start_period through $end_period -- Order Type | JAN-01| FEB-01| MAR-01| APR-01| MAY-01 | JUN-01|Total | -- Widget 1 | $100 | $200 | $300 | $300 | $300 | $300 | $300 | Widget 2 | $300 | $200 | $500 | $300 | $300 | $300 | $300 | . . . I have posted order_summary.php below. Any thoughts? Thanks, Randy Rankin order_summary.php ** ? session_register($dbname); ? ? require(./includes/salesdb.inc); $query_first_last_period = select period_id, period_name from periods where period_id between $start_period_id and $end_period_id GROUP BY period_id HAVING period_id = $start_period_id OR period_id = $end_period_id ORDER BY period_id; $result_first_last_period = mysql_query($query_first_last_period); $row = mysql_fetch_row($result_first_last_period); for( $i= 0; $icount($row);$i++ ) { if( $i == 0 ) $start_period_name = $row[$i]; elseif( $i == (count($row)-1) ) $end_period_name = $row[$i]; } echo font face=Tahoma size=2 color=#333999; echo Salesperson: b$dbname/bbr; echo Report Period: b$start_period_name through $end_period_name/b; echo /fontP; echo table border=0 cellpadding=2 cellspacing=2; echo tr bgcolor=#99font face=Tahoma size=2 color=#ff; echo th align=left bordercolor=#808080font color=#FF face=Tahoma size=2bCategory/b/font/th; // Start Get the Order Summary Data *** $sql_order_summary = SELECT order_type, SUM(extended_dollars) from salesdata where salesperson = '$dbname' and period_id between '$start_period_id' and '$end_period_id' group by order_type; $result_order_summary = mysql_query($sql_order_summary) or die (I can't get the sales data!); // Stop Get the Order Summary Data *** // Start Get the Period Names for the Table Header *** $sql_period_name = Select period_name from periods where period_id between '$start_period_id' and '$end_period_id' order by period_id; $result_period_name = mysql_query($sql_period_name) or die (I can't get the period name!); // End Get the Period Names for the Table Header *** // Build and Print the Table Headers *** $num_periods = mysql_numrows($result_period_name); if ($num_periods == 0) { echo font color=#ffbThere were no records found for the periods selected./b/font; } else while ($row = mysql_fetch_array($result_period_name)) { $period_name = $row[period_name]; echo th align=left bordercolor=#808080font color=#FF face=Tahoma size=2 b$period_name/b/th /font; } echo th align=left bordercolor=#808080font color=#FF face=Tahoma size=2bTotal Sales/b/font/th; echo /tr; // End Build and Print the Table Headers *** // Start Calculate and Format Total Sales *** $get_itemtot = SELECT SUM(extended_dollars) FROM salesdata WHERE salesperson = '$dbname' and period_id between '$start_period_id' and '$end_period_id' ; $itemtot_result
[PHP-DB] First and Last Record Query
Does anyone know how to grab only the first and last record of a query. I have a table named periods with two fields, period_id and period_name. The user will select a start period and an end period from a drop down list, assigning $start_period and $end_period variables based on the period id. If I run this query: Select period_name from periods where period_id between '$start_period_id' and '$end_period_id' order by period_id An array is returned which could include one or more records, depending upon the user selection. I would like to grab the first and last record in the array so that the final result would be to echo something like This report is from $start_period through $end_period. Hope that makes sense ... Thanks in advance for any help. Randy Rankin
RE: [PHP-DB] First and Last Record Query
Why are you iterating through the array? Inexperience. Thanks for the help guys. I'll give it a try. Randy -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 13, 2002 11:43 AM To: 'David Fudge'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] First and Last Record Query Why are you iterating through the array? Why not just: $start_id = $row[0]; $end_id = $row[count($row)-1]; -Original Message- From: David Fudge [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 13, 2002 11:40 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] First and Last Record Query well, if you're using an array, you could use a for like this: $row = mysql_fetch_row($result); for( $i=0;$icount($row);$i++ ) { if( $i==0 ) $start_id = $row[$i]; elseif( $i == (count($row)-1) ) $end_id = $row[$i]; } - Original Message - From: Rankin, Randy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 13, 2002 12:32 PM Subject: [PHP-DB] First and Last Record Query Does anyone know how to grab only the first and last record of a query. I have a table named periods with two fields, period_id and period_name. The user will select a start period and an end period from a drop down list, assigning $start_period and $end_period variables based on the period id. If I run this query: Select period_name from periods where period_id between '$start_period_id' and '$end_period_id' order by period_id An array is returned which could include one or more records, depending upon the user selection. I would like to grab the first and last record in the array so that the final result would be to echo something like This report is from $start_period through $end_period. Hope that makes sense ... Thanks in advance for any help. Randy Rankin -- 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] OCI Query Results
We are using OCI to query an Oracle DB. Everything seems to work fine (i.e; data is returned to the browser), however, the first record of every recordset is NOT returned. I can run the same query in SQLPlus and all records are returned. It seems something in PHP is stripping of the first record in the result set. Does anyone have any thoughts. I can post code sample if needed. Randy
RE: [PHP-DB] OCI Query Results
Nevermind, I figured it out. There was a duplicate OCIfetchinto statement in the script. Randy -Original Message- From: Rankin, Randy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 12, 2001 10:12 AM To: PHP List Cc: Barker, John Subject: [PHP-DB] OCI Query Results We are using OCI to query an Oracle DB. Everything seems to work fine (i.e; data is returned to the browser), however, the first record of every recordset is NOT returned. I can run the same query in SQLPlus and all records are returned. It seems something in PHP is stripping of the first record in the result set. Does anyone have any thoughts. I can post code sample if needed. Randy
[PHP-DB] PHP/MySQl Consultation
I am in need of someone that is very good at PHP and MySQL to view my scripts and discuss with me in detail on how to speed up my scripts and how to speed up mysql some. if you are interested please send me credentials and rates ASAP please send them to [EMAIL PROTECTED] Thank you, Randy --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.268 / Virus Database: 140 - Release Date: 8/7/2001 -- 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] Connection to Oracle8i
Rafael, I am assuming you can connect to your Oracle server from your client (using net8 for example). Did you recompile PHP with Oracle OCI support on your web server? Run ?phpinfo()? and see if there is a section on Oracle OCI. If not, that may be at least part of your problem. Remember that Oracle and OCI8 support for PHP are different. You can compile PHP with one or both. Can you post the section of code with regards to line 40 in your oracle.php3 file. That might help too. I am not familiar with the oracle_connect() function you are trying to call. For your reference, here is an example of a connect script that I run using OCI calls: % $connection = OCILogon (user,pass,sid); if ($connection == false) {echo OCIError($connection).BR; exit; } OCILogoff ($connection); % Hope that helps, Randy Rankin Texarkana, Texas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 15, 2001 3:45 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Connection to Oracle8i I have a server runs Oracle. And my Station is Linux and i run client for Oracle in it, with the variables of ORACLE_HOME, ORACLE_SID and other is in the bash_profile of my user. Then i change de httpd.conf to apache runs with my users and group. I use PHP4 in a REDHAT 7.1. My problem is whem i put the connection in the PHP script use OCI.they not find the command. The apache send me the following error: Fatal error: Call to undefined function: oracle_connect() in /var/www/html/teste/oracle.php3 on line 4 I nead to include any class in my script. I look the manual on php.net, but it can´t help me. if someone has a tutorial of the connection of PHP with Oracle, please, send me. Sorry, my english, i´m from Brazil. Thank´s Rafael -- 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] Query on Oracle Views
I am connecting to an Oracle 8 server using OCI, PHP and Apache on a RH Linux 7.1 box. All works well until I try to query an Oracle dynamic view like the following: $query = SELECT instance_name, host_name FROM v$instance; When I execute this query, the server returns the following error. Warning: OCIStmtExecute: ORA-00942: table or view does not exist in /usr/local/apache/htdocs/oracle/oraprod.php on line 17 My suspicion is that PHP thinks that the '$' in the table name is the beginning of a variable. Does anyone know how to get around this so that I can execute a query with a table name like v$instance? TIA, Randy Rankin -- 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] Escaping
Thanks to all for your help. I had to step away for a while yesterday so I am just now getting back to your responses. Here is what I was having a problem with: a href=\sales_location.php?Customer=$Customer\ target=bottom_right$Customer/a Based on your responses, here is what I have now (this works!): a href=\sales_location.php?Customer= . urlencode($Customer) .\ target=bottom_right$Customer/a As you can see, urlencode did the trick. Thanks again everybody!! Randy Rankin -Original Message- From: Ken Sommers [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 12, 2001 10:27 PM To: Rankin, Randy; [EMAIL PROTECTED] Subject: Re: [PHP-DB] Escaping Please explain the dynamic link . is that in the documentation somewhere? Kne - Original Message - From: Rankin, Randy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 12, 2001 8:18 AM Subject: [PHP-DB] Escaping Hello, I have a table in a MySQL DB (RH Linux/Apache) with a field called customer_name. Some of the customer names have an ampersand in them (ie; X X Supply). I am performing a select statement on this table to create a sales summary with customer name and total sales. This works fine; however, I am also creating a dynamic link on the customer name so that the user can click on it to get a detailed report of sales to that customer. This works great EXCEPT for the customers with ampersands in thier names. The result of clicking on these customers indicates a No Records found for X where X is the letter immediately preceding the ampersand. Does anyone know how to get around this? TIA, Randy Rankin -- 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-DB] Escaping
Hello, I have a table in a MySQL DB (RH Linux/Apache) with a field called customer_name. Some of the customer names have an ampersand in them (ie; X X Supply). I am performing a select statement on this table to create a sales summary with customer name and total sales. This works fine; however, I am also creating a dynamic link on the customer name so that the user can click on it to get a detailed report of sales to that customer. This works great EXCEPT for the customers with ampersands in thier names. The result of clicking on these customers indicates a No Records found for X where X is the letter immediately preceding the ampersand. Does anyone know how to get around this? TIA, Randy Rankin -- 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] odbc with ms access
http://www.microsoft.com/KB/Articles/Q128/8/08.HTM -Original Message- From: Dalyyla [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 22, 2001 7:32 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] odbc with ms access hi, Access to data with ms access via odbc is kinda slow . I would like to know if it is normal and what can i do to make it faster Thanks Dalyyla -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] PHP On Linux
Try this: http://www.devshed.com/Server_Side/PHP/SoothinglySeamless/ Randy Rankin Ben Cairns wrote: I have nearly 18 Months devel on Windows, but we are now moving to Linux, I have never installed PHP On Linux before, so could someone pls give me an 'Installation Guide' to follow for PHP With MySQL Support, on Linux, Also, I would like to know what I have to do with MySQL: You know, what files go where etc... Thanks. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] query error
When I run any kind of query this is the value of result Resource id #2 Example $result= mysql_query (" Select * from ACCT_TBL ") or die ("Error".mysql_error()); print result; any ideas? randy -- 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]