RE: [PHP-DB] douplicate entry
Andy: If indeed it is the fact that users are clicking the 'upload' button twice, then you could incoporate a flood control script that dissallows multiple uploads for the same file and same IP Address for a specific time period (10 seconds perhaps). I used to have one of these, but have mislaid it. Perhaps you could ask for one here or go looking at hotscripts.com. Hope that's of some help... Russ -Original Message- From: Andy [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 29, 2002 3:06 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] douplicate entry Hi guys, I have a community site running, where members can upload images of themselves. The images are stored inside blobs of a mysql db. Now sometimes -no clue how they do it- it happens that I get an errormsg saying douplicate entry for bla.jpg I guess they do press the upload button twice or something similar. Of course there is a unique index on the column. My question is how to prevent this error? Thank you for any help on this. Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] How to pass multiple checkbox values thru form??
Smita: input type='checkbox' name='YourFieldName[]' value=\$DataBaseValue\ / Then in the script that recieves the form POST or GET data, cycle through the array of chaeckbox values and do with them as you will. foreach($YourFieldName as $val) { //echo checkbox values to the page or do whatver you will with them.. echo checkbox value: $val; } :-) HTH Russ -Original Message- From: Smita Manohar [mailto:[EMAIL PROTECTED]] Sent: Friday, August 30, 2002 12:19 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] How to pass multiple checkbox values thru form?? hii i have one form in which i print records from mysql database. while displyaing those records i display one checkbox with each record. i want the user should select the checkbox corresponding to the record which s/he wants to delete. i display those records after running one query. hence each time no.of records are diff. so its difficult to hard code names for check boxes. for name attribute in input type=checkbox tag, i define one array. having same name as the key field in the table. and value for which is also set dynamically. FORM NAME = act_qmd_subj_frm METHOD = POST ACTION = confirm_delete.php while ($row = mysql_fetch_array($result)) { .. echo tr; //call function to display the contents of $row in table print_entry($row,subj_id,subj_name,subj_desc); print td valign=top align=centerinput type=checkbox name=\subj_id[]\ value=\.$row[subj_id].\ Yes, delete entry #.$row[subj_id]./td\n; ... } INPUT TYPE=submit NAME=del_but VALUE=Delete nbsp nbsp INPUT TYPE=submit NAME=modify_but VALUE=Modify nbsp nbsp INPUT TYPE=reset NAME=clear_but VALUE=Clear nbsp nbsp /FORM when i submit the form to confirm_delete.php i run one code there to print the array subj_id[] which is supposed to contain values of the checkboxes which are selected to delete or to modify. but the array subj_id[] contains no value at all. echo count($subj_id) gives 0. is there any other way to pass multiple checkbox values from the form??? i got the above trick from the book MySQL/PHP Database Applications (By, Jay Grrenspan and Brad Bulger) in one script they have passed checkbox value thru array by this way, and its working fine. can anyone PLS figure out what wrong im doing??? thnx and regds, smita. _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- 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] Mail Function
$mailTo = [EMAIL PROTECTED]; $mailFrom = From:[EMAIL PROTECTED]; $mailSubject = This is an email...; $mailBody = This is a message; @mail($mailTo,$mailFrom,$mailSubject,$mailBody); Try this, it works for me ;-) Russ -Original Message- From: Manoj Japher [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 28, 2002 2:33 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Mail Function hi, I know this question is in the wrong group, but I hope someone maybe able to help me out. I need to use the mail() function in my code to send out mails which I am able to do successfully. But I am not able to set the 'from address' in the mail I sent. It always varies. Can I set the from address field as to my liking. I tried the following code ? $toaddress = [EMAIL PROTECTED]; $fromaddress = [EMAIL PROTECTED]; $subject = Test Mail; $content = Your username and password as you requested \n .Username = user \n .Password = pass \n; mail($toaddress, $subject ,$content, $fromaddress); echo Your username and password has been mailed to you ; ? And the mail I got had the from address as [EMAIL PROTECTED] Can someone help me out please Best Regards, Manoj 'I have miles to go before I sleep, and promises to keep' -- 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] Mail Function
Oops! wrong order of arguments... I meant: $mailTo = [EMAIL PROTECTED]; $mailFrom = From:[EMAIL PROTECTED]; $mailSubject = This is an email...; $mailBody = This is a message; @mail($mailTo,$mailSubject,$mailBody,$mailFrom); Russ -Original Message- From: Manoj Japher [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 28, 2002 2:33 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Mail Function hi, I know this question is in the wrong group, but I hope someone maybe able to help me out. I need to use the mail() function in my code to send out mails which I am able to do successfully. But I am not able to set the 'from address' in the mail I sent. It always varies. Can I set the from address field as to my liking. I tried the following code ? $toaddress = [EMAIL PROTECTED]; $fromaddress = [EMAIL PROTECTED]; $subject = Test Mail; $content = Your username and password as you requested \n .Username = user \n .Password = pass \n; mail($toaddress, $subject ,$content, $fromaddress); echo Your username and password has been mailed to you ; ? And the mail I got had the from address as [EMAIL PROTECTED] Can someone help me out please Best Regards, Manoj 'I have miles to go before I sleep, and promises to keep' -- 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] auto_increment problem???
Miles: Thanks for your input. I'm running MySQL 3.23.49-nt-log on php4.2.1. and the table in question is of type: MyISAM. I noticed that, upon returning to work Monday (today) I deleted * from the table and the auto_increment column reverted back to starting from one again. However, today I'm deleting * from the same table and the auto_increment numbers start where the last [now deleted] entry left off. I assume then that this table type has some relation or other to a database connection. By this I mean if the DB connection times out or otherwise quits, the auto_increment column assumes to re-use keys and start again from one?? So is there then a PHP-MySQL function that can be used right after a Query that explicitly tells MySQL to close such a connection so that columns of type: INT - auto_increment will *always* start from 1 if the table contains no records (table is empty)?? Thanks a lot for your help. :-) -Original Message- From: Miles Thompson [mailto:[EMAIL PROTECTED]] Sent: Saturday, August 24, 2002 12:12 AM To: Russ; [EMAIL PROTECTED] Cc: Ross Gerring Subject: Re: [PHP-DB] auto_increment problem??? Russ, Check your docs to confirm this, as you are probably running a later version than I'm familiar with. If the table is defined as type MyISAM the autoincrement numbers do not get reused, they steadily increase. You can rely on them. The default table type is ISAM, and the autoincrement numbers do get reused. How did I discover this? Same way you did, disappearing keys and very strange results on selects. Fortunately I discovered the difference before I had too much data, but it had me going for a while. Cheers - Miles Thompson At 05:29 PM 8/23/2002 +0800, Russ wrote: G'day folks: The way I have my MySQL table set up should work as follows: 1). If table IS NOT empty, get MySQL to insert auto_increment value into primary key column as normal, then get value of previous record's second, none primary ID column. (latter column used for lookup purposes elsewhere) (This is do-able as there is already an existing record from which to gather a second none-primary ID.) 2). If table IS empty, insert auto_increment value as normal, into primary key column and *the same value* into the second, none-primary ID column. The thing is, as I'm using auto_increment as my primary key definition, and occassionally this table is emptied (deleted from), how can I get the second none primary ID column to reflect the new primary key auto_increment value of a new record, if no previous record exists?? I hope you understand what I mean! ;-) Cheers. Russ Mr Russ Michell Web Applications Developer Itomic.com Email: [EMAIL PROTECTED] Tel: +61 (0)8 9321 3844 Fax: +61 (0)8 6210 1364 Post: PO Box 228, Innaloo, WA 6918, Australia Street: Suite 24, 158 William St, Perth, WA 6000, Australia No proof of existence is not proof of non-existence. (Physicist: Stanton T. Friedman on Debunking Ufology) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] SQL guru needed!
Hiya folks: I wish to be able to select items from MySQL if a variable passed via the $_GET method to my PHP4 page is introduced thus: $sql = SELECT TourName,TourID,$_GET[CatID] IN (TourCatID) FROM tour; When I echo $sql to the page, the query looks fine but doesn't work, in as far as the wrong results are returned. MySQL doesn't throw up an error either. I'm using MySQL 3.23.49-nt-log. Can anyone enlighten me please ?? Cheers Mr Russ Michell Web Applications Developer Itomic.com Email: [EMAIL PROTECTED] Tel: +61 (0)8 9321 3844 Fax: +61 (0)8 6210 1364 Post: PO Box 228, Innaloo, WA 6918, Australia Street: Suite 24, 158 William St, Perth, WA 6000, Australia No proof of existence is not proof of non-existence. (Physicist: Stanton T. Friedman on Debunking Ufology) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] SQL guru needed!
Cheers for helping me out guys. It proved to fiddly and kludge-like to do what I wanted in SQL (I'll wait until MySQL 4 stable version is about) So I did some stuff with PHP arrays which worked fine. Thanks a lot anyway. Russ -Original Message- From: Ignatius Reilly [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 20, 2002 4:13 PM To: Russ Subject: Re: [PHP-DB] SQL guru needed! Is TourCatID a table? you can't do that, this is a subquery Build first a string $string with all the values of TourCatID in it such as ('a', 'b', ...) And replace your query by IN $string Also quotes needed around $_GET[CatID] Ignatius _ - Original Message - From: Russ mailto:[EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, August 20, 2002 9:59 AM Subject: [PHP-DB] SQL guru needed! Hiya folks: I wish to be able to select items from MySQL if a variable passed via the $_GET method to my PHP4 page is introduced thus: $sql = SELECT TourName,TourID,$_GET[CatID] IN (TourCatID) FROM tour; When I echo $sql to the page, the query looks fine but doesn't work, in as far as the wrong results are returned. MySQL doesn't throw up an error either. I'm using MySQL 3.23.49-nt-log. Can anyone enlighten me please ?? Cheers Mr Russ Michell Web Applications Developer Itomic.com Email: [EMAIL PROTECTED] Tel: +61 (0)8 9321 3844 Fax: +61 (0)8 6210 1364 Post: PO Box 228, Innaloo, WA 6918, Australia Street: Suite 24, 158 William St, Perth, WA 6000, Australia No proof of existence is not proof of non-existence. (Physicist: Stanton T. Friedman on Debunking Ufology) -- PHP Database Mailing List ( http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] keeping form field data when reloading a form
Chip: Just use the names of the fields as the values too: input type='text' name='Email' value='$Email' / HTH :-) Russ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 1:58 AM To: PHP_DB Subject: [PHP-DB] keeping form field data when reloading a form I have my email checker working now, and all the other fields are checked also, but when I do enter some wrong data the form is reloaded with all blank fields. I'm sure there is a way to keep the existing data in the fields so the end-user will only have to change the incorrect fields, and not have to re-enter all the data. But how? -- Chip Wiegand Computer Services Simrad, Inc www.simradusa.com [EMAIL PROTECTED] There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corporation, 1977 (They why do I have 9? Somebody help me!) -- 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: select distinct with all columns
Perfect! Thanks. I'm still trying to get a handle on the GROUP BY command. It's still a little bit like magic to me. And in the manual, they don't really show how to use it like the way I wanted to use it. Thanks again, russ On Monday 12 August 2002 01:27 pm, Dan Koken wrote: SELECT * FROM equipement WHERE class = microphones GROUP BY type; Russ Arbuthnot wrote: I have a mysql table named equipment with 11 columns named: id, staff_member, class, type, manufacturer, model, description, picture, created, modified, and published. I'm trying to write a select statement similar to this: SELECT DISTINCT type FROM equipement WHERE class = microphones; yet shows all 11 columns of the selected rows rather than just the type column. The only way I know how to show all the columns is to use SELECT *, or to list all the columns manually like SELECT id, type, class, ... etc. But when I tried doing this: SELECT DISTINCT type, id, staff_member, class, manufacturer, model, description, picture, created, modified, published FROM equipment WHERE class = microphones; I just got the exact same answer as if i would have done this: SELECT * FROM equipment WHERE class = microphones; so it didn't help. Can anyone offer a hint? Thanks, russ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] select distinct with all columns
I have a mysql table named equipment with 11 columns named: id, staff_member, class, type, manufacturer, model, description, picture, created, modified, and published. I'm trying to write a select statement similar to this: SELECT DISTINCT type FROM equipement WHERE class = microphones; yet shows all 11 columns of the selected rows rather than just the type column. The only way I know how to show all the columns is to use SELECT *, or to list all the columns manually like SELECT id, type, class, ... etc. But when I tried doing this: SELECT DISTINCT type, id, staff_member, class, manufacturer, model, description, picture, created, modified, published FROM equipment WHERE class = microphones; I just got the exact same answer as if i would have done this: SELECT * FROM equipment WHERE class = microphones; so it didn't help. Can anyone offer a hint? Thanks, russ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: Random
ORDER BY RAND() Russ -Original Message- From: David Robley [mailto:[EMAIL PROTECTED]] Sent: Monday, August 12, 2002 1:08 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Re: Random In article 003601c241ad$225775e0$[EMAIL PROTECTED], [EMAIL PROTECTED] says... can someone help me to generate a random records from the database? eg, rec 1 john doe rec 2 jay williams rec 3 anie boo random results: rec 2 jay williams rec 1 john doe rec 3 anie boo . Check your database documentation - at least Mysql has a RANDOM function. -- David Robley Temporary Kiwi! Quod subigo farinam -- 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] Mail problem
Could you not simply extract all the email addresses from the DB as you would any other data, then loop thru the result set calling PHP's mail() function for every record retrieved? while($row=mysql_fetch_assoc($result)) { extract($row); //Presume's '$email ' is the name of the field in which email addresses are stored in your DB: @mail($email,$from,$subject,$body); } or am I missing something?? Russ -Original Message- From: Bartek Pawlik [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 01, 2002 2:30 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Mail problem Sorry to be a little bit off topic. I need a tool or script in PHP, that will automaticaly send e-mails to receipients taken from database. For example 1 the same e-mail to 1000 receipients. B Mail server is on different machine. Thanks in advance -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Mail problem
Just looking at our php.ini file and we use an external machine to send mail with when calling the mail() function. I think you just need to change the directive for the path/URI to the mail server you wish PHP to use, in your php.ini file. HTH :-) Russ -Original Message- From: Bartek Pawlik [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 01, 2002 2:47 PM To: [EMAIL PROTECTED]; Russ Subject: Re: [PHP-DB] Mail problem Of course, but PHP is on Linux machine where I don't have sendmail, because my mail server is on different machine, and that's my problem Bartek - Original Message - From: Russ [EMAIL PROTECTED] To: Bartek Pawlik [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, August 01, 2002 8:38 AM Subject: RE: [PHP-DB] Mail problem Could you not simply extract all the email addresses from the DB as you would any other data, then loop thru the result set calling PHP's mail() function for every record retrieved? while($row=mysql_fetch_assoc($result)) { extract($row); //Presume's '$email ' is the name of the field in which email addresses are stored in your DB: @mail($email,$from,$subject,$body); } or am I missing something?? Russ -Original Message- From: Bartek Pawlik [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 01, 2002 2:30 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Mail problem Sorry to be a little bit off topic. I need a tool or script in PHP, that will automaticaly send e-mails to receipients taken from database. For example 1 the same e-mail to 1000 receipients. B Mail server is on different machine. Thanks in advance -- 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 where clause
In MySQL - SQL you can't use the column alias ('score' in your case) until after the query has been executed. There is a workaround though - see: http://www.sitepointforums.com/showthread.php?s=postid=501671 for more info. Cheers. Russ -Original Message- From: JJ Harrison [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 24, 2002 4:16 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] problem with where clause Here is my query(It is part of a search script and is dynamicly generated): select 0 + article_keyword.weight * article_keyword.keyword like '%green%' as score, article_keyword.aid, article_data.name, article_data.time, article_data.description from article_keyword, article_data where score 0 and article_data.aid = article_keyword.aid group by article_data.aid order by score desc when I do the query in PHP I get a message saying: Unknown column 'score' in 'where clause'. How can I fix this? -- JJ Harrison [EMAIL PROTECTED] www.tececo.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] the space in php (2)
Bo: Why do you not just store the name's of the people you wish to display as FirstName and LastName in two different columns? If for some reason you can't or don't want to do it this way then try using str_replace() should do what you want: http://www.php.net/manual/en/function.str-replace.php As for the code, best do things one step at a time: (Assumes MySQL DB) //1). Get DB record/s: while($row=mysql_fetch_assoc($result)) { //2). Get all vars into varspace as columnames: extract($row); //3). Echo vars as columnnames to page with as less code as possible: echo(tda href=javascript:popUp('bios/bio_ . str_replace(% %,,$scoutname) . .html') . $scoutbio . /a/td); } //4). Complete your HTML table: echo /tr /table ; I'm not sure the syntax is 100% correct - best check out the manual eh? ;-) HTH Russ :-) -Original Message- From: bo [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 6:11 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] the space in php To Php Gurus: I'm writing some code like this: echo(tda href=javascript:popUp('bios/bio_.$row[scoutname]..html').$row[sco utbi o]./a/td); but the scoutname is something like Mike Johnson, which has a space in bettwen Mike and Johnson, how do I chop this space off, so I can name the corresponding html file as bio_MikeJohnson ? Thanks and any feedback will be appreciated! Good Day. Bo -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -Original Message- From: bo [mailto:[EMAIL PROTECTED]] Sent: Monday, July 22, 2002 6:26 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] the space in php (2) Indeed, it's better that if I can just stop when I encouter a space before Johnson, and take the first name(Mike) off. So, the file name will be bio_Mike.html Thanks Bo -- 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] Warnings and Error messages
Stick a '@' in front of the function/statement generating the error: @unlink($filname); for example... Russ -Original Message- From: Gabor Niederlaender [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 17, 2002 5:54 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Warnings and Error messages Hi all! How can I prevent the warnings end errors to be written on the screen? I would like to prevent the warnings end errors to be written on the screen because I want to handle the errors with the odbc_errormsg() function. How do I do that? Is there a better way? Best regards, Gabor -- 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] SQL Solution??
Hi all: I have a simple MySQL SELECT query: Mr Russ Michell Web Applications Developer Itomic.com Email: [EMAIL PROTECTED] Tel: +61 (0)8 9321 3844 Fax: +61 (0)8 6210 1364 Post: PO Box 228, Innaloo, WA 6918, Australia Street: Suite 24, 158 William St, Perth, WA 6000, Australia No proof of existence is not proof of non-existence. (Physicist: Stanton T. Friedman on Debunking Ufology) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] SQL query prob
I'll try that one again I have a query: $sql = SELECT * FROM contacts ORDER BY ContactType; There are two types of contacts: * Commissioners * Staff As they are ordered by the ContactType then 'Commissioners' are displayed first followed by 'Staff'. I'd like to be able to display a heading on the page at the point of the FIRST instance of 'Commissioners' and at the FIRST instance of 'Staff'. As I'm using a while loop in my PHP script then at present such a heading would be displayed atop *each* item would it not? I think I need to use some kind of COUNT() but am unsure how to deploy it. Can anyone help me out? Cheers. Russ Mr Russ Michell Web Applications Developer Itomic.com Email: [EMAIL PROTECTED] Tel: +61 (0)8 9321 3844 Fax: +61 (0)8 6210 1364 Post: PO Box 228, Innaloo, WA 6918, Australia Street: Suite 24, 158 William St, Perth, WA 6000, Australia No proof of existence is not proof of non-existence. (Physicist: Stanton T. Friedman on Debunking Ufology) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] SQL prob (DATE_FORMAT)
George: Thanks for that. That's pretty much what I realised anyway, while composing the email. But I thought I'd send it off anyway! Thanks a lot. Russ :-) -Original Message- From: George Pitcher [mailto:[EMAIL PROTECTED]] Sent: Friday, July 05, 2002 2:52 PM To: PHP DB Mailing List (E-mail) Subject: Re: [PHP-DB] SQL prob (DATE_FORMAT) Russ, I'm a bit of a novice, but I would have thought that the DATE_FORMAT function would only work if the field had been defined as a DATE field type. If you are storing the date as an integer eg: 20020705 (today), why not format your current date as a variable based on the same method? That should produce the same results. You only need to format the output but you can do that with PHP. HTH George - Original Message - From: Russ [EMAIL PROTECTED] To: PHP DB Mailing List (E-mail) [EMAIL PROTECTED] Sent: Friday, July 05, 2002 7:33 AM Subject: [PHP-DB] SQL prob (DATE_FORMAT) Hi all: Thanks to Jason for his pointers - whatever the reason though, we need to use INT(10) for our CMS to work! ;-) Anyways... Using our MySQL INT(10) field the following query isn't behaving itself: $event_sql = SELECT *,DATE_FORMAT('EventDate','%Y-%m-%d') FROM events WHERE EventDate=CURDATE() ORDER BY EventDate DESC LIMIT 3; This query should only return those event entries of today's date and any future date right? The MySQL manual points out that: CURDATE() returns dates thus: mysql SELECT CURDATE(); - '1997-12-15' (i.e.: with hyphens between the entities in the same format as my DATE_FORMAT() arg's specify above) Can anyone point out why the results of the queries continue to output entries whose dates are prior to the value of CURDATE()? Do these functions depend upon DATETIME, DATE, TITMESTAMP (etc) MySQL field types or what?? Cheers all. Russ Mr Russ Michell Web Applications Developer Itomic.com Email: [EMAIL PROTECTED] Tel: +61 (0)8 9321 3844 Fax: +61 (0)8 6210 1364 Post: PO Box 228, Innaloo, WA 6918, Australia Street: Suite 24, 158 William St, Perth, WA 6000, Australia No proof of existence is not proof of non-existence. (Physicist: Stanton T. Friedman on Debunking Ufology) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] DATE vs INT
Hi all: Our company uses for reasons of experience, an INT(10) field for storing dates in a MySQL DB. ((We just DO OK! ;-)) However I it is because the date isn't stored as a DATE or DATETIME (etc) that I can't do an accurate ORDER BY name_of_date_field - as MySQL doesn't recognise the field's content as a valid date simply an integer (that we modify for display using PHP) Does anyone know of a way (kludge or otherwise) I may be able to perform such an ORDER BY, so that the dates in an HTML display table column are ordered AS dates while using an INT field format?? Cheers folks. Russ Mr Russ Michell Web Applications Developer Itomic.com Email: [EMAIL PROTECTED] Tel: +61 (0)8 9321 3844 Fax: +61 (0)8 6210 1364 Post: PO Box 228, Innaloo, WA 6918, Australia Street: Suite 24, 158 William St, Perth, WA 6000, Australia No proof of existence is not proof of non-existence. (Physicist: Stanton T. Friedman on Debunking Ufology) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Populating a dropdown list with ENUM values...
G'day Scott: I wrote this function to do just what you're atfer: You may need to mess with it for you're own needs - but go for your life! //function: enum_select() - automatically generate an HTML select menu from a MySQL ENUM field //1). takes a table name: '$table' //2). a name for the menu '$name' //3). a CSS class function enum_select($table,$name,$class) { $sql = SHOW COLUMNS FROM $table; $result = mysql_query($sql); $select = select name=\$name\ class=\$class\\n\t; while($myrow = mysql_fetch_row($result)){ $enum_field = substr($myrow[1],0,4); if($enum_field == enum){ global $enum_field; $enums = substr($myrow[1],5,-1); $enums = ereg_replace(',,$enums); $enums = explode(,,$enums); foreach($enums as $val) { $select .= option value=\$val\$val/option\n\t; }//end foreach }//end if }//end while $select .= \r/select; return $select; }//end function All the best. Russ -Original Message- From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 27, 2002 3:38 AM To: '[EMAIL PROTECTED]' Subject: [PHP-DB] Populating a dropdown list with ENUM values... I am working on an application that has several different fields that are populated dropdown lists. In every case, this data is simply data from a MySQL table column and works great. I have run into a new difficulty though... One field that I am wanting to populate in a dropdown list is an ENUM field. I am trying to figure out how to do this. I have seen a couple ideas in the newsgroups, but most are pretty complex and about a year or so old. I am hoping for a simpler solution that may have been developed since these posts. Thanks in advance. 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] Finding numbers in a string
Seth: You should have another colon ' : ' after your alnum expression: if(ereg([[:alnum:]]+, $textandnumbers, $numbers)) { print($numbersBR); } I'm not sure but you also may want to lose the double quotes or maybe escape them. Good luck. Russ -Original Message- From: Seth Yount [mailto:[EMAIL PROTECTED]] Sent: Saturday, June 22, 2002 1:52 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Finding numbers in a string Forgot my email on that last one ;) Hello all - I am trying to seperate numberic characters from a string. The book I was looking at described something like this: if(ereg([[:alnum]]+, $textandnumbers, $numbers)) { print($numbersBR); } When I run my script I receive this error: Warning: REG_ECTYPE in ../mypage.php Anyone have a solution / explanation to my problem - still reading -- 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] Converting values from text to numerical
is it possible to have PHP covert numbers that are stored as text strings back into values it can calculate with? Mathew: You can use PHP to convert these - dependant upon the way you store them in your DB. Foe example I sometimes need to store different types of data in the same field (I suppose you need to do this to, othewise you'd store your numerical data in another column) like so: Russ|27|6|Michell (stored as a single string in your table) This is my first name, age, height, and surname respectively. You could then just use the explode() function to remove the pipes, and pick out the values (integers in this case) from the resultant array that explode() provides you with. Hope this helps you out some. Russ -Original Message- From: Matthew Nock [mailto:[EMAIL PROTECTED]] Sent: Friday, June 21, 2002 12:43 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Converting values from text to numerical I am about to build a database of products that will store features fore ach product in a separate table. I need to be able to store both text and numeric values in this table, but be able to perform mathmatical functions on the numeric variables. is it possible to have PHP covert numbers that are stored as text strings back into values it can calculate with? -- 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] Converting values from text to numerical
Matthew: um how about using the is_int() function to decide if the value from your DB is a number or not? http://www.php.net/manual/en/function.is-int.php //Do DB extraction stuff to get $val/$vals from DB if(is_int($val)) { echo This is a number so do numbery type things with it..; } else { echo This aint a number so it must be a string, so do stringy things with it...; } Any good? Russ -Original Message- From: Matthew Nock [mailto:[EMAIL PROTECTED]] Sent: Friday, June 21, 2002 1:00 PM To: [EMAIL PROTECTED] Subject: RE: [PHP-DB] Converting values from text to numerical Hi Russ, Thanks for the reply. I was looking more along the lines of having one field, that might store either a text value (such as the words Not included), or a numeric value, such as 10. The using PHP to determine if the value is numeric, perform a function on it (such as a calculation) then display the result, otherwise, just display the text. -Original Message- From: Russ [mailto:[EMAIL PROTECTED]] Sent: Friday, 21 June 2002 2:53 PM To: Matthew Nock; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Converting values from text to numerical is it possible to have PHP covert numbers that are stored as text strings back into values it can calculate with? Mathew: You can use PHP to convert these - dependant upon the way you store them in your DB. Foe example I sometimes need to store different types of data in the same field (I suppose you need to do this to, othewise you'd store your numerical data in another column) like so: Russ|27|6|Michell (stored as a single string in your table) This is my first name, age, height, and surname respectively. You could then just use the explode() function to remove the pipes, and pick out the values (integers in this case) from the resultant array that explode() provides you with. Hope this helps you out some. Russ -Original Message- From: Matthew Nock [mailto:[EMAIL PROTECTED]] Sent: Friday, June 21, 2002 12:43 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Converting values from text to numerical I am about to build a database of products that will store features fore ach product in a separate table. I need to be able to store both text and numeric values in this table, but be able to perform mathmatical functions on the numeric variables. is it possible to have PHP covert numbers that are stored as text strings back into values it can calculate with? -- 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] duplicated entry for key #
'Duplicate entry 'username' for key 1. This means that you do have a duplicate entry in a row of your DB. Try setting a column as Auto increment: ALTER TABLE table_name id smallint(10) DEFAULT '0' NOT NULL auto_increment (or something like that) This means each set of data you put into the DB will automatically create a new row in which to insert this data. You should really do some basic checking before you do inserts, to ensure you don't have multiple entries: $check = mysql_num_rows($query); if($check != 0) { echo You have a duplicate entry!; } Cheers Russ On Mon, 17 Dec 2001 23:40:44 +0100 nautilis [EMAIL PROTECTED] wrote: Hi everybody! My problem is: I have a form to allow users in a website to register. My problem is that when someone registers a name that is alredy taken, mysql returns a 'Duplicate entry 'username' for key 1. I just want to show a message to user telling that the username is in use by another user and prompting him to choose a new one. I am a newbie at php and mysql so any help will be greatly appreciated. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Dumb Question??
Russ - Why not (MySQL) extract the field always, and code into your (php) generic mechanism whether or not a particular field under that name appears? Using mysql_fetch_assoc() you could exclude 'modified' from your generic mechanism under particular circumstances. This avoids coding it into your query, so it may be classified as a cludgeon, but it would work. Hi Daniel: I get what you're saying, but I'm still having to hard-code it somewhere into my scripts. I'm working on a method of defining fields to include/exclude using arrays whose values are given for each application this system is applied to. (That'll keep me busy) Thanks for your help. Russ On Fri, 14 Dec 2001 12:15:01 -0800 Daniel Barton [EMAIL PROTECTED] wrote: Russ - Why not (MySQL) extract the field always, and code into your (php) generic mechanism whether or not a particular field under that name appears? Using mysql_fetch_assoc() you could exclude 'modified' from your generic mechanism under particular circumstances. This avoids coding it into your query, so it may be classified as a cludgeon, but it would work. cheers, db Russ Michell wrote: Sorry! just read-read my post, it should have been: particular column ('modified') *NOT* to appear under specific circumstances, somewhere along... Cheers. Russ On Thu, 13 Dec 2001 12:03:09 + (GMT Standard Time) Russ Michell [EMAIL PROTECTED] wrote: Hi there everyone: I have a genericphp/MySQL search+retrival mechanism. Generic in that it takes table names, fieldnames and fieldtypes as form lables and element names. However, because of this I cannot hard-code my SQL queries as they need to be as generic (univerally useful) as possible. I therefore have a lot of SELECT * FROM table_name... queries. However I would like to be able to specify a particular column ('modified') to appear under specific circumstances, somewhere along the lines of: SELECT *,!modified FROM table_name .. I scanned TFM and couldn't find anything specific to my problem. I have an incling this may not be as easy as I think, so does anyone know of a bodge,kludge or workaround?? Thanks for your time. Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University WebteamRoom 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- -- Dan Barton Terrestrial Program Biologist Asst. Data Manager Point Reyes Bird Observatory http://www.prbo.org [EMAIL PROTECTED] [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Is MySQL enough for a huge amount of data?
Did you go look at: www.mysql.com?? Russ On Fri, 14 Dec 2001 13:27:03 +0100 Andy [EMAIL PROTECTED] wrote: Hi there, I am wondering if I could have MySQL as a DB for an Application which needs to have access a table of 1 Mio entries. And how long would it take to get an entry out of it. Asuming it contains only a name field and an id. e.g. select name from cities where provincial id = 2 If it works, how could I optimize the table? Thanx for you help guys Cheers Andy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Dumb Question??
Hi there everyone: I have a genericphp/MySQL search+retrival mechanism. Generic in that it takes table names, fieldnames and fieldtypes as form lables and element names. However, because of this I cannot hard-code my SQL queries as they need to be as generic (univerally useful) as possible. I therefore have a lot of SELECT * FROM table_name... queries. However I would like to be able to specify a particular column ('modified') to appear under specific circumstances, somewhere along the lines of: SELECT *,!modified FROM table_name .. I scanned TFM and couldn't find anything specific to my problem. I have an incling this may not be as easy as I think, so does anyone know of a bodge,kludge or workaround?? Thanks for your time. Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Dumb Question??
Sorry! just read-read my post, it should have been: particular column ('modified') *NOT* to appear under specific circumstances, somewhere along... Cheers. Russ On Thu, 13 Dec 2001 12:03:09 + (GMT Standard Time) Russ Michell [EMAIL PROTECTED] wrote: Hi there everyone: I have a genericphp/MySQL search+retrival mechanism. Generic in that it takes table names, fieldnames and fieldtypes as form lables and element names. However, because of this I cannot hard-code my SQL queries as they need to be as generic (univerally useful) as possible. I therefore have a lot of SELECT * FROM table_name... queries. However I would like to be able to specify a particular column ('modified') to appear under specific circumstances, somewhere along the lines of: SELECT *,!modified FROM table_name .. I scanned TFM and couldn't find anything specific to my problem. I have an incling this may not be as easy as I think, so does anyone know of a bodge,kludge or workaround?? Thanks for your time. Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] query to check valid emails
select * from tbl where email like %$email%; This will find the string stored in the variable '$email' in the column 'email' Adjust having the '%' at the end, the beginning or both (as above) as they will find the string '$email' at end or at the beginning of the string stored in the column 'email' respectively. Russ On Sat, 24 Nov 2001 13:06:50 -0500 Noah Spitzer-Williams [EMAIL PROTECTED] wrote: what's the LIKE query to see if an email address is valid? For example, in PHP it's something like if (eregi(^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$,$ email,$check)) { echo valid; } i want to sort through rows in a db and look for invalid email addresses so like, select * from tbl where email like ??? Thanks! - Noah -- TradeMyTraffic! Banner Exchange http://www.trademytraffic.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] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] query to check valid emails
Glad someone knows more than I do, or that chap would be right up a certain creek without a paddle.. Cheers Russ On Wed, 28 Nov 2001 09:44:26 - Jon Farmer [EMAIL PROTECTED] wrote: No this will not do what the original poster requested it will be something like the following select * from table where email regexp ^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$; Regards Jon -- Jon Farmer Systems Programmer, Entanet www.enta.net Tel 01952 428969 Mob 07763 620378 PGP Key available, send email with subject: Send PGP Key select * from tbl where email like %$email%; This will find the string stored in the variable '$email' in the column 'email' Adjust having the '%' at the end, the beginning or both (as above) as they will find the string '$email' at end or at the beginning of the string stored in the column 'email' respectively. Russ On Sat, 24 Nov 2001 13:06:50 -0500 Noah Spitzer-Williams [EMAIL PROTECTED] wrote: what's the LIKE query to see if an email address is valid? For example, in PHP it's something like if (eregi(^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$,$ email,$check)) { echo valid; } i want to sort through rows in a db and look for invalid email addresses so like, select * from tbl where email like ??? Thanks! - Noah -- TradeMyTraffic! Banner Exchange http://www.trademytraffic.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] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] query + loop problem
Hi there everyone: I have a generic query containing variables, substituted for values dependant upon specific circumstances: //query the DB on the basis of searches employing text input fields (LIKE) if($sql_clause == 'LIKE') { $sql = SELECT * FROM $table WHERE $field $sql_clause '%$query%'; } //query the DB on the basis of searches employing select menus ('=') else if($sql_clause == '=') { $sql = SELECT * FROM $table WHERE $field $sql_clause '$query'; } $result = mysql_query($sql,$connect) or printerror(Query Failure!,06); $numrows = mysql_num_rows($result); Instead of the usual 'hard-coded' method within the loop as below: //loop using hard-coded variables while($row = mysql_fetch_array($result)) { $field1 = $row[fieldname1]; $field2 = $row[fieldname2]; //etc }//end while loop I'd like to be able to have this dynamically enabled as below: //loop using relevant field names to display correct page content while($row = mysql_fetch_array($result)) { //generic method of extracting rownames according to '$table' (above) goes here }//end loop Does anyone have a clue how to do this??? Many Thanks! Russ #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] query + loop problem
Nice one folks! Thanks for your help - it's amazing what happens to one's brain once you start to think about the problem in hand enough (enough that is, to attmept to make it make sense to others!..) - I sussed the problem, using a similar method described to me my several of you. (and a little bit of RFTM on my part r.e: mysql_fetch_assoc() and mysql_fetch_array() ... Many thanks for your help. Russ On Wed, 28 Nov 2001 17:49:54 +0200 Andrey Hristov [EMAIL PROTECTED] wrote: echo table\r\n; while($row = mysql_fetch_assoc($result)) { // if assoc is not available - will work but double results foreach($row as $key = $value){ echo trtd$key/tdtd$value/td/tr\r\n; } }//end loop echo /table\r\n; HTH Regards, Andrey Hristov IcyGEN Corporation http://www.icygen.com BALANCED SOLUTIONS - Original Message - From: Russ Michell [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 28, 2001 5:36 PM Subject: [PHP-DB] query + loop problem Hi there everyone: I have a generic query containing variables, substituted for values dependant upon specific circumstances: file://query the DB on the basis of searches employing text input fields (LIKE) if($sql_clause == 'LIKE') { $sql = SELECT * FROM $table WHERE $field $sql_clause '%$query%'; } file://query the DB on the basis of searches employing select menus ('=') else if($sql_clause == '=') { $sql = SELECT * FROM $table WHERE $field $sql_clause '$query'; } $result = mysql_query($sql,$connect) or printerror(Query Failure!,06); $numrows = mysql_num_rows($result); Instead of the usual 'hard-coded' method within the loop as below: file://loop using hard-coded variables while($row = mysql_fetch_array($result)) { $field1 = $row[fieldname1]; $field2 = $row[fieldname2]; file://etc }//end while loop I'd like to be able to have this dynamically enabled as below: file://loop using relevant field names to display correct page content while($row = mysql_fetch_array($result)) { file://generic method of extracting rownames according to '$table' (above) goes here }//end loop Does anyone have a clue how to do this??? Many Thanks! Russ #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Coding methods (was RE: [PHP-DB] gzip image files)
I use the former method when concatenating say a complex SQL query thru a loop or loops, and me being the person I am like to keep things standard and consistant so I use the same method when I wish to concatenate simpler strings. Russ On Tue, 27 Nov 2001 09:28:37 -0600 Boget, Chris [EMAIL PROTECTED] wrote: $filename = 'kunden/'.$name.'.png'; I see this all the time and I'm curious: what takes more computing power (granted, either would be incredibly little I'm sure, just curious which requires more work by PHP)? this: $filename = this . $varname . that; or this: $filename = this $varname that; I would think the latter example but am not sure. Another question, but this is more about personal style: I almost always use the latter method in my coding practices. It looks cleaner and, IMO, is easier to follow especially when there are a number of variables involved. For those that use the former method, why do you? I'm not trying to be judgemental, just curious why people do what they do. In asking, I may actually learn some- thing. :p Chris #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Checking inserts
Hi all: I'm wondering what you guys use as your 'standard' method of checking for repeated inserts. (as opposed to having to cane the database with a 'select' statement when a check needs to be made..) I think I have to use mysql_affected_rows() and/or mysql_insert_id(), unfortunately I don't see how these might do the job. Any help or pointers to web-resources would be most helpful! If useful, I'm using the old fella: MySQL3.22.32 Cheers all. Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] consult different databases on different machines
Miguel: 1). Are you trying to connect an MS Access database to a MySQL database? 2). Are the databases and servers both/individually remote or local? See if: http://gertrude.anglia.ac.uk/webteam/tips/php_sql/odbc.htm helps you any. Good luck. Russ On Tue, 20 Nov 2001 12:35:29 + Miguel Loureiro [EMAIL PROTECTED] wrote: Hello all, I'm working with 2 different systems ( php/mysql in Winnt and php/mysql in linux machine), and I would like from WinNt machine consult information in linux machine !!! When I make connection i got no problem(since in linux machine had created an user to acess a database like username@% ...), but when I made a simple select I got an error message :impossible to execute select . My question is , is it really impossible to do that (from winnt access linux/mysql database )??? I think not, because if it was impossible I never access database,wright??? Any ideas about that would help. Thanhs for your time -- Best Regards Miguel Joaquim Rodrigues Loureiro #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: RE: [PHP-DB] consult different databases on different machines
In which case you're best off helping him as I have no idea! Russ On Tue, 20 Nov 2001 08:10:02 -0600 Rick Emery [EMAIL PROTECTED] wrote: 1. He's not trying to connect MS Access to mySQL. He's trying TO ACCESS a mySQL database on a Win-NT machine. 2. Both mySQL servers are remote. -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 20, 2001 6:39 AM To: Miguel Loureiro Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] consult different databases on different machines Miguel: 1). Are you trying to connect an MS Access database to a MySQL database? 2). Are the databases and servers both/individually remote or local? See if: http://gertrude.anglia.ac.uk/webteam/tips/php_sql/odbc.htm helps you any. Good luck. Russ On Tue, 20 Nov 2001 12:35:29 + Miguel Loureiro [EMAIL PROTECTED] wrote: Hello all, I'm working with 2 different systems ( php/mysql in Winnt and php/mysql in linux machine), and I would like from WinNt machine consult information in linux machine !!! When I make connection i got no problem(since in linux machine had created an user to acess a database like username@% ...), but when I made a simple select I got an error message :impossible to execute select . My question is , is it really impossible to do that (from winnt access linux/mysql database )??? I think not, because if it was impossible I never access database,wright??? Any ideas about that would help. Thanhs for your time -- Best Regards Miguel Joaquim Rodrigues Loureiro #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] consult different databases on different machines
Right then: * You have 2 remote MySQL DB's on different O/S's * You want one to 'talk' to the other one? errr (whirrr grind..etc) I'm sorry if you've already stated this in your first email, but could you not just query both DB's separatley using mysql_select_db() Using separate DB connections? I guess it depends on the type of query you want from both DB's... I'm sorry but that''s about as far as I can go! Good luck though. Russ On Tue, 20 Nov 2001 14:12:58 + Miguel Loureiro [EMAIL PROTECTED] wrote: Hello Russ: Russ Michell wrote: Miguel: 1). Are you trying to connect an MS Access database to a MySQL database? No, they are both Mysql databases. 2). Are the databases and servers both/individually remote or local? I have 2 database servers, in Winnt apache/php/mysql for win32 and in linux(suse)apache/php/mysql, so they are different ... Thanks for your time. -- Best Regards Miguel Joaquim Rodrigues Loureiro #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: RE: [PHP-DB] consult different databases on different machines
Exactly what I just suggested - hey do we have telepathic abilities or what?? :-) Russ On Tue, 20 Nov 2001 08:21:24 -0600 Rick Emery [EMAIL PROTECTED] wrote: Hey Russ, I'm wondering. Maybe this might work. What do you think?: $server1 = mysql_connect(server_1,user1,password1); $server2 = mysql_connect(server_2,user2,password2); $db1 = mysql_select_db(database1,$server1); $db2 = mysql_select_db(database2,$server2); rick Richard Emery IT Sr. Project Manager (972) 478-3398 -Original Message- From: Rick Emery Sent: Tuesday, November 20, 2001 8:13 AM To: '[EMAIL PROTECTED]' Subject: RE: RE: [PHP-DB] consult different databases on different machines I got no clue either. I'm hoping somebody can, though. rick Richard Emery IT Sr. Project Manager (972) 478-3398 -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 20, 2001 8:09 AM To: Rick Emery Cc: [EMAIL PROTECTED] Subject: Re: RE: [PHP-DB] consult different databases on different machines In which case you're best off helping him as I have no idea! Russ On Tue, 20 Nov 2001 08:10:02 -0600 Rick Emery [EMAIL PROTECTED] wrote: 1. He's not trying to connect MS Access to mySQL. He's trying TO ACCESS a mySQL database on a Win-NT machine. 2. Both mySQL servers are remote. -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 20, 2001 6:39 AM To: Miguel Loureiro Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] consult different databases on different machines Miguel: 1). Are you trying to connect an MS Access database to a MySQL database? 2). Are the databases and servers both/individually remote or local? See if: http://gertrude.anglia.ac.uk/webteam/tips/php_sql/odbc.htm helps you any. Good luck. Russ On Tue, 20 Nov 2001 12:35:29 + Miguel Loureiro [EMAIL PROTECTED] wrote: Hello all, I'm working with 2 different systems ( php/mysql in Winnt and php/mysql in linux machine), and I would like from WinNt machine consult information in linux machine !!! When I make connection i got no problem(since in linux machine had created an user to acess a database like username@% ...), but when I made a simple select I got an error message :impossible to execute select . My question is , is it really impossible to do that (from winnt access linux/mysql database )??? I think not, because if it was impossible I never access database,wright??? Any ideas about that would help. Thanhs for your time -- Best Regards Miguel Joaquim Rodrigues Loureiro #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Retrieve HTML from db
* You could cheat and wrap anchor tags around the DB content you want to display as a hyperlink * If you know which variable from the DB you wish to be displayed as a link then: $variable = a href=\yourpage.php\$variable/a; HTH :-) Russ On Tue, 20 Nov 2001 11:54:25 -0400 Joe Van Meer [EMAIL PROTECTED] wrote: Hi there...I have a db filled with various HTML code examples, tags, etc... how would I format it so that it would appear like A href='index.php'Link One/a. I was using the strip_tags() function and quickly found out that this wasn't the best way to do it :) Cheers, Joe:) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP results bold in HTML
Do you have a URL we can look at? Russ On Fri, 16 Nov 2001 12:44:14 +0100 Kevin Schaaps [EMAIL PROTECTED] wrote: Hi everyone, I've noticed something strange, and I was wondering if you knew the answer: When I put the results of a query on a HTML page, the data that comes from the database (mysql) appears bold, while there is nothing to suggests it needs to that that in the HTML coding. I would like to change this so that the information isn't bolded. Any ideas or suggestions on this rather strange issue would be greatly appreciated! Yours, Kevin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP results bold in HTML
Well depending on what results you have displayed in bold, you're using the HTML th tag, which automatically bolds any text inbetween. You should be a bit more consistent with its use: * Your use: td width=\135\bClass/b/th * Proper use: td width=\135\bClass/b/td or: th width=\135\bClass/b/th Maybe that's it?? Russ On Fri, 16 Nov 2001 12:53:07 +0100 Kevin Schaaps [EMAIL PROTECTED] wrote: Thanks Matt, Here it is: mysql_select_db ($dbname); // - -- // FLEET LIST // - -- $query = SELECT sim_tbl.name as SimName, class_tbl.class as SimClass, type_tbl.type as ClassType, sim_tbl.npc as SimNPC FROM sim_tbl, class_tbl, type_tbl WHERE sim_tbl.class = class_tbl.id AND class_tbl.type = type_tbl.id AND sim_tbl.fleet = $fleet_id ORDER BY 1; // - -- $result = mysql_query($query); $num_rows = mysql_num_rows($result); if ($num_rows != 0) { print table class=\db1\ tr td width=\60\/th td width=\135\bClass/b/th td width=\135\bName/b/th td width=\135\bType/b/th td width=\135\bNPC/b/th /tr; while ($row = mysql_fetch_array($result)) { $name = $row[SimName]; $class = $row[SimClass]; $type = $row[ClassType]; $NPC= $row[SimNPC]; if ($NPC == 1) { echo tr td/th td$class/th td$name/th td$type/th tdNON PLAYING SIM/th /tr\n; } else { echo tr td/th tdclass/h3/th td$name/h3/th td$type/h3/th tdACTIVE SIM/h3/th /tr\n; } }; } Matt Stewart [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... if you post a bit of the offending code then i'll have a look - sounds strange though -Original Message- From: Kevin Schaaps [mailto:[EMAIL PROTECTED]] Sent: 16 November 2001 11:44 To: [EMAIL PROTECTED] Subject: [PHP-DB] PHP results bold in HTML Hi everyone, I've noticed something strange, and I was wondering if you knew the answer: When I put the results of a query on a HTML page, the data that comes from the database (mysql) appears bold, while there is nothing to suggests it needs to that that in the HTML coding. I would like to change this so that the information isn't bolded. Any ideas or suggestions on this rather strange issue would be greatly appreciated! Yours, Kevin -- 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.295 / Virus Database: 159 - Release Date: 01/11/01 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Need Help on subtract Time
Kelvin: If you're using MySQL - go check out: http://www.mysql.com/doc/D/a/Date_and_time_functions.html It has some great little MySQL data and time functions. I have personally found it invaluable. Good luck! :-) Russ On Wed, 14 Nov 2001 15:49:03 -0500 kelvin [EMAIL PROTECTED] wrote: Hi everyone, I have a table with those field. ---Username, Uid, and Time. Ok, I tried to select data which their time is 2 min less from the current time or so. Could anyone help me out, How to do it? This is what I got, but doesn't work. select * from tablename where time date(H:i:s,(time()-720)); Please help!!! Thanks. Kelvin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Validation of multiple variables using single include file
See the thread at: http://www.phpbuilder.com/forum/read.php3?num=2id=163227thread=162776 for a php solution to this. Thanks to that Vincent chap over there in the netherlands. Russ On Tue, 13 Nov 2001 22:33:12 -0500 CK Raju [EMAIL PROTECTED] wrote: I use PHP with MySQL on Linux box. I have some 70 odd forms in one of my application, each with varying number of parameters. Is it possible to have a single function declared using JavaScript that can accept multiple variables as parameters for validation check, before the form is submitted. What would be the syntax ? ie at the end of the form I can just write onClick=validate(parameterA, parameterB, parameterC) Thanx in advance. CK Raju -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: RE: [PHP-DB] inserting array into mySQL
As we say here in Dallas: there are two kinds of people...those who live in Texas...and those who wish they did. Texas?? Never heard of it! Is that somewhere north of Manchester? ;-) Russ On Fri, 9 Nov 2001 14:22:22 - matt stewart [EMAIL PROTECTED] wrote: As we say here in Dallas: there are two kinds of people...those who live in Texas...and those who wish they did. Full Metal Jacket? ;) --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.295 / Virus Database: 159 - Release Date: 01/11/01 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Newbie Question
Yes there is: Using a php function called: nl2br() When the data is called from the db and printed to the page use $textdata = nl2br($textdata) This will preserve the enter button being pressed. Regards: Russ On Thu, 08 Nov 2001 09:54:16 -0600 Jay Fitzgerald [EMAIL PROTECTED] wrote: Ok, I am still fairly new at PHP and MySQL also, so please bear with me. TASK: I have a client that wants to have job openings listed on their site and they want to be able to add, edit and delete the postings themselves. I would do this in flat-file format but there is the risk of that file size getting too large and slowing down the server. SOLUTION: I have created a MySQL database that will hold all the postings in a table called 'jobs' and have created a PHP form that will post this jobs into the db. PROBLEM: When I go to the PHP form and enter all of the pertinent job information, there is one specific field that will have to have carriage returns/line breaks in it between paragraphs. Everything is working except for this. Is there a way whenever the user presses ENTER, that either PHP/MySQL will convert this into a BR tag only when being displayed in a browser and not in the db?? Can anyone out there please help me with this? I am available off-list as well if it will be easier to pass code back and forth. Any assistance is greatly appreciated! Should you have any questions, comments or concerns, feel free to call me at 318-338-2034. Thank you for your time, Jay Fitzgerald, Design Director - CSBW-A, CPW-A, CWD-A, CEMS-A == Bayou Internet..(888) 30-BAYOUhttp://www.bayou.com Mississippi Internet...(800) MISSISSIPPI...http://www.mississippi.net Vicksburg Online..(800) MISSISSIPPIhttp://www.vicksburg.com == Tel: (318) 338-2034ICQ: 38823829 Fax: (318) 323-5053 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] mySQL LOAD DATA INFILE
2 things: mysql_query($QueryInsert); print mysql_error(); Should read: $query = mysql_query($QueryInsert) or die(mysql_error()); and: It returns Can't get stat of '/www/publico2/tableData0TMRRy' (Errcode: 13). what exactly is: tableData0TMRRy?? if it should be a file, it should be called 'myfile.txt' (with a file suffix) HTH Russ On Tue, 6 Nov 2001 14:56:00 +0200 =?iso-8859-1?Q?Niklas_Lamp=E9n?= [EMAIL PROTECTED] wrote: I have this code: ? $dir = getcwd(); $fpName = tempnam($dir, tableData); $fp = fopen($fpName, w); fputs($fp, $strData); fclose($fp); $QueryInsert = LOAD DATA INFILE '$fpName' INTO TABLE feStatics FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n' ; mysql_query($QueryInsert); print mysql_error(); unlink($fpName); ? It returns Can't get stat of '/www/publico2/tableData0TMRRy' (Errcode: 13). I'd put this file into mySQL's database dir, but I have no access there. Any ideas how to do this? Inserting file row by row would take like eternity, so that is not a good idea. Niklas #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] sending bulk emails
Does anybody know how to send bulk emails using php? Don't do it!! But of you must - I guess you could build an array containing email addresses, names, etc - taken from form input or a database or whatever and then loop the arrays mailing people... $mail = mail(; for($i=0; $i$email_array_name;$i++( { $mail .= $values,; } $mail .= \$subject\,\$body\,\From: $from\);; Something like that anyway (that's just off the top of my head) Regards. Russ On Fri, 2 Nov 2001 11:26:22 - Cami [EMAIL PROTECTED] wrote: Hi guys, Does anybody know how to send bulk emails using php? Thanks, Cami -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: RE: [PHP-DB] sending bulk emails
Hmmm this is true - but as someone once wrote on this list: If someone want's to build a car with 4 reverse gears, we can tell them it's not a very good idea, but we can also show them how to do it. Granted though - spam is a little different than cars! Cheers. Russ On Fri, 2 Nov 2001 07:26:15 -0600 Rick Emery [EMAIL PROTECTED] wrote: Opswe've just armed a potential spammer... -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: Friday, November 02, 2001 6:20 AM To: Cami Cc: PHP DB list Subject: Re: [PHP-DB] sending bulk emails Does anybody know how to send bulk emails using php? Don't do it!! But of you must - I guess you could build an array containing email addresses, names, etc - taken from form input or a database or whatever and then loop the arrays mailing people... $mail = mail(; for($i=0; $i$email_array_name;$i++( { $mail .= $values,; } $mail .= \$subject\,\$body\,\From: $from\);; Something like that anyway (that's just off the top of my head) Regards. Russ On Fri, 2 Nov 2001 11:26:22 - Cami [EMAIL PROTECTED] wrote: Hi guys, Does anybody know how to send bulk emails using php? Thanks, Cami -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] php bulletin/dicussion board
http://phorum.org/ Russ On Thu, 1 Nov 2001 15:52:01 - Tom Hodder [EMAIL PROTECTED] wrote: Hi, can anyone recommend a good php discussion/bulletin board thats free, as I need to choose one and have been over whelmed by the variety available. Cheers Tom Hodder -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Learning PHP Sessions
* session_register('myvar'); creates a session var called $myvar * session_start(); needs to be called from the top of each script that will need the session var $myvar * session_destroy('myvar'); rids you of $myvar completely. * session_destroy('HTTP_SESSION_VARS'); rids you off *all* currently registered session vars Note that a variable used in this way is refered to as 'myvar' and referenced a snormal within the script as: $myvar HTH you out. Russ On Wed, 31 Oct 2001 09:55:33 -0600 Steve Cayford [EMAIL PROTECTED] wrote: This is really off-topic for this list, but... From my understanding of sessions, you really don't want session_start() in an if{} block. Every time you hit this script, it will have no memory of any session variables until you call session_start(). -Steve On Tuesday, October 30, 2001, at 02:30 PM, Matthew Tedder wrote: ?php /* Hi, I'm new to PHP and am having trouble understanding how to use PHP sessions. My book tells in near the beginning how to start them and register session variables, but I can't figure out how to destroy a session or later read those session variables. I'm also trying to do this across frames, but can't even get it to work within a single page. Here's what I've learned so far and what my problems are: */ /* To start a session */ session_start(); /* To register a session variable */ session_register(myvar); $myvar = some value; /* PROBLEM #1: From the above commands, I get a $PHPSESSID that seems to be globally available for use, but I cannot seem to read my values back out of the registered session variable from anywhere... I tried: */ print $myvar\n; /* and absolutely nothing is printed */ /* To destroy a session */ session_destroy(); /* PROBLEM #2: This says there is no session to destroy. It's rather strange because I can still print the $PHPSESSID value.. I've attached my code... */ ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: RE: that book:
Don't quote me on this but the ./configure command when compiling/re-compiling php should be run one level up from the dir you wish to make the action occur in. (One above /path/to/php4.0.6/bin so: ./bin/configure with --this with --that I have cc'd this to the php-db list to make sure this is right (and I'm not even convinced myselfanyone??) Cheers Russ On Mon, 29 Oct 2001 15:26:58 - [EMAIL PROTECTED] wrote: Russ: see below for the question I posted and the reply I got. I hope it makes some sense. My Question was: I have a RedHat 7.2 server which I configured using the automatic configuration GUI. It is running apache 1.3.20, mysql 3.23.41,and php 4.0.6. Apache and php are working fine but I created the phpinof.php page and it is missing any reference to mysql. I am real new to linux but someone I know who is helping me suggested I need to recompile php to integrate mysql and apxs. I searched the forum and a while back found this but I need to know is this right and if could some one interpret it for me! ./configure --with-axps --with-mysql make make install The response was: I don't think you're going to need to recompile. For one, Redhat's automatic configuaration GUI doesn't use source files uses RPM's (basically pre-compiled binaries). Thus, you probably don't have the source readily available and would need to download it. That's not a big problem though:) More to the point, AFAIK, the RPM's are compiled using apxs and the --with-mysql option is default (you have to manually specify that you *don't* want MySQL support). Your best and easiest bet is to add one or more RPM ftp servers into the sources list of the PRM Manager (don't ask me how I don't use Redhat) and run a search for php-mysql. It'll turn up a bunch of hits (probably on the installation cd's as well) for the php-mysql rpm, just select it and install it. In answer to your other question, the make options you've given in your post are valid and won't cause the make to barf and die (assuming you've got MySQL and APXS installed on your box). Personally I find it's useful to place the make clean command before the ./configure options. It ensures you're running a fresh install and not using an old cached config script. --- Just one more question. Do you understand the './configure' command? does it have to be run from a particular directory to be affective? If so how might you find out? Thanks very much for your help today. It is much appreciated - I'm off to amazon now to get the book! James. -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: 29 October 2001 15:00 To: [EMAIL PROTECTED] Subject: that book: James: The book is called: * Fast and Easy Web Development using PHP * By Julie C Meloni Paste this URL into your browser: http://www.amazon.com/exec/obidos/ASIN/076153055X/qid=1004367638/sr=1-6/ref= sr_1_15_6/104-6954028-5527930 and check out also: www.thickbook.com (support website for the book) Good luck! Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Access to MySQL denied
Of course, it works perfectly fine on my home computer, so I guess it musthave something to do with the configuration of PHP (or, possibly, MySQL?) How do you connect to MySQl from home? It sounds as if the user trying to connect to MySQL doesn't have the right privileges to connect top the server. Make sure the 'username' @lsh101.siteprotect.com has been granted all the right privileges on the desired database: GRANT SELECT,INSERT,UPDATE,DELETE ON mydb.* TO username@localhost (or [EMAIL PROTECTED]) IDENTIFIED BY 'your_password'; FLUSH PRIVILIGES; HTH. Russ On Fri, 26 Oct 2001 04:48:56 -0400 Kirill Safarov [EMAIL PROTECTED] wrote: I cannot connect to MySQL database located at the webhost. The command: $link = mysql_connect('hostname:3306','username','password') or die (Could not connect); (with the proper hostname of course) returns this error message: MySQL Connection Failed: Access denied for user: '[EMAIL PROTECTED]' (Using password: YES) Of course, it works perfectly fine on my home computer, so I guess it must have something to do with the configuration of PHP (or, possibly, MySQL?) Can anyone tell me what's going on? Thanks, Kirill :) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] date
User inserts date as a select menu for day, month and year: $day, $month, $year You swap it around for an insert: $dateinsert = $year . $month . $day Then query the DB: Select blah from blah where blah=blah order by datefield (Let MySQL do the rest) Good luck! Russ On Fri, 26 Oct 2001 12:10:51 +0100 ax [EMAIL PROTECTED] wrote: how would i enter european format date into mysql (dd/mm/) ... and how would i make the query sort by date if i am using this format ?? ax -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] mySQL Query and blank fields
Assuming you're using MySQL - 35 seconds is all it took to find: http://www.mysql.com/doc/P/a/Pattern_matching.html Good luck! Russ. On Thu, 25 Oct 2001 14:16:40 +0300 =?iso-8859-1?Q?Niklas_Lamp=E9n?= [EMAIL PROTECTED] wrote: How can I query for specified fields that has to contain atleast 2 charters? Example: Field AAA contains '' (NULL) = No match Field BBB contains ' ' (one charter) = No match Field CCC contains 'ab' = Match Field DDD contains 'abcdefg' = Match Niklas #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Recurse thru dir into DB
Hi there folks, this problem is sincerely 'doing my head in'! I want to know if there is a simpler method of achieving my aims set out below: Script aim: * To alert users subscribed to category's when new files are added to that category. * A category has the same name as each directory in my projects' filesystem. Proposed method (this is what I need a hand with) * Subscribers emails are stored in table 'A' under their associated category. (Each column name reflects a category name) * Subscribers are auto-emailed whenever a new file is added to their category * A script is executed by cron that iterates through all categories at time 'X, once every morning. * The script gets current file numbers per directory and places this data into table 'B'. * Another script, also executed by cron every evening at time 'Y' (after the script above), compares the value of files per directory from table 'B' to the *now* current number of files in each directory. * It inserts these values into a another table 'C' and compares the totals in 'B' and 'C'. * If the totals in 'C' are greater than those in 'B' then detect which category's have had files added and select emails from table 'A' where their subscribed categories = updated categories. * mail() these addresses with the message Directory X has been updated Is this too contrived or is there an easier method? I already have various directory recursion scripts I got from phpbuilder, but the exact method of performing the above kinda eludes me. Any (constructive) comments more than welcome. Kind regards: Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP and MySQL queries...
How about using 3 select menus: * One for the day called 'dayselect' * One for the month called 'monthselect; * One for the year called 'yearselect' When you get the values from the selects to perform query's upon, re-arrange the order the dates come in: In your form they'll be in the order: day,month,year To perform queries into a MySQL DB re-arrange them: $date = $yearselect . - . $monthselect . - . $yearselect; HTH Russ On Tue, 23 Oct 2001 10:52:41 -0600 Jason [EMAIL PROTECTED] wrote: I am having a hard time setting up a form for users to enter a date in the format of 00/00/ (of course they would use an actual date). My form is as follows... form name=auth method=post action=search.php p*I.E. - Format is 04/01/2001*/p pSearch for Ads by date: input type=text name=date /p p input type=submit name=login value=Submit input type=reset name=reset value=Reset /p /form On my search.php page I have the following MySQL connection and search parameters... ?php mysql_connect (db_hostname, db_username, db_password); mysql_select_db (db_name); if ($date == ) {$date = '%';} $result = mysql_query (SELECT fname,lname,address,city,state,zip,phonea,phone,email,crty,crnum,crmo,cryr,w eeks,ogden,rock,logan,ipaddress,ad,total,num,date,time FROM ads WHERE date LIKE '%$date%' LIMIT 0, 30 ); $count = -1; if ($row = mysql_fetch_array($result)) { $count ++; do { echo BName: /B; printf(mysql_result($result,$count,fname)); echo ; printf(mysql_result($result,$count,lname)); echo BR\n; echo BAddress: /B; printf(mysql_result($result,$count,address)); echo BR\n; echo BCity: /B; printf(mysql_result($result,$count,city)); echo BR\n; echo BState: /B; printf(mysql_result($result,$count,state)); echo BR\n; echo BZip: /B; printf(mysql_result($result,$count,zip)); echo BR\n; echo BPhone: /B(; printf(mysql_result($result,$count,phonea)); echo ) ; printf(mysql_result($result,$count,phone)); echo BR\n; echo BEmail: /B; printf(mysql_result($result,$count,email)); echo BR\n; echo BCredit Type: /B; printf(mysql_result($result,$count,crty)); echo BR\n; echo BCredit Number: /B; printf(mysql_result($result,$count,crnum)); echo BR\n; echo BCredit Card Date: /B; printf(mysql_result($result,$count,crmo)); echo ; printf(mysql_result($result,$count,cryr)); echo BR\n; echo BWeeks: /B; printf(mysql_result($result,$count,weeks)); echo BR\n; echo Btown1: /B; printf(mysql_result($result,$count,town1)); echo BR\n; echo Btown2: /B; printf(mysql_result($result,$count,town2)); echo BR\n; echo Btown3: /B; printf(mysql_result($result,$count,town3)); echo BR\n; echo BIP Address: /B; printf(mysql_result($result,$count,ipaddress)); echo BR\n; echo BAd: /B; $ad[$count] = (mysql_result($result,$count,ad)); $ad[$count] = ereg_replace (a, ', $ad[$count]); $ad[$count] = ereg_replace (q, \, $ad[$count]); $ad[$count] = ereg_replace (p, %, $ad[$count]); $ad[$count] = ereg_replace (bs, \\, $ad[$count]); echo $ad[$count]; echo BR\n; echo BTotal: /B; printf(mysql_result($result,$count,total)); echo BR\n; echo BAd Number: /B; printf(mysql_result($result,$count,num)); echo BR\n; echo BDate: /B; printf(mysql_result($result,$count,date)); echo BR\n; echo BTime: /B; printf(mysql_result($result,$count,time)); echo BR\n; } while($row = mysql_fetch_array($result)); } else {print Sorry, no records were found!;} ? So far I have come to the conclusion that the input from the user is probably where my problem is because I am assuming it is taking the / in the date they enter and doing something I don't want it to. In any event if someone could give me a clue as to how to resolve this issue it would be greatly appreciated. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: RE: [PHP-DB] looped insert
NOTE: I didn't read the entire post below...it's too early in the morning to think about code. haha I did that the other day when I tried (and failed) to help out someone else - damn tired, hadn't even had a whiff of beer... Cheers for your help! Russ On Wed, 24 Oct 2001 09:10:59 -0400 Mike Frazer [EMAIL PROTECTED] wrote: Just thought this would be helpful... I've found the occassional problem with trying to insert a script-generated null value (rare but it does happen). If this becomes a problem, remember that NULL is just another word for nothing. MySQL will accept either of the following: INSERT INTO table VALUES ('value1', 'value2', NULL, 'value3'); INSERT INTO table VALUES ('value1', 'value2', , 'value3'); NOTE: I didn't read the entire post below...it's too early in the morning to think about code. I'm off to populate some site content until my brain catches up with the clock. Mike Frazer Russ Michell [EMAIL PROTECTED] wrote in message news:SIMEON.10110231044.D@k1c. anglia.ac.uk... Hi Rick: Cheers for the info. Thwe following code almost does it, however, the NULL value isn't inserted, if checkboxes are != to 'yes': //If submit button selected, process those ticked checkbox categories: if(isset($submit)) { //Start off sql $sql = INSERT INTO $myanet02 (staffdev,strategies,rules,news,information,policies) VALUES(; //loop while categories have been ticked for($i=0;$icount($category);$i++) { if($category[$names] == 'yes') { $sql .= '$email',; } else { $sql .= NULL,; } } //Remove the last comma $sql = substr($sql,0,-1).); //$query = mysql_query($sql,$connect) or die(mysql_error()); echo $sql; } I believe the problem to be this line: 'if($category[$names] == 'yes') {' //Use this and NULL values aren't inserted 'if($HTTP_POST_VARS[category${$i}] == 'yes') {' //Use this and ONLY NULL values are inserted The values are taken from the checkboxes thus: //Get all table column names, dynamically display them and use to process subscriptions: $fields = mysql_list_fields($dbName, myanet_categories, $connect); $columns = mysql_num_fields($fields); for ($i=0; $i$columns; $i++) { $names = mysql_field_name($fields, $i) . \n; $catselect .= b$names /binput type=\checkbox\ name=\category[$names]\ value=\yes\br\n; } You can see it happening at: http://gertrude.anglia.ac.uk/intranet/myanet/index.php Many thanks. Russ On Mon, 22 Oct 2001 12:28:38 -0500 Rick Emery [EMAIL PROTECTED] wrote: Construct your INSERT a piece at a time. Something like: $sql = INSERT INTO $myanet02 (staffdev,strategies,rules,news,information,policies) VALUES(; for($i=0;$icount($category);$i++) { if($HTTP_POST_VARS[category{$i}] == 'yes') { $sql .= \'$email\',; } else { $sql .= NULL,; } } $sql = substring($sql,0,-1).); //$query = mysql_query($sql,$connect) or die(mysql_error()); echo $sql; -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: Monday, October 22, 2001 11:23 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] looped insert Hi everyone: I've been fiddling with this all day, and well - if it was working you wouldn't be reading this right now! ;-) My script should take the selections made by users and process them via straightforward MySQL inserts: //Get all table column names, dynamically display them as checkboxes. Use to process subscriptions: $fields = mysql_list_fields($dbName, myanet_categories, $connect); $columns = mysql_num_fields($fields); for ($i=0; $i$columns; $i++) { $names = mysql_field_name($fields, $i) . \n; $catselect .= b$names /binput type=\checkbox\ name=\category[$names]\ value=\yes\br\n; } //If submit button selected, process those ticked checkbox categories: if(isset($submit)) { //loop while categories have been ticked for($i=0;$icount($category);$i++) { if($HTTP_POST_VARS[category{$i}] == 'yes') { //Not sure about this bit... $sql = INSERT INTO $myanet02 (staffdev,strategies,rules,news,information,policies) VALUES('$email','$email','$email','$email','$email','$email'); //$query = mysql_query($sql,$connect) or die(mysql_error()); echo $sql; } } } At the moment not even echoing my $sql works. I know this aint gonna work as it is, because what I really need to know is: * How do I insert into only those categories that have been checked? (default is 'null' in a VARCHAR(50) field) * How do I only declare '$email' a single time as this is the only value being inserted? Many thanks: Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk
Re: [PHP-DB] Stuck
Is there anyway to do this without popping up a standard basic authentication form box? Sure! Are you making use of a databsae for this? MySQL per chance? If so I may be able to help you out.. * Simply query the fields: 'username' 'password' 'domain' from a DB table called: 'users' * SELECT these on the basis that the data in the DB reflects thatwhich was inputed via login form * If they details exist - login * If not refuse Cheers Russ. On Wed, 24 Oct 2001 09:33:21 -0400 Ryan Marrs [EMAIL PROTECTED] wrote: I'm attempting to do basic authentication through PHP and am having little success. I have a login screen which requests a username and password, and I need to have that check against a Windows domain. IE: Domain: ALPHA Login: testusername Password: TestPassword SUBMIT Then PHP needs to check against the ALPHA domain if the username and password is correct. Is there anyway to do this without popping up a standard basic authentication form box? Thanks! Ryan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: RE: [PHP-DB] looped insert
Hi Rick: Cheers for the info. Thwe following code almost does it, however, the NULL value isn't inserted, if checkboxes are != to 'yes': //If submit button selected, process those ticked checkbox categories: if(isset($submit)) { //Start off sql $sql = INSERT INTO $myanet02 (staffdev,strategies,rules,news,information,policies) VALUES(; //loop while categories have been ticked for($i=0;$icount($category);$i++) { if($category[$names] == 'yes') { $sql .= '$email',; } else { $sql .= NULL,; } } //Remove the last comma $sql = substr($sql,0,-1).); //$query = mysql_query($sql,$connect) or die(mysql_error()); echo $sql; } I believe the problem to be this line: 'if($category[$names] == 'yes') {' //Use this and NULL values aren't inserted 'if($HTTP_POST_VARS[category${$i}] == 'yes') {' //Use this and ONLY NULL values are inserted The values are taken from the checkboxes thus: //Get all table column names, dynamically display them and use to process subscriptions: $fields = mysql_list_fields($dbName, myanet_categories, $connect); $columns = mysql_num_fields($fields); for ($i=0; $i$columns; $i++) { $names = mysql_field_name($fields, $i) . \n; $catselect .= b$names /binput type=\checkbox\ name=\category[$names]\ value=\yes\br\n; } You can see it happening at: http://gertrude.anglia.ac.uk/intranet/myanet/index.php Many thanks. Russ On Mon, 22 Oct 2001 12:28:38 -0500 Rick Emery [EMAIL PROTECTED] wrote: Construct your INSERT a piece at a time. Something like: $sql = INSERT INTO $myanet02 (staffdev,strategies,rules,news,information,policies) VALUES(; for($i=0;$icount($category);$i++) { if($HTTP_POST_VARS[category{$i}] == 'yes') { $sql .= \'$email\',; } else { $sql .= NULL,; } } $sql = substring($sql,0,-1).); //$query = mysql_query($sql,$connect) or die(mysql_error()); echo $sql; -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: Monday, October 22, 2001 11:23 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] looped insert Hi everyone: I've been fiddling with this all day, and well - if it was working you wouldn't be reading this right now! ;-) My script should take the selections made by users and process them via straightforward MySQL inserts: //Get all table column names, dynamically display them as checkboxes. Use to process subscriptions: $fields = mysql_list_fields($dbName, myanet_categories, $connect); $columns = mysql_num_fields($fields); for ($i=0; $i$columns; $i++) { $names = mysql_field_name($fields, $i) . \n; $catselect .= b$names /binput type=\checkbox\ name=\category[$names]\ value=\yes\br\n; } //If submit button selected, process those ticked checkbox categories: if(isset($submit)) { //loop while categories have been ticked for($i=0;$icount($category);$i++) { if($HTTP_POST_VARS[category{$i}] == 'yes') { //Not sure about this bit... $sql = INSERT INTO $myanet02 (staffdev,strategies,rules,news,information,policies) VALUES('$email','$email','$email','$email','$email','$email'); //$query = mysql_query($sql,$connect) or die(mysql_error()); echo $sql; } } } At the moment not even echoing my $sql works. I know this aint gonna work as it is, because what I really need to know is: * How do I insert into only those categories that have been checked? (default is 'null' in a VARCHAR(50) field) * How do I only declare '$email' a single time as this is the only value being inserted? Many thanks: Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com
Re: RE: [PHP-DB] looped insert
Hi all + Rick: Since the last email I have got even closer, here is the code: //If submit button selected, process those ticked checkbox categories: if(isset($submit)) { //Start off sql $sql = INSERT INTO $myanet02 (; //loop while categories have been ticked while(list($key,$val) = each($category)) { if($val != 'yes') { $sql1 .= $key,; $sql2 = substr($sql1,0,-1) . ); $sql3 .= 'NULL',; $sql4 = $sql . $sql1 . $sql2 . VALUES ( . $sql3; } else { $sql1 .= $key,; $sql2 = substr($sql1,0,-1) . ); $sql3 .= '$email',; $sql4 = $sql . $sql1 . $sql2 . VALUES ( . $sql3; } } //Remove the last comma $sql = substr($sql4,0,-1) . ); //$query = mysql_query($sql,$connect) or die(mysql_error()); echo $sql; } However, this returns the following echoed SQL query: INSERT INTO myanet_categories (staffdev ,staffdev )VALUES ('[EMAIL PROTECTED]') This is almost correct, in that I only selected a single category to INSERT INTO (a single email being the inserted value). But as you can see, that category has been repeated in the list of fields to be inserted into. If I select say, 3 categories, then this is what happens: INSERT INTO myanet_categories (staffdev ,rules ,policies ,staffdev ,rules ,policies ) VALUES ('[EMAIL PROTECTED]','[EMAIL PROTECTED]','[EMAIL PROTECTED]') See what I mean? If anyone has any other pointers I would be more than happy to receive them!! Cheers Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: looped insert
Relax! $email comes from a text input, and the categories come from checkboxes dynamically displayed from table column names: //Get all table column names, dynamically display, and use to accept subscriptions to category updates: $fields = mysql_list_fields($dbName, myanet_categories, $connect); $nocolumns = mysql_num_fields($fields); for ($i=0; $i$nocolumns; $i++) { $names = mysql_field_name($fields, $i) . \n; $catselect .= b$names /binput type=\checkbox\ name=\category[$names]\ value=\yes\br\n; } I got it to work thus: //Start off sql $sql = INSERT INTO $myanet02 (; //start display confirmation of subscribed categories $category_list = ul\n\t; //loop while categories have been ticked while(list($key,$val) = each($category)) { //trim whitespace from the end of $key (inherited from original var declaration of '$names' above) $sql1 .= rtrim($key) . ,; $sql2 = substr($sql1,0,-1). ); $sql3 .= '$email',; $sql4 = $sql . $sql2 . VALUES ( . $sql3; //continue display confirmation of subscribed categories $category_list .= li$key/li\n; } $category_list .= /ul; //Remove the last comma from data to be inserted $sql = substr($sql4,0,-1) . ); $query = mysql_query($sql,$connect) or die(mysql_error()); $confirm = You have now been subscribed to the following categories: $category_list; } } Thanks v.much for your concern, but it works quite well now! Cheers. Russ On Tue, 23 Oct 2001 11:39:30 -0400 bill [EMAIL PROTECTED] wrote: Hi Russ, It's not clear that you're keeping track of which categories are being checked. You name them category[$names] but you refer to them as $category[$i] where $i is a number. How will you know what $category[1] refers to? Other issues: It's also not clear where the value of $email comes from. Nor is it clear if you're trying to obtain one row in the database with all subscriptions or whether you could have multiple lines for multiple subscriptions. Try this while (list($key,$val)= each ($HTTP_POST_VARS[category]) ) { $thisname=$key; // this is the name of the checkbox, as in $category[$name] $thisval=$val; // this is the value, which in every case is yes $sql=INSERT INTO $myanet02($thisname) values ($email); // this will produce a line in the db for each subscription // if you want one line for all subscriptions, remvoe the $sql line above and // uncomment these lines below // to compound the sql and run the query after the while // if ($thefields) $thefields .= , $thisname; } else { $thefields = $thisname; } // if($thevalues) $thevalues .= ,'$email' } else { $thevalues = '$email'; } $query = mysql_query($sql,$connect) or die(mysql_error()); } // end while // uncomment following lines for single row entry // $sql= INSERT INTO $myanet02($thefields) values ($thevalues); // echo $sql; // $query = mysql_query($sql,$connect) or die(mysql_error()); kind regards, bill hollett Russ Michell wrote: Hi everyone: I've been fiddling with this all day, and well - if it was working you wouldn't be reading this right now! ;-) My script should take the selections made by users and process them via straightforward MySQL inserts: //Get all table column names, dynamically display them as checkboxes. Use to process subscriptions: $fields = mysql_list_fields($dbName, myanet_categories, $connect); $columns = mysql_num_fields($fields); for ($i=0; $i$columns; $i++) { $names = mysql_field_name($fields, $i) . \n; $catselect .= b$names /binput type=\checkbox\ name=\category[$names]\ value=\yes\br\n; } //If submit button selected, process those ticked checkbox categories: if(isset($submit)) { //loop while categories have been ticked for($i=0;$icount($category);$i++) { if($HTTP_POST_VARS[category{$i}] == 'yes') { //Not sure about this bit... $sql = INSERT INTO $myanet02 (staffdev,strategies,rules,news,information,policies) VALUES('$email','$email','$email','$email','$email','$email'); //$query = mysql_query($sql,$connect) or die(mysql_error()); echo $sql; } } } At the moment not even echoing my $sql works. I know this aint gonna work as it is, because what I really need to know is: * How do I insert into only those categories that have been checked? (default is 'null' in a VARCHAR(50) field) * How do I only declare '$email' a single time as this is the only value being inserted? Many thanks: Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University WebteamRoom 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam
Re: [PHP-DB] Asigning function values to variables??
Not entirley sure what you're trying to do but, if the '.box_header' and '.box_footer' are css classes, then it won't show up in people's text-only email. if not then try removing the second periods '.' so i tlooks like: $body .= box_header('test').; $body .= h1text/h1; $body .= box_footer().; HTH Russ $body .= .box_header('test').; $body .= h1text/h1; $body .= .box_footer().; On Sun, 21 Oct 2001 20:06:55 +0200 Luditus [EMAIL PROTECTED] wrote: Hi there, I am trying to send an email with html tags coming from functions. Something is wrong with asigning the value to the variable. I guess I don't know the proper syntax. Can anybody help me out? e.g.: $body .= .box_header('test').; $body .= h1text/h1; $body .= .box_footer().; Thanx in advance Luditus -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: RE: [PHP-DB] Order By for search results ???
Maybe I'm slow...I'm trying to decipher what you're trying to do. Show us your table layout Show us your search criteria and code Show us a dump of your table so we can see what the data look like ahhh give the chap a break, this is 4th (or so) posting. he thinks we're all wonderful! Let's not mess that up for him: You had it when you said: ..how do I ORDER BY and then.. SELECT * FROM your_table WHERE foo LIKE '%bar%' ORDER BY some_field LIMIT some_limit * You could set some_field in your code or have it as a variable set from the web-page: Click table headings to sort by that field etc etc * You could also have some_limit set as a number from a select menu again on the web page of search results. Good luck! Russ PS Where is this search engine? can I have a look??? go on - you know it makes sense On Thu, 18 Oct 2001 12:46:25 -0500 Rick Emery [EMAIL PROTECTED] wrote: Maybe I'm slow... I'm trying to decipher what you're trying to do. Show us your table layout Show us your search criteria and code Show us a dump of your table so we can see what the data look like -Original Message- From: Chris Payne [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 18, 2001 12:08 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Order By for search results ??? Hi there everyone, I am happy, I have my search engine working almost perfectly (Touch wood :-) but there is one problem. When I search - say for Backpacking in Australia it doesn't bring up the results in that order as I have to order by country, city or whatever. What I want to know is, how do I ORDER BY and then my search results so that I get the nearest matches at the top of the search? Thank you all for your help, this list is the best place to be for PHP :-) Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] newbie - problems with Select and timestamp(14) calculation
(NOW()+0) Not sure what the +0 achieves?? Try with just NOW(). Cheers. Russ On Thu, 18 Oct 2001 11:41:14 +0100 p.whiter [EMAIL PROTECTED] wrote: Hi I am trying to set-up a type of anti-flood block on one of my forms, the way I am doing this is that when the first submission is made I log various details into a user_log table including IP no and a Timestamp (14) column called log_time. Now if the button is clicked again the php script will run the following query: SELECT user_ip FROM clinic_log WHERE user_ip = '$pw_userIP' AND (((NOW()+0) - clinic_log.log_time ) 300) What I am (trying) doing here is to check the users IP ($pw_userIP) against the user_ip column in the database and if it matches then check to see whether it has been there for less than 300 seconds. I have just spent the last couple of hours trying to get this working..it doesn't want to know. It keeps finding the matching IP and disregarding the time calculation.. Thanks for any help. Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: RE: [PHP-DB] RE: Excel to MySQL
Check this out: http://gertrude.anglia.ac.uk/webteam/tips/php_sql/odbc.htm Step by step instructions on how to connect Access to MySQL (from PC/workstation to remote server) Cheers. Russ On Thu, 18 Oct 2001 13:44:15 +0100 Tony McCrory [EMAIL PROTECTED] wrote: You could try the MyODBC driver. On the www.mysql.com website I think. Then you won't need CSV or any other type of import file. Tony -Original Message- From: Mikusch, Rita [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 17, 2001 5:05 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] RE: Excel to MySQL I do this fairly often (actually from MSSQL to Access to Excel to MySQL -- I'm sure there's a shorter route!) I convert the Excel file to a tab delimited file. I do run into two problems: a) some of the text entries are surrounded by double quotes and some aren't (some kind of Excel weirdness). So I open it up in a text editor and delete all the quotes. I use the programmers file editor which is about a zillion years old, hasn't been updated for years, but deletes those quotes in milliseconds. b) sometimes users enter hard-returns into the text data they enter into the windows database (the source of my excel file). This will convert into a hard return in your tab delimited text file. I run through the list manually to find the hard returns and delete them. My list is only 10,000 long and it is formatted in such a way that makes these hard returns easy to see! I'm sure others on the list have a much better way of dealing with this. I have an auto increment field in my table so I add an additional numbered column in Excel and number it appropriately. One day when I have time I'll actually find a more efficient way of doing all this! good-luck rita. -Original Message- From: Chris Payne [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 16, 2001 10:58 PM To: [EMAIL PROTECTED] Subject: Excel to MySQL Hi there everyone, What is the best way to convert an Excel spreadsheet into a MySQL database? Should I save it as a comma'd file or is there a better way? If I have to save it as a comma'd text file, is there anything special I should do first? I would normally enter the data manually on my server, but we are talking in excess of 15000+ entries here which is way too many to add manually. Thanks for all your help. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] wildcard in mysql search with php
Sure use: SELECT * FROM table WHERE foo LIKE '%$bar%' selects all records where 'bar' is found somewhere in the search string. See also: http://www.mysql.com/doc/S/t/String_comparison_functions.html HTH :-) Russ On Thu, 18 Oct 2001 15:57:56 +0200 Thomas \omega\ Henning [EMAIL PROTECTED] wrote: Hello all, Is there a way to use wildcards in search in a mySQL db? e.g. I have a dbase of over 24000 records and i can only search exact matches is there a way to search something like this : *admin* in mySQL? Or i have to do it by hand in PHP? Thanks Sir Thomas omega Henning -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] newbie - problems with Select and timestamp(14) calculation
Take a good look at the manual page, it helped me out a bunch of times: http://www.mysql.com/doc/D/a/Date_and_time_functions.html Good luck. Russ On Thu, 18 Oct 2001 14:02:34 +0100 p.whiter [EMAIL PROTECTED] wrote: Hi Thanks for your reply, I have tried this using NOW() and NOW()+0, there is no difference, I think I have narrowed the problem down to the time part of the timestamp being disregarded, as I have written the query below it is making the calculation using days rather than seconds.. This should really be a rather simple query to achieve, but it is turning into a big headache. Thanks again Paul - Original Message - From: Russ Michell [EMAIL PROTECTED] To: p.whiter [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, October 18, 2001 12:24 PM Subject: Re: [PHP-DB] newbie - problems with Select and timestamp(14) calculation : (NOW()+0) : Not sure what the +0 achieves?? Try with just NOW(). : : Cheers. : Russ : : On Thu, 18 Oct 2001 11:41:14 +0100 p.whiter [EMAIL PROTECTED] wrote: : : Hi : I am trying to set-up a type of anti-flood block on one of my forms, the way : I am doing this is that when the first submission is made I log various : details into a user_log table including IP no and a Timestamp (14) column : called log_time. Now if the button is clicked again the php script will run : the following query: : : SELECT user_ip FROM clinic_log WHERE user_ip = '$pw_userIP' AND : (((NOW()+0) - clinic_log.log_time ) 300) : : What I am (trying) doing here is to check the users IP ($pw_userIP) against : the user_ip column in the database and if it matches then check to see : whether it has been there for less than 300 seconds. : : I have just spent the last couple of hours trying to get this : working..it doesn't want to know. It keeps finding the matching IP and : disregarding the time calculation.. : : Thanks for any help. : Paul -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Re: PHP and MS Access
For information: For step by step info on using ODBC to connect MySQL to M$ Access go to: http://gertrude.anglia.ac.uk/webteam/tips/php_sql/odbc.htm Cheers. Russ On Wed, 3 Oct 2001 15:47:07 -0500 Carlos Augusto Abarca [EMAIL PROTECTED] wrote: This is absolutely not true. Although there isn´t a direct way to connect to Access from PHP (like you can do with PosgresSQL) you may connect to access using an ODBC connection. The only thing they have to do is Configure an ODBC DSN in their server pointing to your specific DB file and that´s it. I hope I understood your problem correctly and I hope this answer is satisfactory. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] navigation...
Hi there deco: I'm trying to do the same thing myself (Indent posts for a message forum) Here is something I pulled off phpbuilder yesterday: Generally speaking, threading is evil. Nevertheless, I'll tell you how to do it. Store the comments in a table. Each comment should have a unique ID. One of the fields should be the ID of a parent. Any comment with a null parent is a root-level comment. Any comment with a parent, obviously, is a followup or child. To display: Write a function getlinks($parentid). If $parentid is not zero, increment a global indentation counter. Select for all comments where parentid=$parentid. For each returned object, loop from 0 to the indentation counter value, printing out an indentation character (a nonbreaking space will do). Then print out the link to the current item and call getlinks() with the current item's unique ID as an argument. At the end of the function, decrement the indentation counter and return. What you've just done is created a recursive function. Call it with an argument of zero: getlinks(0) and it will begin with all the root-level comments. It will follow each item's chain and print out a complete tree-structured set of links. Or type in indented into the phpbuilder search field to find the original thread. If you find a solid way of doing this, please let me know as I'm evaluating wether or not it's actually worth it. Cheers. Russ On Mon, 1 Oct 2001 22:47:30 +0100 deco [EMAIL PROTECTED] wrote: I'm trying to solve a problem... I have a site divided in areas. Each area has it's own id, and may have it's own sub-areas. Each sub-area has it's own sub-areas, etc... My will is to return the areas in some cascade order... I can do it recursively, but it generates too many queries. I was wondering how i could do this with only one query to the database. Here's the structure i have so far: AREAS (area_id INT; parent_id INT; root_id(??) INT; description VARCHAR(60)); Can anyone help?? Thanks in advance... PS: I think this would very similar to a threaded forum... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] javascript
function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } Click a href=\#\ onClick=\MM_openBrWindow(file.php?myvar=set,mywin,'status=1,toolbar=0'this to open new window/a Good luck. Russ On Wed, 26 Sep 2001 05:41:05 -0700 its me [EMAIL PROTECTED] wrote: hi there.does anyone know how to pass a variable value to the new window i opened with open() of javascript? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] javascript
That's a one off though It has NOTHING to do with databases!!! Russ On Wed, 26 Sep 2001 05:41:05 -0700 its me [EMAIL PROTECTED] wrote: hi there.does anyone know how to pass a variable value to the new window i opened with open() of javascript? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] MySQL Hash Function
G'day folks: I have a seemingly simple problem: I keep my passwords as simple MySQL hashes in a users' table. The rest of the system is reliant on this fact (othewise I'd change it quick sharp!) I've just constructed a simple username/password retrieval system, but don't know how to unhash the password if I'm not giving the password to the SQL SELECT statement: //Get username section here, then get password section (below) //user inputs email and username in order to retrieve lost password: else if(isset($getPassword)) { if((empty($Email)) || (empty($Username))) { $error = pbOne of the fields is empty!/b/p; } else if (!(ereg(^.+@.+\..+$, $Email))) { $error = The email address: 'i$Email/i ' is invalid!br; } else { $sql = SELECT usrName,usrPswd,Email FROM $table_realReg WHERE usrName='$Username' AND Email='$Email'; $result = mysql_query($sql,$connection) or die(mysql_error()); while($row = mysql_fetch_array($result)) { $email = $row['Email']; $Pas = $row['usrPswd']; } $error = pbYour lost password has been sent to: $Email./b/p; $to = $email; $subject = Your lost Password!; $body = Here is your lost Password!\n\n . Your Password: $Pas\n\n; $from = lost-details; mail($to,$subject,$body,From: $from); } } At the moment this retrieves the password hash. I can't use the MySQL password() function because I'm not passing a variable for it to operate upon. So how can I use php to 'unhash' it?? What am I missing here? Many thanks. Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] adding the results of a number of calls to mysql_query
If I have the right end of the stick you want: SELECT * FROM table99_98,table00_01 WHERE table99_98.foo='$bar' AND table00_01.foo='$bar'; Russ On Mon, 24 Sep 2001 10:50:02 +0100 Cable, Christian [EMAIL PROTECTED] wrote: system: win NT4 server (IIS4, php4) Problem: I'm writing a web front end to an old in house access database with tables split over years (rather than the row having what year it's in) i.e. table00_01 table 99_98 etc etc ideally I'd like to run the same query against each table and the fetch rows form it the result of all the queries. any ideas on how I can do this ? with thanks Christian Christian Cable ICT Assistant Careers Service; Lancaster University Tel: (01524) 594072 Fax: (01524) 592072 http://www.lancs.ac.uk/staff/cable/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: RE: [PHP-DB] Searching MySQL using LIKE
Try: REGEXP 'keyword?'; //Matches Zero or one instances of 'keyword' REGEXP 'keyword+'; //Matches One or more instances of 'keyword' REGEXP 'keyword*'; //Matches Zero or more instances of 'keyword' Cheers. Russ '; On Fri, 21 Sep 2001 04:14:47 -0700 Ralph Guzman [EMAIL PROTECTED] wrote: Postfix Users, e need to try and help out in any way I can. So here goes: Jord, Try using REGEXP rather than LIKE. So try something like this: SELECT * FROM table WHERE keywords REGEXP '%keyword%'; If this does not work I may have the wrong string pattern, if so, do a search on REGEXP on the mySQL manual: http://www.mysql.com/doc/. I'm sure they have examples on using REGEXP. Good Luck. -Original Message- From: Jordan Elver [mailto:[EMAIL PROTECTED]] Sent: Friday, September 21, 2001 9:03 AM To: MySQL Mailing List; PHP DB Mailing List Subject: [PHP-DB] Searching MySQL using LIKE Hi, I'm cross posting this because it's applicable to both list ;-) I have a table which contains a field called Keywords. The field typically contains something similar to this rubbish bins trash I want to search this field and I'm having trouble. If someone enters I need bins then the the result will not be found. I started off by using SELECT * FROM table WHERE keywords LIKE '%keyword%', but that doesn't work if you type in more than just bins. So then I tried splitting the words entered on a space and searching for each of them like this SELECT * FROM table WHERE keywords LIKE '%keyword1%' OR keywords LIKE '%keyword1%'. But that returns loads of results because a lot of words contain is or it etc. Can anyone help me with this one, I'm not sure what to try next? Cheer, Jord -- Jordan Elver Web Developer The InternetOne UK Ltd -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] INSERT prob
Hallo everyone I am, as one might say, 'near yet so far' * I have a page of user subscription info generated on the fly * I want an administrator to check a box on each result set * The info from each checked result set should be inserted into another table (A new row/tuple for each user) I am currently using each form element as an array to hold x number of Names, Adresses etc. Where 'x' is the number of results generated, and consequently the number of checkboxes generated. The processing script loops thru this and inserts only those results that have been checked by the administrator in inserted in a new row. Using $HTTP_POST_VARS and dumping that to the page displays (obviousely) 'array', 'array', etc. As each hidden form element is an array and also an $HTTP_POST_VARS element) I need some way to extract the value of each array's keys so that they can be used in an SQL INSERT. I'm using MySQL-3.22.32 and php4.0.3pl1 Here is what I have as the processing script, but as you should be able to see it is immedietley very limiting: while (list($key,$val) = each($Name)) { $insertsql = INSERT INTO $table_user (Name) VALUES ('$val'); $result = mysql_query($insertsql, $connection) or die(mysql_error()); } This simply INSERTS the values in the Name array, into a new row for each name held in the array. Is it possible to somehow extend this loop or use a different kind of loop to insert all the array values in this manner? Ideally it would work like this (This is JUST to illustrate the point, I KNOW it won't work!!) while (list($key,$val) = each($Name,$Address,$Age,$Course)) { $insertsql = INSERT INTO $table_user (Name,Address,Age,Course) VALUES ('$valName','$valAddress','$valAge','$valCourse'); $result = mysql_query($insertsql, $connection) or die(mysql_error()); } Can anyone make any suggestions that would help me here? Many thanks in advance! Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Query construction
Hi there: Further to a previous submission (which can be ignored), I'd like the following query to 'search' a table field of different team names (stored as a single string), but it does't seem to work! SELECT * FROM $table_users WHERE usrName='$username' AND usrPswd=password('$password') AND affil_team RLIKE '$team+'; (I've also tried: RLIKE '$team?' ) This should match the string found in the variable: '$team' with the some of contents (string) found in 'affil_team'. For example my test has been, trying to find 'footballSat', so $team = 'footballSat'. 'footballSat' exists as part of the string in the 'affil_team' field but the above query refuses to find 'footballSat'!! (No error is received though) I'm using MySQL 3.22.32 + php4.0.3pl1 Cheers Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: RE: [PHP-DB] Query construction
If you mean did the pattern I'm trying to match: $team, contain what I though it should: 'footballSat' then yes it did. I also receieve no error message from MySQl The string in the table field I can view/alter in phpMyAdmin and I've tried matching $team in the query to the string as: footballSatfootballSun (etc etc) and also as: footballSat footballSun (etc etc).. Any ideas?? Many thanks. Russ On Wed, 19 Sep 2001 09:12:36 -0500 Rick Emery [EMAIL PROTECTED] wrote: When you printed-out the string variable containing the SELECT statement, what did it look like? -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 19, 2001 9:01 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Query construction Hi there: Further to a previous submission (which can be ignored), I'd like the following query to 'search' a table field of different team names (stored as a single string), but it does't seem to work! SELECT * FROM $table_users WHERE usrName='$username' AND usrPswd=password('$password') AND affil_team RLIKE '$team+'; (I've also tried: RLIKE '$team?' ) This should match the string found in the variable: '$team' with the some of contents (string) found in 'affil_team'. For example my test has been, trying to find 'footballSat', so $team = 'footballSat'. 'footballSat' exists as part of the string in the 'affil_team' field but the above query refuses to find 'footballSat'!! (No error is received though) I'm using MySQL 3.22.32 + php4.0.3pl1 Cheers Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: RE: RE: [PHP-DB] Query construction
I'm sorry but I must be missing something fundamental here. This is how my code looks, and if the SQL query yields nothing and emits no error (as it currently is) it simply reverts to error.php: $sql = SELECT * FROM $table_users WHERE usrName='$username' AND usrPswd=password('$password') AND affil_team RLIKE '$team+'; $result = mysql_query($sql, $connection) or die(mysql_error()); $num = mysql_num_rows($result); //User hasn't been found in DB with current details: if ($num == 0) { header(Location: error.php?err=n_player); exit; } else { while($row = mysql_fetch_array($result)) { etc etc Cheers again: Russ On Wed, 19 Sep 2001 09:26:07 -0500 Rick Emery [EMAIL PROTECTED] wrote: $query = SELECT * FROM $table_users WHERE usrName='$username' AND usrPswd=password('$password') AND affil_team RLIKE '$team+' print $query what were the contents of $query -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 19, 2001 9:19 AM To: Rick Emery Cc: [EMAIL PROTECTED] Subject: Re: RE: [PHP-DB] Query construction If you mean did the pattern I'm trying to match: $team, contain what I though it should: 'footballSat' then yes it did. I also receieve no error message from MySQl The string in the table field I can view/alter in phpMyAdmin and I've tried matching $team in the query to the string as: footballSatfootballSun (etc etc) and also as: footballSat footballSun (etc etc).. Any ideas?? Many thanks. Russ On Wed, 19 Sep 2001 09:12:36 -0500 Rick Emery [EMAIL PROTECTED] wrote: When you printed-out the string variable containing the SELECT statement, what did it look like? -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 19, 2001 9:01 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Query construction Hi there: Further to a previous submission (which can be ignored), I'd like the following query to 'search' a table field of different team names (stored as a single string), but it does't seem to work! SELECT * FROM $table_users WHERE usrName='$username' AND usrPswd=password('$password') AND affil_team RLIKE '$team+'; (I've also tried: RLIKE '$team?' ) This should match the string found in the variable: '$team' with the some of contents (string) found in 'affil_team'. For example my test has been, trying to find 'footballSat', so $team = 'footballSat'. 'footballSat' exists as part of the string in the 'affil_team' field but the above query refuses to find 'footballSat'!! (No error is received though) I'm using MySQL 3.22.32 + php4.0.3pl1 Cheers Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: RE: [PHP-DB] Query construction
Ok ok ok!! Thank you both for the pointers, they did of course yield the problem - as bloody always it's something completely different! As my old-dad always says: Everything is about something else (although this was always meant in a psychiatrist-patient relationship..) Thank you again both, and I apologise for seemingly wasting your time, but I do value people's ideas and opinions, and hopefully others do of mine also. Regards: Russ Michell (APU Webteam) On Wed, 19 Sep 2001 09:41:47 -0500 Rick Emery [EMAIL PROTECTED] wrote: YES!!! Exactly Russ...do what Steve syas... -Original Message- From: Steve Cayford [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 19, 2001 9:32 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Query construction Usually what I do when I'm having this type of problem is put the whole sql statement into a string variable then print the variable out just before running the query so you know exactly what's being sent to mysql. Then I log into mysql from the command line and enter the query manually to see what sort of response or error message I get. -Steve On Wednesday, September 19, 2001, at 09:01 AM, Russ Michell wrote: Hi there: Further to a previous submission (which can be ignored), I'd like the following query to 'search' a table field of different team names (stored as a single string), but it does't seem to work! SELECT * FROM $table_users WHERE usrName='$username' AND usrPswd=password('$password') AND affil_team RLIKE '$team+'; (I've also tried: RLIKE '$team?' ) This should match the string found in the variable: '$team' with the some of contents (string) found in 'affil_team'. For example my test has been, trying to find 'footballSat', so $team = 'footballSat'. 'footballSat' exists as part of the string in the 'affil_team' field but the above query refuses to find 'footballSat'!! (No error is received though) I'm using MySQL 3.22.32 + php4.0.3pl1 Cheers Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: RE: RE: [PHP-DB] Query construction
Learning is NEVER a waste of time... No, of course not, but having been on these lists for sometime, I get the feeling some people (as I would, and do) get pi**ed off if someone doesn't at least try first before asking questions.. p.s. Your father is a psychiatrist??? Now, there, I could use some help... No he isn't he just thinks he is ;-) Many thanks. Russ On Wed, 19 Sep 2001 10:01:07 -0500 Rick Emery [EMAIL PROTECTED] wrote: It wasn't a waste of time. Now, the next time you have a similar problem with a mySQL query, you'll follow this procedure. Learning is NEVER a waste of time... p.s. Your father is a psychiatrist??? Now, there, I could use some help... -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 19, 2001 9:56 AM To: Rick Emery Cc: [EMAIL PROTECTED] Subject: Re: RE: [PHP-DB] Query construction Ok ok ok!! Thank you both for the pointers, they did of course yield the problem - as bloody always it's something completely different! As my old-dad always says: Everything is about something else (although this was always meant in a psychiatrist-patient relationship..) Thank you again both, and I apologise for seemingly wasting your time, but I do value people's ideas and opinions, and hopefully others do of mine also. Regards: Russ Michell (APU Webteam) On Wed, 19 Sep 2001 09:41:47 -0500 Rick Emery [EMAIL PROTECTED] wrote: YES!!! Exactly Russ...do what Steve syas... -Original Message- From: Steve Cayford [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 19, 2001 9:32 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Query construction Usually what I do when I'm having this type of problem is put the whole sql statement into a string variable then print the variable out just before running the query so you know exactly what's being sent to mysql. Then I log into mysql from the command line and enter the query manually to see what sort of response or error message I get. -Steve On Wednesday, September 19, 2001, at 09:01 AM, Russ Michell wrote: Hi there: Further to a previous submission (which can be ignored), I'd like the following query to 'search' a table field of different team names (stored as a single string), but it does't seem to work! SELECT * FROM $table_users WHERE usrName='$username' AND usrPswd=password('$password') AND affil_team RLIKE '$team+'; (I've also tried: RLIKE '$team?' ) This should match the string found in the variable: '$team' with the some of contents (string) found in 'affil_team'. For example my test has been, trying to find 'footballSat', so $team = 'footballSat'. 'footballSat' exists as part of the string in the 'affil_team' field but the above query refuses to find 'footballSat'!! (No error is received though) I'm using MySQL 3.22.32 + php4.0.3pl1 Cheers Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com
Re: SV: [PHP-DB] Straightforward authentication?
Thanks for the password/info, however I have one further (possibly bumb) question, is there a commonly employed method of securing one's database to prevent hacker's peering in and viewing plain-text/hashed passwords? I use MySQL 3.22.32 with php4.0.3 Cheers. Russ On Thu, 13 Sep 2001 19:28:18 +0200 Torgil Zechel [EMAIL PROTECTED] wrote: A common way to identify a client is to use the challange-response algorithm. It works like this: Ps is the password stored on the server Pc is the password entered by the client H is a hash-function (md5 for example) V is a 'random' value Server calculates H(V + Ps) and save this in a session variable. The server then send V to the client which respond with H(V + Pc). Now, the server can compare H(V + Ps) with H(V + Pc). If they are equal, the user must have given the correct password! Otherwise the identification failed. The good thing with this algorithm is that no password need to be sent in plain-text between the client and the server. The random value is used to ensure that the response is not just something that a hacker has sniffed in a previous session. The downside is that the database must be secure, since the passwords are stored in plain-text. A even better way is of course to use SSL. In that case the client just send the password to the server and the server compares H(P) with the stored hash in the database. Don't know if this was what you were looking for... /torgil -Ursprungligt meddelande- Fran: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]For Russ Michell Skickat: den 13 september 2001 17:36 Till: [EMAIL PROTECTED] Amne: [PHP-DB] Straightforward authentication? Hi all: The few php/MySQL apps I've developed that required username/password access, have simply been a means of comparing usernames and hashes of passwords in a DB. My next application needs to be slightly more secure but nothing like the needs of protecting online banking or vulnerable private info. I have read several articles at phpbuilder.com and stuff at php.net, and frankly most of it seems to be overly contrived. I wonder wether some list members would be able to point me in the direction of code and/or tutorials that *explain* in English what they're doing and why. For example why they are storing an MD5() hash of something in a seperate file outside the web-server's doc-root etc etc. Once I have my head round the concepts I'll be posting my findings to a public location which list-members will be among the first to view. I thank y'all for any help you are able to give. Cheers Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Straightforward authentication?
Hi all: The few php/MySQL apps I've developed that required username/password access, have simply been a means of comparing usernames and hashes of passwords in a DB. My next application needs to be slightly more secure but nothing like the needs of protecting online banking or vulnerable private info. I have read several articles at phpbuilder.com and stuff at php.net, and frankly most of it seems to be overly contrived. I wonder wether some list members would be able to point me in the direction of code and/or tutorials that *explain* in English what they're doing and why. For example why they are storing an MD5() hash of something in a seperate file outside the web-server's doc-root etc etc. Once I have my head round the concepts I'll be posting my findings to a public location which list-members will be among the first to view. I thank y'all for any help you are able to give. Cheers Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: RE: [PHP-DB] Random
Try: $result = mysql_db_query ($DBName,select * from Contacts order by rand() LIMIT 0,5 ); As your first example had the '0' and then the '5' after the LIMIT clause, the second didn't have th any '0'. Cheers. Russ On Fri, 31 Aug 2001 20:59:16 +0100 Seb Frost [EMAIL PROTECTED] wrote: I know it's documented as rand() but you might want to try random() just in case... I'm sure I read that somewhere - seb -Original Message- From: John Hurleston [mailto:[EMAIL PROTECTED]] Sent: 31 August 2001 19:18 To: [EMAIL PROTECTED] Subject: [PHP-DB] Random I would like to get the first 5 random entries out of my mysql database, what would be the correct SELECT option? I adjusted this line $result = mysql_db_query ($DBName,select * from Contacts LIMIT 0,5 ); which works correctly. :) $result = mysql_db_query ($DBName,select * from Contacts order by rand() LIMIT 5 ); Doesn't work at all. :( Can anyone through any light on this subject. 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] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/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] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Password Question
Have a registration screen that inserts their names, email etc *and* their choice of username + password: $sql = INSERT INTO table (username,realname,password,email) VALUES ('$username',$realname',password('$password'),'$email'); $result = mysql_query($sql,$connect); //and do a check if the username chosen exists already: $chksql = SELECT username FROM table WHERE username='$username'; $chkresult = mysql_query($chksql,$connect); $check = mysql_num_rows($chkresult); if ($check == 0) echo this username already exists, select another.; } else { echo continue!; } if they have fogotton their password after registering, then have a link that sets a variable, and check or this variable at the top of the page: a href=\$PHP_SELF?id=lostpassword\go here to retrieve lost password/a if '$id' is set then have the user input their password and email address (the one they registered with) and query the database for a username on the basis of the inputted info, and email it using mail() to that email address! Use the same method for a lost username, they can then input their password and email and the system will mail them the lost details! Good luck! Russ On Fri, 31 Aug 2001 10:38:53 -0500 Jeff Oien [EMAIL PROTECTED] wrote: I would like users to be able to request to have their password sent to their email address if they forget it. I would also like it encrypted in the database though. How is this best handled? The security isn't real important. But I let users choose their own password and if they use a password they use for other things I think it would be best for it to be encrypted. Jeff Oien -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Password Question
Sorry it should have read: if ($check != 0) echo this username already exists, select another.; } else { echo continue!; } Cheers. Russ On Fri, 31 Aug 2001 17:43:59 +0100 (GMT Daylight Time) Russ Michell [EMAIL PROTECTED] wrote: Have a registration screen that inserts their names, email etc *and* their choice of username + password: $sql = INSERT INTO table (username,realname,password,email) VALUES ('$username',$realname',password('$password'),'$email'); $result = mysql_query($sql,$connect); //and do a check if the username chosen exists already: $chksql = SELECT username FROM table WHERE username='$username'; $chkresult = mysql_query($chksql,$connect); $check = mysql_num_rows($chkresult); if ($check == 0) echo this username already exists, select another.; } else { echo continue!; } if they have fogotton their password after registering, then have a link that sets a variable, and check or this variable at the top of the page: a href=\$PHP_SELF?id=lostpassword\go here to retrieve lost password/a if '$id' is set then have the user input their password and email address (the one they registered with) and query the database for a username on the basis of the inputted info, and email it using mail() to that email address! Use the same method for a lost username, they can then input their password and email and the system will mail them the lost details! Good luck! Russ On Fri, 31 Aug 2001 10:38:53 -0500 Jeff Oien [EMAIL PROTECTED] wrote: I would like users to be able to request to have their password sent to their email address if they forget it. I would also like it encrypted in the database though. How is this best handled? The security isn't real important. But I let users choose their own password and if they use a password they use for other things I think it would be best for it to be encrypted. Jeff Oien -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam Room 1C 'The Eastings' East Road, Cambridge e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Fatal error
Hi there folks - this isn't *entirley* a DB question so I'm putting on my flack Jacket right now: I keep getting this error and have never seen it before: Fatal error: Cannot redeclare parse_dir() in intranet/bin/includes/functions.php on line 47 It gives me this error for every function I have (written). I know for a fact that this function ('parse_dir') has only been declared once, so why is php lying to me!!? Feel free *not to answer* instead of wasting your own time giving me jip for an off topic query. Cheers Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: RE: [PHP-DB] Fatal error
Try to include your files with the command include_once() ... and not include() ... Well Br me! Cheers.. That did the job... I thank you sir! Cheers Russ On Fri, 24 Aug 2001 13:04:15 +0200 Walter, Marcel [EMAIL PROTECTED] wrote: Try to include your files with the command include_once() ... and not include() ... Maybe this solves your problem... because you ARE trying to declare a function which is already declared ... -Original Message- From: Russ Michell [SMTP:[EMAIL PROTECTED]] Sent: Friday, August 24, 2001 13:48 To: [EMAIL PROTECTED] Subject:[PHP-DB] Fatal error Hi there folks - this isn't *entirley* a DB question so I'm putting on my flack Jacket right now: I keep getting this error and have never seen it before: Fatal error: Cannot redeclare parse_dir() in intranet/bin/includes/functions.php on line 47 It gives me this error for every function I have (written). I know for a fact that this function ('parse_dir') has only been declared once, so why is php lying to me!!? Feel free *not to answer* instead of wasting your own time giving me jip for an off topic query. Cheers Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How to show table???
Hmmm try something like: $sql = EXPLAIN dbame.table_name; This will show something like: +---+-+--+-+-++ | Field | Type| Null | Key | Default | Extra | +---+-+--+-+-++ | id| smallint(3) | | PRI | 0 | auto_increment | | firstName | varchar(30) | | | || | lastName | varchar(30) | | | || | email | varchar(30) | | | || | username | varchar(12) | | | || | password | varchar(12) | | | || +---+-+--+-+-++ 6 rows in set (0.00 sec) I hope this is what you wanted, can't think why though... Russ On Fri, 24 Aug 2001 11:09:06 -0400 kelvin [EMAIL PROTECTED] wrote: Hi there, I just wonder how to list all the table when using PHP script. I know how to call when I in linux system. (show table) or (mysqlshow db_name) But don't know how to do it in PHP Please Help... Many Thanks. kelvin. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Query construction (again)
(Apologies for cross-postings here but I lost a php-db list members personal email address..) I need a query that in English would read something like: Select all records from table: 'items' where each record is displayed for 7days after it's submission. It was suggested I may have to modify the output of now() to match my MySQL DB 'submitDate' field as in the query below: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY) = now(); So I tried the following: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY) = DATE_FORMAT(NOW(),'Y-M-D'); MySQL didn't complain but nor did it print out all postings submitted in the last seven days which is what it is suppposed to be doing! The 'submitDate' field is a MySQL DATE field and I'm using MySQL-3.22.32 if that's any use. Why is the query not doing what it's told!!? Cheers for your help thus far! Russ Depending on how the date is stored (date + time, or just date) On Wed, 22 Aug 2001 21:39:19 +0800 Gremlins Mailing List [EMAIL PROTECTED] wrote: - Original Message - From: Russ Michell [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 22, 2001 10:16 PM Subject: [PHP-DB] Query construction (again) Hey there folks - similar problem - different project! I want to select some records for a period of 7days after their insert [dateFrom] date. Last time I asked you guys for help I was helped toward the following solution: $sql = SELECT * FROM $Tpostings WHERE now()=dateFrom AND now()dateTo; The problem in this new project is that the 'dateTo' field is not included in the DB. It is 7-days after 'dateFrom'. So why does the following query not work: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY); No error is received though... There is no comparison in your WHERE clause. Try something like: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY) = now(); Depending on how the date is stored (date + time, or just date) you may have to modify the output of now() to match. hth -- Jason Wong Gremlins Associates www.gremlins.com.hk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: SV: [PHP-DB] Query construction (again)
Thanks for that - but I just sorted it literally 10 seconds ago! I used: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 8 DAY) CURDATE(); Something happens with using INTERVAL 7 DAY though, in that only 6 days worth of posts are displayed, so 8 will have to suffice! Thanks very much! Russ On Thu, 23 Aug 2001 11:09:32 +0200 Torgil Zechel [EMAIL PROTECTED] wrote: This should work: SELECT * FROM items WHERE TO_DAYS(NOW()) - TO_DAYS(submitDate) = 7; -Ursprungligt meddelande- Fran: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]For Russ Michell Skickat: den 23 augusti 2001 11:46 Till: Gremlins Mailing List Kopia: [EMAIL PROTECTED] Amne: Re: [PHP-DB] Query construction (again) (Apologies for cross-postings here but I lost a php-db list members personal email address..) I need a query that in English would read something like: Select all records from table: 'items' where each record is displayed for 7days after it's submission. It was suggested I may have to modify the output of now() to match my MySQL DB 'submitDate' field as in the query below: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY) = now(); So I tried the following: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY) = DATE_FORMAT(NOW(),'Y-M-D'); MySQL didn't complain but nor did it print out all postings submitted in the last seven days which is what it is suppposed to be doing! The 'submitDate' field is a MySQL DATE field and I'm using MySQL-3.22.32 if that's any use. Why is the query not doing what it's told!!? Cheers for your help thus far! Russ Depending on how the date is stored (date + time, or just date) On Wed, 22 Aug 2001 21:39:19 +0800 Gremlins Mailing List [EMAIL PROTECTED] wrote: - Original Message - From: Russ Michell [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, August 22, 2001 10:16 PM Subject: [PHP-DB] Query construction (again) Hey there folks - similar problem - different project! I want to select some records for a period of 7days after their insert [dateFrom] date. Last time I asked you guys for help I was helped toward the following solution: $sql = SELECT * FROM $Tpostings WHERE now()=dateFrom AND now()dateTo; The problem in this new project is that the 'dateTo' field is not included in the DB. It is 7-days after 'dateFrom'. So why does the following query not work: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY); No error is received though... There is no comparison in your WHERE clause. Try something like: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY) = now(); Depending on how the date is stored (date + time, or just date) you may have to modify the output of now() to match. hth -- Jason Wong Gremlins Associates www.gremlins.com.hk -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Query construction (again)
Hey there folks - similar problem - different project! I want to select some records for a period of 7days after their insert [dateFrom] date. Last time I asked you guys for help I was helped toward the following solution: $sql = SELECT * FROM $Tpostings WHERE now()=dateFrom AND now()dateTo; The problem in this new project is that the 'dateTo' field is not included in the DB. It is 7-days after 'dateFrom'. So why does the following query not work: $sql = SELECT * FROM $tabitem WHERE DATE_ADD(submitDate, INTERVAL 7 DAY); No error is received though... Any pointers are heartily taken on board! Cheers Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Query construction
Hi there people: I have a MySQL table consisting of category names among other things. I would like to be able to construct a query that tells me the number of times a unique category name occurs in the table: //Table 'posts' from command-line mysql explain posts; +--+-+--+-+++ | Field| Type| Null | Key | Default| Extra | +--+-+--+-+++ | id | tinyint(3) | | PRI | 0 | auto_increment | | category | varchar(25) | | ||| | user | varchar(12) | | ||| | dateFrom | date| | | -00-00 || | dateTo | date| | | -00-00 || | title| varchar(25) | | ||| | body | text| | | NULL || +--+-+--+-+++ 7 rows in set (0.00 sec) //Table 'posts' in phpMyAdmin tab id category userdateFromdateTo titlebody 3 some stuffmaurice 2001-09-23 2001-11-05 Maurcie's post this is Maurice's test 4 russ category russmichell 2001-08-17 2001-08-27 Russ is theone this is another test 9 russ category russmichell 2001-08-16 2001-08-19 Begon by Monday! This entry should dissapear 10 russ category russmichell 2001-08-16 2001-09-04 testing This is another test! For example I would like to know how many posts there are in the category 'russ category' (Should tell me there are 3 and only 1 for 'some stuff' ... Can anyone help me toward a nice SQL query that would to this for me!? Cheers all. Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: RE: RE: [PHP-DB] Query construction
Damn!! That'll be it.. I'm running phpMyAdmin 2.1.0 , php.4.0.3pl1 and MySQL 3.22.32 Then again I don't get an error message from your query..??? Perhaps it has to do with the query being embedded, that is *where* it's embedded: $totalsql = SELECT category,COUNT(*) FROM $Tpostings GROUP BY category; $totalresult = mysql_query($totalsql,$connect) or error(Sorry! I was unable to process the required SQL transaction.); while($totalrow = mysql_fetch_array($totalresult)) { $total = $totalrow['category']; } //Results in: 'some stuff' being echoed to the page.. So I tried: $totalsql = SELECT category,COUNT(*) AS total FROM $Tpostings GROUP BY category; //Resulted in '2' being echoed to the page (2 is the number of posts in the 'some stuff' category) but 2 is displayed as being the number of posts in *all* the categories which isn't the case... What do you think? (It's my luchtime too and I'm gonna go get some...) Cheers once agin for trying. Russ On Tue, 21 Aug 2001 12:19:00 +0100 Lunny Damian [EMAIL PROTECTED] wrote: Russ, I recreated your table/data (it's lunchtime and I thought I'd take a look at this) - my query returned the rows as below: -- category count (*) Edit Delete russ category 3 Edit Delete some stuff 1 -- I'm running with phpMyAdmin 2.2.0rc3 on PHP Version 4.0.4pl1 (MySQL is 3.23.36) - perhaps the problem lies with the versions? damian -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: 21 August 2001 12:46 To: Lunny Damian Subject: Re: RE: [PHP-DB] Query construction Damian: Thanks for that but it doesn't do what I wanted though. It actually returns the first item ('some stuff') from the table, where I wanted the total number of occurances of *each category* in the table, thus indicating the number of posts for each category in the 'posts' table. ! Many thanks. Russ On Tue, 21 Aug 2001 11:23:35 +0100 Lunny Damian [EMAIL PROTECTED] wrote: Russ, This should work for you: - select category,count(*) from posts group by category; - All the best, damian -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: 21 August 2001 12:10 To: [EMAIL PROTECTED] Subject: [PHP-DB] Query construction Hi there people: I have a MySQL table consisting of category names among other things. I would like to be able to construct a query that tells me the number of times a unique category name occurs in the table: //Table 'posts' from command-line mysql explain posts; +--+-+--+-+++ | Field| Type| Null | Key | Default| Extra | +--+-+--+-+++ | id | tinyint(3) | | PRI | 0 | auto_increment | | category | varchar(25) | | || | | user | varchar(12) | | || | | dateFrom | date| | | -00-00 | | | dateTo | date| | | -00-00 | | | title| varchar(25) | | || | | body | text| | | NULL | | +--+-+--+-+++ 7 rows in set (0.00 sec) //Table 'posts' in phpMyAdmin tab id category userdateFromdateTo title body 3 some stuffmaurice 2001-09-23 2001-11-05 Maurcie's post this is Maurice's test 4 russ category russmichell 2001-08-17 2001-08-27 Russ is theone this is another test 9 russ category russmichell 2001-08-16 2001-08-19 Begon by Monday! This entry should dissapear 10 russ category russmichell 2001-08-16 2001-09-04 testing This is another test! For example I would like to know how many posts there are in the category 'russ category' (Should tell me there are 3 and only 1 for 'some stuff' ... Can anyone help me toward a nice SQL query that would to this for me!? Cheers all. Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED
Re: RE: RE: RE: [PHP-DB] Query construction
I always love that feeling when you beat a problem that refuses to go away. So do I - but I aint beaten it yet! :-( I'm still getting '2' as being the number of posts in each category when '2' is actually only the number of posts in *one* of the categories...weird-huh? Cheers. Russ On Tue, 21 Aug 2001 12:46:37 +0100 Lunny Damian [EMAIL PROTECTED] wrote: I always love that feeling when you beat a problem that refuses to go away. Enjoy your lunch! damian -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: 21 August 2001 13:23 To: Lunny Damian Cc: [EMAIL PROTECTED] Subject: Re: RE: RE: [PHP-DB] Query construction Damn!! That'll be it.. I'm running phpMyAdmin 2.1.0 , php.4.0.3pl1 and MySQL 3.22.32 Then again I don't get an error message from your query..??? Perhaps it has to do with the query being embedded, that is *where* it's embedded: $totalsql = SELECT category,COUNT(*) FROM $Tpostings GROUP BY category; $totalresult = mysql_query($totalsql,$connect) or error(Sorry! I was unable to process the required SQL transaction.); while($totalrow = mysql_fetch_array($totalresult)) { $total = $totalrow['category']; } //Results in: 'some stuff' being echoed to the page.. So I tried: $totalsql = SELECT category,COUNT(*) AS total FROM $Tpostings GROUP BY category; //Resulted in '2' being echoed to the page (2 is the number of posts in the 'some stuff' category) but 2 is displayed as being the number of posts in *all* the categories which isn't the case... What do you think? (It's my luchtime too and I'm gonna go get some...) Cheers once agin for trying. Russ On Tue, 21 Aug 2001 12:19:00 +0100 Lunny Damian [EMAIL PROTECTED] wrote: Russ, I recreated your table/data (it's lunchtime and I thought I'd take a look at this) - my query returned the rows as below: -- category count (*) Edit Delete russ category 3 Edit Delete some stuff 1 -- I'm running with phpMyAdmin 2.2.0rc3 on PHP Version 4.0.4pl1 (MySQL is 3.23.36) - perhaps the problem lies with the versions? damian -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: 21 August 2001 12:46 To: Lunny Damian Subject: Re: RE: [PHP-DB] Query construction Damian: Thanks for that but it doesn't do what I wanted though. It actually returns the first item ('some stuff') from the table, where I wanted the total number of occurances of *each category* in the table, thus indicating the number of posts for each category in the 'posts' table. ! Many thanks. Russ On Tue, 21 Aug 2001 11:23:35 +0100 Lunny Damian [EMAIL PROTECTED] wrote: Russ, This should work for you: - select category,count(*) from posts group by category; - All the best, damian -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: 21 August 2001 12:10 To: [EMAIL PROTECTED] Subject: [PHP-DB] Query construction Hi there people: I have a MySQL table consisting of category names among other things. I would like to be able to construct a query that tells me the number of times a unique category name occurs in the table: //Table 'posts' from command-line mysql explain posts; +--+-+--+-+++ | Field| Type| Null | Key | Default| Extra | +--+-+--+-+++ | id | tinyint(3) | | PRI | 0 | auto_increment | | category | varchar(25) | | || | | user | varchar(12) | | || | | dateFrom | date| | | -00-00 | | | dateTo | date| | | -00-00 | | | title| varchar(25) | | || | | body | text| | | NULL | | +--+-+--+-+++ 7 rows in set (0.00 sec) //Table 'posts' in phpMyAdmin tab id category userdateFromdateTo title body 3 some stuffmaurice 2001-09-23 2001-11-05 Maurcie's post this is Maurice's test 4 russ category russmichell 2001-08-17 2001-08-27 Russ is theone this is another test 9 russ category russmichell 2001-08-16 2001-08-19 Begon
RE: [PHP-DB] Query construction
Okay I have it now! while ($row = mysql_fetch_array($result)) { $name = $row['name']; $dc = $row['datecreated']; $nameinurl = urlencode($name); //Get total posts for each category $totalsql = SELECT COUNT(category) AS total FROM $Tpostings WHERE category='$name' GROUP BY category; $totalresult = mysql_query($totalsql,$connect) or error(Sorry!); $check2 = mysql_num_rows($totalresult); if ($check2 == 0) { $total = 0; } else { while($totalrow = mysql_fetch_array($totalresult)) { $total = $totalrow['total']; }//end while }//end else }//end while I used the WHERE clause on $name, which gives me the total postings for each category as a *name* as opposed simply to a *unique category* Many thanks for all your efforts, it was those that led me to this solution! Cheers. Russ On Tue, 21 Aug 2001 14:08:30 +0200 Walter, Marcel [EMAIL PROTECTED] wrote: What about this: select count(category), category from posts group by category -Original Message- From: Russ Michell [SMTP:[EMAIL PROTECTED]] Sent: Tuesday, August 21, 2001 14:44 To: Lunny Damian Cc: [EMAIL PROTECTED] Subject:Re: RE: RE: RE: [PHP-DB] Query construction I always love that feeling when you beat a problem that refuses to go away. So do I - but I aint beaten it yet! :-( I'm still getting '2' as being the number of posts in each category when '2' is actually only the number of posts in *one* of the categories...weird-huh? Cheers. Russ On Tue, 21 Aug 2001 12:46:37 +0100 Lunny Damian [EMAIL PROTECTED] wrote: I always love that feeling when you beat a problem that refuses to go away. Enjoy your lunch! damian -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: 21 August 2001 13:23 To: Lunny Damian Cc: [EMAIL PROTECTED] Subject: Re: RE: RE: [PHP-DB] Query construction Damn!! That'll be it.. I'm running phpMyAdmin 2.1.0 , php.4.0.3pl1 and MySQL 3.22.32 Then again I don't get an error message from your query..??? Perhaps it has to do with the query being embedded, that is *where* it's embedded: $totalsql = SELECT category,COUNT(*) FROM $Tpostings GROUP BY category; $totalresult = mysql_query($totalsql,$connect) or error(Sorry! I was unable to process the required SQL transaction.); while($totalrow = mysql_fetch_array($totalresult)) { $total = $totalrow['category']; } //Results in: 'some stuff' being echoed to the page.. So I tried: $totalsql = SELECT category,COUNT(*) AS total FROM $Tpostings GROUP BY category; //Resulted in '2' being echoed to the page (2 is the number of posts in the 'some stuff' category) but 2 is displayed as being the number of posts in *all* the categories which isn't the case... What do you think? (It's my luchtime too and I'm gonna go get some...) Cheers once agin for trying. Russ On Tue, 21 Aug 2001 12:19:00 +0100 Lunny Damian [EMAIL PROTECTED] wrote: Russ, I recreated your table/data (it's lunchtime and I thought I'd take a look at this) - my query returned the rows as below: -- category count (*) Edit Delete russ category 3 Edit Delete some stuff 1 -- I'm running with phpMyAdmin 2.2.0rc3 on PHP Version 4.0.4pl1 (MySQL is 3.23.36) - perhaps the problem lies with the versions? damian -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: 21 August 2001 12:46 To: Lunny Damian Subject: Re: RE: [PHP-DB] Query construction Damian: Thanks for that but it doesn't do what I wanted though. It actually returns the first item ('some stuff') from the table, where I wanted the total number of occurances of *each category* in the table, thus indicating the number of posts for each category in the 'posts' table. ! Many thanks. Russ On Tue, 21 Aug 2001 11:23:35 +0100 Lunny Damian [EMAIL PROTECTED] wrote: Russ, This should work for you: - select category,count(*) from posts group by category; - All the best, damian -Original Message- From: Russ Michell [mailto:[EMAIL PROTECTED]] Sent: 21 August 2001 12:10 To: [EMAIL PROTECTED] Subject: [PHP-DB] Query construction Hi there people: I have a MySQL table consisting of category names among other things. I would
[PHP-DB] Removal of HTML formating
Use n12br() with the output from your DB to your webpage: $content = n12br($content); echo $content; HTH :-) Russ On Thu, 16 Aug 2001 09:02:44 -0500 John Roach [EMAIL PROTECTED] wrote: -- Hello, I have a mysql db with a largetext field defined. When users enter data, it drops all of the blank lines, so paragraghs run together. Is there a way to display the output with out it being formated in html? It works fine if you insert br for each blank line. It of course drops any indents or centering. I would like to maintain any user formating without them entering html tags. Thanks, John -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: RE: [PHP-DB] Averaging Numbers
I have a cron job that runs on a Unix server that runs a PHP file that gets a number from a Web site and inserts it into the database. Jeff Oien Oh nuts! I thought there may be some way for a script to tell itself to re-run over X-period of time or even have some kind of stored procedure for MySQL like Oracle.. Oh well. Cheers anyway! Russ On Wed, 15 Aug 2001 11:50:43 -0500 Jeff Oien [EMAIL PROTECTED] wrote: I'm real sorry to say I don't know the answer to your question unless there's a php function to get an average (or write one yourself) but you say you've managed to get a script/process to run in conjunction with your database every half an hour...how do you do this!? I've been wanting something like this for months. Cheers (and apologies!) Russ I have a cron job that runs on a Unix server that runs a PHP file that gets a number from a Web site and inserts it into the database. Jeff Oien -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Anyone used Pearson Corilations in PHP
I'm not sure what the hell a Pearson Corilation is but it sounds statistical, so using Excel/Access should do the trick. Use MyODBC from mysql.com to connect your local copy of access to your remote MySQL database. You can then export fron Access to Excel and do all sorts of analyses on your MySQL data. HTH :-) Russ On Mon, 13 Aug 2001 18:31:48 + Robert Trembath [EMAIL PROTECTED] wrote: Good Afternoon Everyone, I am a fellow PHP developer that has run into a project where I need to know if anyone has created anything like this. I need to do Pearson Corilations on Data from MySQL to do a top 10 match that compares DNA numerical image data(grayscale(0-255) and creates an image based on that image data for each row of image data. Anyone done this before? Anything similar? Any comment are appreciated. Thanks, Robert - --- Robert Trembath [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] internal queries
Hi crew: I want to delete material from a database if it is older than say one month since its insertion. However I don't want to have to run a cron-job or something, as there must exist a way for a script to execute itself periodically or to have the MySQL database tell *itself* to execute a specific SQL query periodically. I've heard it is possible to 'sink' a query into an Oracle DB itself instead of running something like a cron-job, so I'd like to hear from anyone who may have done this for MySQL or knows of an alternative method I can achieve my goal. Many thnaks to you all in advance. Russ #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]