[PHP-DB] database sends unclear messages
Hi there, I have a LAMP appplication which sends a report via email if a database error occures. This workes pretty fine. The message contains sql statement and error message from the db server. Lately there are lots of errors showing up every few days which look not like sql errors. Sometimes the message only contains error executing mysql statement: And thats it. In most cases it contains the sql statement as well (as it should!), but the error message from the sql server is missing. So this seems to be a problem of the server. I am running a 1 year old mysql version which might contain bugs. My guess is that there is a machine crawling my site which brings the server down. But I cant prove it. If such a message occures it always comes with tens or even hundred messages all sent in a few or even one minute. Has anybody a suggestion what to do, or a hint what could be happening here? Thanx a lot in advance, Merlin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: database sends unclear messages
Looks like there a crawler/search emgine indexing your site .. pete Merlin wrote: Hi there, I have a LAMP appplication which sends a report via email if a database error occures. This workes pretty fine. The message contains sql statement and error message from the db server. Lately there are lots of errors showing up every few days which look not like sql errors. Sometimes the message only contains error executing mysql statement: And thats it. In most cases it contains the sql statement as well (as it should!), but the error message from the sql server is missing. So this seems to be a problem of the server. I am running a 1 year old mysql version which might contain bugs. My guess is that there is a machine crawling my site which brings the server down. But I cant prove it. If such a message occures it always comes with tens or even hundred messages all sent in a few or even one minute. Has anybody a suggestion what to do, or a hint what could be happening here? Thanx a lot in advance, Merlin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] {PHP-DB} password generator
Hello list Is there any PHP script that generate password with digits from [a-zA-Z0-9] to suggest me? Thanx
Re: [PHP-DB] Slashes
Ng Hwee Hwee wrote: just a quick question.. does it mean, i don't have to worry that my user may type any commands in my text field that may hurt my system since magic_quotes_gpc is on? Heh...of course not. :) All magic_quotes is going to do for you is escape quotes within your text. This will help with database queries but not much else. You still need to be validating your data... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] password generator
Hi HTH Peter --- Excellence in internet and open source software --- Sunmaia Birmingham UK www.sunmaia.net tel. 0121-242-1473 International +44-121-242-1473 --- function SM_pass_gen() { $consts = 'bcdgklmnprst'; $vowels = 'aeiou'; $symbols = '!%^_123456789'; for ($x=0; $x 6; $x++) { mt_srand ((double) microtime() * 100); $const[$x] = substr($consts,mt_rand(0,strlen($consts)-1),1); $vow[$x] = substr($vowels,mt_rand(0,strlen($vowels)-1),1); $symb[$x] = substr($symbols,mt_rand(0,strlen($symbols)-1),1); } return $const[0] . $vow[0] .$const[2] . $const[1] . $vow[1] . $const[3] . $vow[3] . $const[4] . $symb[2] . $symb[3]; }//end function -Original Message- From: Nikos Gatsis [mailto:[EMAIL PROTECTED] Sent: 10 December 2003 13:42 To: PHP-mailist Subject: [PHP-DB] password generator Hello list Is there any PHP script that generate password with digits from [a-zA-Z0-9] to suggest me? Thanx -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] {PHP-DB} password generator
Nikos -- ...and then Nikos Gatsis said... % % Hello list Hi! % % Is there any PHP script that generate password with digits from [a-zA-Z0-9] to suggest me? This just came up on the php list recently... The best one that I saw was a one-liner which peels the first N chars from an md5 string, like $password = strtolower(substr(md5(uniqid(time())), 0, 7)); or so (here N = 8 and so we're using chars 0..7). % Thanx HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! pgp0.pgp Description: PGP signature
Re: [PHP-DB] User defined function in a mysql query
1. Is the function allowed by MySQL? 2. Can you execute the function before the query, assign what it returns to a var, then place the var in your query? Miles At 04:43 PM 12/10/2003 +0100, antonio bernabei wrote: Hi, I need to make a join between two tables. And I can use the mysql_query function: this is ok. The problem arises because I need to apply a user defined function to a field of one of the two tables and the rule for the join is WHERE table1.filed1=function(table2.field2). But I receive a lot of errors: it seems like is not allowed to put such a function in the text of the query. Or there is a possibility? Thanks Antonio Bernabei -- 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] password generator
Here's one I've used recently with success http://www.devhood.com/tools/tool_details.aspx?tool_id=784 Thanks, Roger -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] User defined function in a mysql query
From: antonio bernabei [EMAIL PROTECTED] I need to make a join between two tables. And I can use the mysql_query function: this is ok. The problem arises because I need to apply a user defined function to a field of one of the two tables and the rule for the join is WHERE table1.filed1=function(table2.field2). But I receive a lot of errors: it seems like is not allowed to put such a function in the text of the query. Or there is a possibility? You should be able to do this.. you're just doing a comparison. Although it'll negate any indexes you have and make for a very slow join. We are talking about a MySQL function, right... and not a PHP one?? ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Cookies with fopen
Hi all, Attempting to use PHP to navigate a foreign website, to collect data. This is thus only tangentially related to databases, so I apologize if some feel it's too off-topic. Is there any way to do something similar to fopen() except to also have PHP present a cookie to the foreign webserver as credentials during the HTTP GET? Anyone done something similar? -P Peter Westergaard ICQ#: 10294457 [EMAIL PROTECTED] http://www.westergaard.ca http://courtly.livejournal.com ---TECHNOLOGY--- Human history becomes more and more a race between education and catastrophe. - H.G. Wells -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Cookies with fopen
Peter Westergaard wrote: Hi all, Attempting to use PHP to navigate a foreign website, to collect data. This is thus only tangentially related to databases, so I apologize if some feel it's too off-topic. Is there any way to do something similar to fopen() except to also have PHP present a cookie to the foreign webserver as credentials during the HTTP GET? Anyone done something similar? -P Peter Westergaard ICQ#: 10294457 [EMAIL PROTECTED] http://www.westergaard.ca http://courtly.livejournal.com ---TECHNOLOGY--- Human history becomes more and more a race between education and catastrophe. - H.G. Wells There are multiple projects which will do this for you, simulating an HTTP Client. The one I suggest is PEAR::HTTP_Client. You can use it to send authentication information or to login to a page and it will keep track of cookies for you. http://pear.php.net/package/HTTP_Client If all you need is to do one request, it may be easier to use HTTP_Request instead. -- paperCrane Justin Patrin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ordering output
I have a page that I put together that pulls in data for the time in individual fields - hour, minute, am/pm, month, day. I am going to alter the db to add year as well. I want to order this list by multiple criteria - first by year, then by hour, am/pm, minute. It is a page that lists shows that are running on a local cable channel. Is there a way to do what I am asking? I know that I can 'select * from table order by year asc' but don't know how to sub order the items. thanks, DF -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Missing Data in Columns
Only six of ten columns in a php table show up on the web. I've been using a standard format for many months now and the only difference here is that I'm drawing on more (seven) tables. Even more curious, running the select and where statements in mysql produces the full table. Also, clicking on Sort in a blank Vote column rearranges the visible vote columns which suggests sorting based on the invisible column. Worse (which I won't try to solve here), when I delete some select statements the table disappears. The link and select statement are shown below (I won't copy the extensive where statement, but the table didn't appear when that was wrong). Any ideas? Ken http://congress.techpolitics.org/108thfirst.php # query mysql to get data $get_data_query = select fullhouse2.Representative, fullhouse2.Party, medicarerollcall669.State, medicarerollcall669.CD, hr2passage.passage, estatetaxrepeal.passage, headstartvote444.vote, hudappropsvote453.vote, energyrollcall630.vote, medicarerollcall669.vote from fullhouse2, medicarerollcall669, hr2passage, estatetaxrepeal, headstartvote444, hudappropsvote453, energyrollcall630 where -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ordering output
From: redhat [EMAIL PROTECTED] I have a page that I put together that pulls in data for the time in individual fields - hour, minute, am/pm, month, day. I am going to alter the db to add year as well. I want to order this list by multiple criteria - first by year, then by hour, am/pm, minute. It is a page that lists shows that are running on a local cable channel. Is there a way to do what I am asking? I know that I can 'select * from table order by year asc' but don't know how to sub order the items. thanks, Answer you're looking for: SELECT * FROM Table ORDER BY year ASC, month ASC, day ASC Correct answer: Use a DATETIME or TIMESTAMP field for your dates instead of separate columns for each part. When you start looking for things that span certain lengths of time, you'll thank yourself. You can still pull each part out if need be. You'll also only need to sort based upon the single column. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Missing Data in Columns
snip Any ideas? /snip could you post the code you use to output each table row? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Missing Data in Columns
On Wed, 10 Dec 2003 16:21:39 -0600, Matt Matijevich [EMAIL PROTECTED] wrote: snip Any ideas? /snip could you post the code you use to output each table row? *** Here's the code requested along with column headings and sort code: # write out table heading echo table width='75%' border='1' cellspacing='0' cellpadding='0' align='center' bgcolor='#99'\n; echo tr\n; echo tddiv align='center'font size='3'bRepresentative /b/font/div/td\n; echo tddiv align='center'font size='3'bParty a href='108thfirst.php?sort_field=Partysort_order=asc' target='_self'font size='2'Sort/a /b/font/div/td\n; echo tddiv align='center'font size='3'bState a href='108thfirst.php?sort_field=State, CDsort_order=asc' target='_self'font size='2'Sort/a /b/font/div/td\n; echo tddiv align='center'font size='3'bDistrict /b/font/div/td\n; echo tddiv align='center'font size='3'bVote a href='108thfirst.php?sort_field=hr2passage.passagesort_order=asc' target='_self'font size='2'Sort/a /b/font/div/td\n; echo tddiv align='center'font size='3'bVote a href='108thfirst.php?sort_field=estatetaxrepeal.passagesort_order=asc' target='_self'font size='2'Sort/a /b/font/div/td\n; echo tddiv align='center'font size='3'bVote a href='108thfirst.php?sort_field=headstartvote444.votesort_order=asc' target='_self'font size='2'Sort/a /b/font/div/td\n; echo tddiv align='center'font size='3'bVote a href='108thfirst.php?sort_field=hudappropsvote453.votesort_order=asc' target='_self'font size='2'Sort/a /b/font/div/td\n; echo tddiv align='center'font size='3'bVote a href='108thfirst.php?sort_field=energyrollcall630.votesort_order=asc' target='_self'font size='2'Sort/a /b/font/div/td\n; echo tddiv align='center'font size='3'bVote a href='108thfirst.php?sort_field=medicarerollcall669.votesort_order=asc' target='_self'font size='2'Sort/a /b/font/div/td\n; echo /tr\n; # write out each row while ($row = mysql_fetch_assoc ($data_set)) { echo tr\n; foreach (array_keys($row) as $item) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Missing Data in Columns
On Wed, 10 Dec 2003 17:10:46 -0500 Ken Colburn [EMAIL PROTECTED] wrote: Only six of ten columns in a php table show up on the web. I've been using a standard format for many months now and the only difference here is that I'm drawing on more (seven) tables. Even more curious, [snip] Any ideas? just one, your column names are not unique enough... Ken http://congress.techpolitics.org/108thfirst.php # query mysql to get data $get_data_query = select fullhouse2.Representative, fullhouse2.Party, medicarerollcall669.State, medicarerollcall669.CD, hr2passage.passage, estatetaxrepeal.passage, headstartvote444.vote, hudappropsvote453.vote, energyrollcall630.vote, medicarerollcall669.vote from fullhouse2, medicarerollcall669, hr2passage, estatetaxrepeal, headstartvote444, hudappropsvote453, energyrollcall630 where PHP will treat headstartvote444.vote, hudappropsvote453.vote, energyrollcall630.vote, medicarerollcall669.vote as the same column name called vote. You have made the same clasic mistake with passage (and perhaps other columns... Try this instead... select fullhouse2.Representative, fullhouse2.Party, medicarerollcall669.State as medicare_State, medicarerollcall669.CD as medicare_CD, hr2passage.passage as hr_passage, estatetaxrepeal.passage as estrate_passage, headstartvote444.vote as head_vote, hudappropsvote453.vote as hud_vote, energyrollcall630.vote as energy vote, medicarerollcall669.vote as medicare_vote from fullhouse2, medicarerollcall669, hr2passage, estatetaxrepeal, headstartvote444, hudappropsvote453, energyrollcall630 Regards George Patterson -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php