[PHP] Using Amazon Web Services - Publisher Results
I read these 2 articles to get me started with using Amazon Web Services: http://www.devshed.com/c/a/PHP/Usin...-SOAP-part-1/ http://www.devshed.com/c/a/PHP/Usin...-SOAP-part-2/ I have a page with a Table of Contents linking to specific Browse Nodes that would be of interest to our viewers. I'd like to add a link to a results page with books published by Nolo Press. To do this I'm passing the name nolo via the link. Here is the code I have so far. Note, that it works perfectly when I only want to see a list from a Browse Node. CODE:: //get publisher information $publisher = $_GET['publisher']; if ($publisher == nolo) { $publisher = Nolo Press; } // if keyword is set, get those results if (isset($keyword)) { $catalogParams = array( 'keyword' = htmlentities($keyword), 'page' = $page, 'mode' = 'books', 'tag' = 'tag', 'sort' = '+pmrank', 'type' = 'lite', 'devtag'= 'tag' ); // invoke the method $result = $proxy-KeywordSearchRequest($catalogParams); $catalogItems = $result['Details']; $catalogTotal = $result['TotalResults']; } else { // get items from the catalog // sort order is default $catalogParams = array( 'browse_node' = $node, 'page'= $page, 'mode'= 'books', 'tag' = 'tag', 'type'= 'heavy', 'devtag' = 'tag' ); $catalogResult = $proxy-BrowseNodeSearchRequest($catalogParams); $catalogTotal = $catalogResult['TotalResults']; $catalogItems = $catalogResult['Details']; } if (isset($publisher)) { //THE FOLLOWING LINE IS LINE 115 foreach ($catalogItems as $i) { if($i['Manufacturer'] == $publisher) { $catalogParams = array( 'browse_node' = $node, 'page'= $page, 'mode'= 'books', 'tag' = 'tag', 'type'= 'heavy', 'devtag' = 'tag' ); $catalogResult = $proxy-BrowseNodeSearchRequest($catalogParams); $catalogTotal = $catalogResult['TotalResults']; $catalogItems = $catalogResult['Details']; } } } // format and display the results ? !-- inner catalog table -- table border=0 cellspacing=5 cellpadding=0 ? // parse the $items[] array and extract the necessary information // (image, price, title, author, item URL) //THE FOLLOWING LINE IS LINE 209 foreach ($catalogItems as $i) { ? tr td align=center valign=top rowspan=3 a href=book.php?asin=? echo $i['Asin']; ? img border=0 src=? echo $i['ImageUrlSmall']; ?/a/td tdba href=book.php?asin=? echo $i['Asin']; ? ? echo $i['ProductName']; ?/a/b / ? echo implode(, , $i['Authors']); ?/td /tr tr td align=left valign=topfont size=-1 !--List Price: ? echo $i['ListPrice']; ? / Amazon.com-- Price: ? echo $i['OurPrice']; ? / Used Price: ? echo $i['UsedPrice'] ? /font/td /tr tr td colspan=2nbsp;/td /tr ? } ? /table -- END CODE I get this error only if $publisher is set (these lines are marked above): Warning: Invalid argument supplied for foreach() in /home/www/palawport/amazon/sample7.php on line 115 Warning: Invalid argument supplied for foreach() in /home/www/palawport/amazon/sample7.php on line 209 I did a little test and tried to see if catalogItems had any data. The following code ONLY returned the Publisher ... nothing else. print_r($catalogItems); print p; print_r($publisher); print p; print_r($keyword); exit; Suggestions are welcome :) Thanks Nicole -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Generating Advanced Subheadings
Can we take this one step further and make it so that if you're searching and you want to only see histories with the words parking in the title or only the histories between 1500 1550 it only puts the year headings for the years that actually have a history that meets this criteria? Thanks Nicole Nicole [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] That's exactly it! I don't know why I didn't think about that. For anyone else reading this, I added $field = mysql_fetch_array($dbArray); above the line that reads $yeartitle = $years[year]; And now it works! Richard Davey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello Nicole, Thursday, February 19, 2004, 6:28:13 PM, you wrote: N And so on, always putting the right years and the right number of histories N below the year, but always listing the first history and nothing else. My N loop works if I don't have the while loop in there with the subheadings ... In looking quickly at the code, I can't see a chance for the $field value to ever be updated. You call it once (in the first while statement) and populate the field array with the SQL results, you then move into the 2nd while loop which handles the years. But once in that loop you don't fill the $field array with any new data, so it's using the same data over and over again for every year. I believe, although I've not looked at it for very long, it's simply that the while loops are nested in such a way that the field values never get a chance to re-populate themselves. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html Nicole [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have data that looks like this: (20, '1915', '192', '', '', '312', '525', '404', '', 'title') (21, '1915', '338', '', '', '736', '0', '929', '', 'title') (22, '1917', '193', '', '', '447', '0', '1275', '', 'title') (23, '1919', '129', '', '', '208', '636', '0', '', 'title') (24, '1919', '274', '', '', '581', '321', '1634', '', 'title') The second value is the year, I have have multiple files for the same year. What I want to do is output the values under Year sub headings. So it prints like this: - b1915/b p(20, '1915', '192', '', '', '312', '525', '404', '', 'title')br (21, '1915', '338', '', '', '736', '0', '929', '', 'title') b1917/b p(22, '1917', '193', '', '', '447', '0', '1275', '', 'title') b1919/b p(23, '1919', '129', '', '', '208', '636', '0', '', 'title')br (24, '1919', '274', '', '', '581', '321', '1634', '', 'title') - I have a function that displays each history in a loop. Here's the function: - function display_history($dbArray,$yearArray) { while($field = mysql_fetch_array($dbArray)) { $yeartitle=; while($years = mysql_fetch_array($yearArray)) { if ( $years[year] != $yeartitle) { print pb . $years[year] . /b; } print pa href=\ . $field[filename] . \ . $field[year]; //print the Resolution or Act Number if (!$field[res_no] !$field[j_res_no]) { print - Act # . $field[act_no]; } elseif (!$field[act_no] !$field[j_res_no]) { print - Res # . $field[res_no]; } else { print - J.Res.# . $field[j_res_no]; } //print the Public Law Number if ($field[pl_no]!=0) { print , P.L. . $field[pl_no]; } //print the Senate Bill Number if ($field[sb_no]!=0) { print , SB . $field[sb_no]; } //print the House Bill Number if ($field[hb_no]!=0) { print , HB . $field[hb_no]; } //close the link print /a - ; //print the Misc Text or Part Number if there is one if ($field[misc_part_no] != ) { print $field[misc_part_no] . - ; } //print the title and number of pages print $field[title] . - [ . $field[pgs] . pgs - ; //print the file size if ($field[mb] != 0) { print $field[mb] . mb]; } else { print $field[kb] . kb] ; } $yeartitle = $years[year]; } } } - The values being passed in are: - //get all of the histories from the table sorted by year //then resolution number then by act number $result = mysql_query(SELECT * FROM table ORDER BY year, res_no, j_res_no, act_no, misc_part_no,$connect); //get the years from the same table $yrArray = mysql_query(SELECT * FROM table ORDER BY year,$connect); //display histories display_history($result,$yrArray); - I'm sure it's an easy solution ... but here's what a resulting page looks like: - 1501 1501 - Act # 90, P.L. 647, SB 582 - this test - [5 pgs - 55kb] 1913 1501 - Act # 90
[PHP] Re: Generating Sub Headings
Can we take this one step further and make it so that if you're searching and you want to only see histories with the words parking in the title or only the histories between 1500 1550 it only puts the year headings for the years that actually have a history that meets this criteria? Nicole [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] That's exactly it! I don't know why I didn't think about that. For anyone else reading this, I added $field = mysql_fetch_array($dbArray); above the line that reads $yeartitle = $years[year]; And now it works! Richard Davey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello Nicole, Thursday, February 19, 2004, 6:28:13 PM, you wrote: N And so on, always putting the right years and the right number of histories N below the year, but always listing the first history and nothing else. My N loop works if I don't have the while loop in there with the subheadings ... In looking quickly at the code, I can't see a chance for the $field value to ever be updated. You call it once (in the first while statement) and populate the field array with the SQL results, you then move into the 2nd while loop which handles the years. But once in that loop you don't fill the $field array with any new data, so it's using the same data over and over again for every year. I believe, although I've not looked at it for very long, it's simply that the while loops are nested in such a way that the field values never get a chance to re-populate themselves. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html Nicole [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have data that looks like this: (20, '1915', '192', '', '', '312', '525', '404', '', 'title') (21, '1915', '338', '', '', '736', '0', '929', '', 'title') (22, '1917', '193', '', '', '447', '0', '1275', '', 'title') (23, '1919', '129', '', '', '208', '636', '0', '', 'title') (24, '1919', '274', '', '', '581', '321', '1634', '', 'title') The second value is the year, I have have multiple files for the same year. What I want to do is output the values under Year sub headings. So it prints like this: - b1915/b p(20, '1915', '192', '', '', '312', '525', '404', '', 'title')br (21, '1915', '338', '', '', '736', '0', '929', '', 'title') b1917/b p(22, '1917', '193', '', '', '447', '0', '1275', '', 'title') b1919/b p(23, '1919', '129', '', '', '208', '636', '0', '', 'title')br (24, '1919', '274', '', '', '581', '321', '1634', '', 'title') - I have a function that displays each history in a loop. Here's the function: - function display_history($dbArray,$yearArray) { while($field = mysql_fetch_array($dbArray)) { $yeartitle=; while($years = mysql_fetch_array($yearArray)) { if ( $years[year] != $yeartitle) { print pb . $years[year] . /b; } print pa href=\ . $field[filename] . \ . $field[year]; //print the Resolution or Act Number if (!$field[res_no] !$field[j_res_no]) { print - Act # . $field[act_no]; } elseif (!$field[act_no] !$field[j_res_no]) { print - Res # . $field[res_no]; } else { print - J.Res.# . $field[j_res_no]; } //print the Public Law Number if ($field[pl_no]!=0) { print , P.L. . $field[pl_no]; } //print the Senate Bill Number if ($field[sb_no]!=0) { print , SB . $field[sb_no]; } //print the House Bill Number if ($field[hb_no]!=0) { print , HB . $field[hb_no]; } //close the link print /a - ; //print the Misc Text or Part Number if there is one if ($field[misc_part_no] != ) { print $field[misc_part_no] . - ; } //print the title and number of pages print $field[title] . - [ . $field[pgs] . pgs - ; //print the file size if ($field[mb] != 0) { print $field[mb] . mb]; } else { print $field[kb] . kb] ; } $yeartitle = $years[year]; } } } - The values being passed in are: - //get all of the histories from the table sorted by year //then resolution number then by act number $result = mysql_query(SELECT * FROM table ORDER BY year, res_no, j_res_no, act_no, misc_part_no,$connect); //get the years from the same table $yrArray = mysql_query(SELECT * FROM table ORDER BY year,$connect); //display histories display_history($result,$yrArray); - I'm sure it's an easy solution ... but here's what a resulting page looks like: - 1501 1501 - Act # 90, P.L. 647, SB 582 - this test - [5 pgs - 55kb] 1913 1501 - Act # 90, P.L. 647, SB 582
[PHP] RE: Generating Sub Headings
Can we take this one step further and make it so that if you're searching and you want to only see histories with the words parking in the title or only the histories between 1500 1550 it only puts the year headings for the years that actually have a history that meets this criteria? Thanks Nicole Nicole [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] That's exactly it! I don't know why I didn't think about that. For anyone else reading this, I added $field = mysql_fetch_array($dbArray); above the line that reads $yeartitle = $years[year]; And now it works! Richard Davey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello Nicole, Thursday, February 19, 2004, 6:28:13 PM, you wrote: N And so on, always putting the right years and the right number of histories N below the year, but always listing the first history and nothing else. My N loop works if I don't have the while loop in there with the subheadings ... In looking quickly at the code, I can't see a chance for the $field value to ever be updated. You call it once (in the first while statement) and populate the field array with the SQL results, you then move into the 2nd while loop which handles the years. But once in that loop you don't fill the $field array with any new data, so it's using the same data over and over again for every year. I believe, although I've not looked at it for very long, it's simply that the while loops are nested in such a way that the field values never get a chance to re-populate themselves. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html Nicole [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have data that looks like this: (20, '1915', '192', '', '', '312', '525', '404', '', 'title') (21, '1915', '338', '', '', '736', '0', '929', '', 'title') (22, '1917', '193', '', '', '447', '0', '1275', '', 'title') (23, '1919', '129', '', '', '208', '636', '0', '', 'title') (24, '1919', '274', '', '', '581', '321', '1634', '', 'title') The second value is the year, I have have multiple files for the same year. What I want to do is output the values under Year sub headings. So it prints like this: - b1915/b p(20, '1915', '192', '', '', '312', '525', '404', '', 'title')br (21, '1915', '338', '', '', '736', '0', '929', '', 'title') b1917/b p(22, '1917', '193', '', '', '447', '0', '1275', '', 'title') b1919/b p(23, '1919', '129', '', '', '208', '636', '0', '', 'title')br (24, '1919', '274', '', '', '581', '321', '1634', '', 'title') - I have a function that displays each history in a loop. Here's the function: - function display_history($dbArray,$yearArray) { while($field = mysql_fetch_array($dbArray)) { $yeartitle=; while($years = mysql_fetch_array($yearArray)) { if ( $years[year] != $yeartitle) { print pb . $years[year] . /b; } print pa href=\ . $field[filename] . \ . $field[year]; //print the Resolution or Act Number if (!$field[res_no] !$field[j_res_no]) { print - Act # . $field[act_no]; } elseif (!$field[act_no] !$field[j_res_no]) { print - Res # . $field[res_no]; } else { print - J.Res.# . $field[j_res_no]; } //print the Public Law Number if ($field[pl_no]!=0) { print , P.L. . $field[pl_no]; } //print the Senate Bill Number if ($field[sb_no]!=0) { print , SB . $field[sb_no]; } //print the House Bill Number if ($field[hb_no]!=0) { print , HB . $field[hb_no]; } //close the link print /a - ; //print the Misc Text or Part Number if there is one if ($field[misc_part_no] != ) { print $field[misc_part_no] . - ; } //print the title and number of pages print $field[title] . - [ . $field[pgs] . pgs - ; //print the file size if ($field[mb] != 0) { print $field[mb] . mb]; } else { print $field[kb] . kb] ; } $yeartitle = $years[year]; } } } - The values being passed in are: - //get all of the histories from the table sorted by year //then resolution number then by act number $result = mysql_query(SELECT * FROM table ORDER BY year, res_no, j_res_no, act_no, misc_part_no,$connect); //get the years from the same table $yrArray = mysql_query(SELECT * FROM table ORDER BY year,$connect); //display histories display_history($result,$yrArray); - I'm sure it's an easy solution ... but here's what a resulting page looks like: - 1501 1501 - Act # 90, P.L. 647, SB 582 - this test - [5 pgs - 55kb] 1913 1501 - Act # 90
Re: [PHP] PHP Alternative to IFRAME?
That is almost exactly what I ended up doing. Thanks a bunch! Justin Patrin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Nicole wrote: I'm not having much luck explaining what I want here ... a drawback of emailing. I know how to include files, I just wanted to include it in such a way that my body text still wrapped around it. I think I need to tackle this using HTML. Robert Sossomon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Just place ?php include box_info.php; ? In your web page in the location where the little box is. Word wrap typically only happens with images though, so you may have to turn your text into an image, in which case you could just use a javascript commands to change the image as needed. If you are including the text into a table it would be something like: table border=0 trtdsome text that keeps running and running/td/tr trtd?php include box_info.php; ? /td/tr HTH, Robert I think this is what you're looking for: echo 'div style=float: right;'; include('someFile.php'); echo '/div div'; //more content here that goes ot the left and bottom of the above div echo '/div'; -- -- paperCrane Justin Patrin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Alternative to IFRAME?
Is there a PHP alternative to an IFRAME? Here's what I mean. Is there a way to include a file in my php document that will be positioned where I want it, like an IFRAME? I want to have it aligned right with text wrapping around it and I know IFRAME is not compatible with Netscape browsers. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can anyone tell me why this code doesn't insert anything?
I don't know if this will help, but I always do: $result = mysql_query($query,$dbconnection); Nicole Brian Dunning [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] This inserts nothing into the database, but returns no error that I can see. How come? What's wrong with it? $dbname = my_database; $dbconnection = mysql_connect(mysql05.powweb.com,my_user,my_pass); mysql_select_db($dbname, $dbconnection); $query = INSERT INTO invoices ('ip','total','creation','first_name','email','session','last_name') VALUES ('0.0.0.0','0.00',NOW(),'Bob','[EMAIL PROTECTED]','12345','Smith'); $result = mysql_query($query); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Alternative to IFRAME?
Your right I was mixing up what I wanted. What I wanted to know I guess was if I use an include and include a file can I format where that file will display. So what I have is a little box with some info in it. I want it to display to the right of the body text and have the body text wrap around it. Nicole Richard Davey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello Nicole, Monday, February 23, 2004, 5:21:11 PM, you wrote: N Is there a PHP alternative to an IFRAME? Here's what I mean. No, of course not. PHP is a server-side language. IFRAME's (and anything related to page construction/display) is client-side. N Is there a way to include a file in my php document that will be positioned N where I want it, like an IFRAME? I want to have it aligned right with text N wrapping around it and I know IFRAME is not compatible with Netscape N browsers. You're mixing technologies. If Netscape won't display something, there is nothing PHP can do about it. You need to think of another layout technique that it can display. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Alternative to IFRAME?
I'm not having much luck explaining what I want here ... a drawback of emailing. I know how to include files, I just wanted to include it in such a way that my body text still wrapped around it. I think I need to tackle this using HTML. Robert Sossomon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Just place ?php include box_info.php; ? In your web page in the location where the little box is. Word wrap typically only happens with images though, so you may have to turn your text into an image, in which case you could just use a javascript commands to change the image as needed. If you are including the text into a table it would be something like: table border=0 trtdsome text that keeps running and running/td/tr trtd?php include box_info.php; ? /td/tr HTH, Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Generating Sub Headings
I have data that looks like this: (20, '1915', '192', '', '', '312', '525', '404', '', 'title') (21, '1915', '338', '', '', '736', '0', '929', '', 'title') (22, '1917', '193', '', '', '447', '0', '1275', '', 'title') (23, '1919', '129', '', '', '208', '636', '0', '', 'title') (24, '1919', '274', '', '', '581', '321', '1634', '', 'title') The second value is the year, I have have multiple files for the same year. What I want to do is output the values under Year sub headings. So it prints like this: - b1915/b p(20, '1915', '192', '', '', '312', '525', '404', '', 'title')br (21, '1915', '338', '', '', '736', '0', '929', '', 'title') b1917/b p(22, '1917', '193', '', '', '447', '0', '1275', '', 'title') b1919/b p(23, '1919', '129', '', '', '208', '636', '0', '', 'title')br (24, '1919', '274', '', '', '581', '321', '1634', '', 'title') - I have a function that displays each history in a loop. Here's the function: - function display_history($dbArray,$yearArray) { while($field = mysql_fetch_array($dbArray)) { $yeartitle=; while($years = mysql_fetch_array($yearArray)) { if ( $years[year] != $yeartitle) { print pb . $years[year] . /b; } print pa href=\ . $field[filename] . \ . $field[year]; //print the Resolution or Act Number if (!$field[res_no] !$field[j_res_no]) { print - Act # . $field[act_no]; } elseif (!$field[act_no] !$field[j_res_no]) { print - Res # . $field[res_no]; } else { print - J.Res.# . $field[j_res_no]; } //print the Public Law Number if ($field[pl_no]!=0) { print , P.L. . $field[pl_no]; } //print the Senate Bill Number if ($field[sb_no]!=0) { print , SB . $field[sb_no]; } //print the House Bill Number if ($field[hb_no]!=0) { print , HB . $field[hb_no]; } //close the link print /a - ; //print the Misc Text or Part Number if there is one if ($field[misc_part_no] != ) { print $field[misc_part_no] . - ; } //print the title and number of pages print $field[title] . - [ . $field[pgs] . pgs - ; //print the file size if ($field[mb] != 0) { print $field[mb] . mb]; } else { print $field[kb] . kb] ; } $yeartitle = $years[year]; } } } - The values being passed in are: - //get all of the histories from the table sorted by year //then resolution number then by act number $result = mysql_query(SELECT * FROM table ORDER BY year, res_no, j_res_no, act_no, misc_part_no,$connect); //get the years from the same table $yrArray = mysql_query(SELECT * FROM table ORDER BY year,$connect); //display histories display_history($result,$yrArray); - I'm sure it's an easy solution ... but here's what a resulting page looks like: - 1501 1501 - Act # 90, P.L. 647, SB 582 - this test - [5 pgs - 55kb] 1913 1501 - Act # 90, P.L. 647, SB 582 - this test - [5 pgs - 55kb] 1501 - Act # 90, P.L. 647, SB 582 - this test - [5 pgs - 55kb] 1501 - Act # 90, P.L. 647, SB 582 - this test - [5 pgs - 55kb] 1501 - Act # 90, P.L. 647, SB 582 - this test - [5 pgs - 55kb] 1925 1501 - Act # 90, P.L. 647, SB 582 - this test - [5 pgs - 55kb] 1501 - Act # 90, P.L. 647, SB 582 - this test - [5 pgs - 55kb] - And so on, always putting the right years and the right number of histories below the year, but always listing the first history and nothing else. My loop works if I don't have the while loop in there with the subheadings ... Thank in advance for any help you can offer! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Generating Sub Headings
Sorry about all of the code. I do do what you say to do there. My year sub headings are changing correctly, it's the data that's printed under each heading that isn't correct. Nicole Chris W. Parker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Nicole mailto:[EMAIL PROTECTED] on Thursday, February 19, 2004 10:28 AM said: I have data that looks like this: [snip] The second value is the year, I have have multiple files for the same year. What I want to do is output the values under Year sub headings. ok woh. that's way too much code for me to wade through so i'll just give you some ideas. hopefully you're not already implementing it. 1. you want to put your data in order (either ascending or descending) but the year. and according to your short data snippet it looks like you're already doing this. good job. 2. you need to somehow compare the date that's currently ready to be printed with what was ALREADY printed. the way you do this is by having a temporary variable that stores the previous year data. when the next loop cycle occurs you can say is this current date the same as the previous cycles date? and then act appropriately. for (...) { $current_date = $new_date; // if the current date does not equal the // old date you're obviously moving into // a new year and you should therefore // start a new group. if ($current_date != $old_date) { echo br/br/1915br/\n; } else { echo nbsp;nbsp;(20, '1915', ...)br/\n; } $old_date = $current_date; } but of course instead of hard coding what gets printed you'd use your variables to print the correct values. hth, chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Generating Sub Headings
That's exactly it! I don't know why I didn't think about that. For anyone else reading this, I added $field = mysql_fetch_array($dbArray); above the line that reads $yeartitle = $years[year]; And now it works! Richard Davey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello Nicole, Thursday, February 19, 2004, 6:28:13 PM, you wrote: N And so on, always putting the right years and the right number of histories N below the year, but always listing the first history and nothing else. My N loop works if I don't have the while loop in there with the subheadings ... In looking quickly at the code, I can't see a chance for the $field value to ever be updated. You call it once (in the first while statement) and populate the field array with the SQL results, you then move into the 2nd while loop which handles the years. But once in that loop you don't fill the $field array with any new data, so it's using the same data over and over again for every year. I believe, although I've not looked at it for very long, it's simply that the while loops are nested in such a way that the field values never get a chance to re-populate themselves. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Generating Sub Headings
Can we take this one step further and make it so that if you're searching and you want to only see histories with the works parking in the title it only puts the year headings for the years that actually have a history that meets this criteria? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ereg_replace
Can anyone tell me why this does not work: $str1=ereg_replace(index.php?src=,index/,$url); is there another way to do this? Thanks, Nicole -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ereg_replace -- Thanks!
Many thanks!! Richard Davey wrote: Hello Nicole, Tuesday, February 10, 2004, 5:55:01 PM, you wrote: NL Can anyone tell me why this does not work: NL $str1=ereg_replace(index.php?src=,index/,$url); Because it's an invalid regular expression. NL is there another way to do this? Yes, str_replace() for something this simple: $str1 = str_replace(index.php?src=, index/, $url); -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php as cgi script
Ivone -- You are using a PERL invocation for php. PHP scripts begin with ?php the # sign is a comment in PERL - not in PHP. To run php as cgi you need to install the php cgi version (as opposed to the apache modular installation.) That will allow you to run cgi scripts on the command line. http://www.php.net/manual/en/install.commandline.php Best regards, Nicole Ivone Uribe wrote: Hello all! I have this problem: I need to run a php (http://xx.yy.zz/cgi-bin/pruebacgi.php) that contains that line #!/usr/local/bin/php -q I get it an error from my apache log: malformed header from script. Bad header= php [options] -r cod e: /www/cgi-bin/pruebacgi.php I hope someone can help me! I don't know what can I do. In fact if I run any php that have this line #!/usr/local/bin/php I get an error like that Premature end of script headers: /www/cgi-bin/pruebacgi.php I have installed the php4.3.3 and apache 1.3.28. I configured the php with this line ./configure --with-mysql --with-apache=../apache_1.3.28 --enable-track-vars Do I need to configure some else in my apache or php configuration file. Whan can I do to solve this problem? Thanks in advance KISSES Ivone __ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Too many connections fix?
Hello, I run Apache with PHP and MySQL on a RedHat 7.2 box with 1GB Ram @ 2GHZ (p4). I last increased my max connections to 500. That seemed to fix things for a while. Now I am getting the problems (database freezing up because too many connections) again. The site I run is pretty high traffic. I wondered if anyone encountered a solution to handle this sort of problem. TIA! -- Nicole aeontrek.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Too many connections fix?
Originally, I used pconnect for a while. Then I learned that with high traffic site, that's not the best idea. So I changed to 'connect.' But I still get the problems. Nicole aeontrek.com Brad Pauly [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Nicole wrote: I last increased my max connections to 500. That seemed to fix things for a while. Now I am getting the problems (database freezing up because too many connections) again. The site I run is pretty high traffic. I wondered if anyone encountered a solution to handle this sort of problem. Are you using mysql_connect or mysql_pconnect? - Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Too many connections fix?
I don't see a MaxConnections in Apache conf, or maybe I overlooked it. I do see: MaxClients 150 MaxKeepAliveRequests 100 It seems the latter var there relates more. Any ideas which or if both should be bumped up? I did read -- in various places -- that it was better to use connect, including PHP. Because php and mysql are fast to open a regular connection, using connect may ultimately be better. That's just what I read. I found this bit: http://us2.php.net/manual/en/features.persistent-connections.php And decided it would be ok to use either, and preferrably connect due to some other bits I read regarding persistent connections. So really, I am confused on this matter. I believe it boils down to configuration issues betweeen MySQL's conf and Apache's conf files. Maybe even in php.ini. I can't seem to find a correct article on how to fix these things. What I read in forums I become leary of, thinking the person may be incorrect. So I like to stick to documentation. But I can't seem to find enough. -- Nicole Chris Shiflett [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] --- Nicole [EMAIL PROTECTED] wrote: I run Apache with PHP and MySQL [snip] I last increased my max connections to 500. That seemed to fix things for a while. Now I am getting the problems (database freezing up because too many connections) again. The site I run is pretty high traffic. This has nothing to do with traffic (other than the fact that heavy traffic can reveal configuration problems more easily). Are you using persistent connections (mysql_pconnect)? If so, you need to make sure you have MySQL maximum connections (max_connections in my.cnf) set to a number that is higher than Apache's MaxClients directive (in httpd.conf). If you have MaxClients at 512, for example, and MySQL only allows a maximum of 500 connections, you're likely to run into the too many connections problems once your traffic pushes the number of Apache clients past 500. Hope that helps. Chris = HTTP Developer's Handbook http://shiflett.org/books/http-developers-handbook My Blog http://shiflett.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Too many connections fix?
I am working on a way to do this. The site is for tracking. The hits get stored in the database. The database must be hit in order to retrieve the URL that is needed to redirect to. I am contemplating storing this URL in a file instead of db. Perhaps this will reduce the load. Thanks. I run several sites on this server, and the majority of the auto-emails I get about the database being down is for this one site. But I do get an email for my other site(s) every now and then. So I think that I need to work on the configuration of the conf files for MySQL and Apache to fix this problem as much as possible. Thanks, -- Nicole aeontrek.com Cristian Lavaque [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Nicole wrote: Hello, I run Apache with PHP and MySQL on a RedHat 7.2 box with 1GB Ram @ 2GHZ (p4). I last increased my max connections to 500. That seemed to fix things for a while. Now I am getting the problems (database freezing up because too many connections) again. The site I run is pretty high traffic. I wondered if anyone encountered a solution to handle this sort of problem. TIA! Wouldn't it be good to cache the dynamic pages to files to take some of the load off the db? Cristian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Too many connections fix?
Pardon me, I misread a pervious comment. I meant MaxClients. Sigh. too much sleep. -- Nicole aeontrek.com Nicole [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I don't see a MaxConnections in Apache conf, or maybe I overlooked it. I do see: MaxClients 150 MaxKeepAliveRequests 100 It seems the latter var there relates more. Any ideas which or if both should be bumped up? I did read -- in various places -- that it was better to use connect, including PHP. Because php and mysql are fast to open a regular connection, using connect may ultimately be better. That's just what I read. I found this bit: http://us2.php.net/manual/en/features.persistent-connections.php And decided it would be ok to use either, and preferrably connect due to some other bits I read regarding persistent connections. So really, I am confused on this matter. I believe it boils down to configuration issues betweeen MySQL's conf and Apache's conf files. Maybe even in php.ini. I can't seem to find a correct article on how to fix these things. What I read in forums I become leary of, thinking the person may be incorrect. So I like to stick to documentation. But I can't seem to find enough. -- Nicole Chris Shiflett [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] --- Nicole [EMAIL PROTECTED] wrote: I run Apache with PHP and MySQL [snip] I last increased my max connections to 500. That seemed to fix things for a while. Now I am getting the problems (database freezing up because too many connections) again. The site I run is pretty high traffic. This has nothing to do with traffic (other than the fact that heavy traffic can reveal configuration problems more easily). Are you using persistent connections (mysql_pconnect)? If so, you need to make sure you have MySQL maximum connections (max_connections in my.cnf) set to a number that is higher than Apache's MaxClients directive (in httpd.conf). If you have MaxClients at 512, for example, and MySQL only allows a maximum of 500 connections, you're likely to run into the too many connections problems once your traffic pushes the number of Apache clients past 500. Hope that helps. Chris = HTTP Developer's Handbook http://shiflett.org/books/http-developers-handbook My Blog http://shiflett.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Too many connections fix?
Thanks. My problem is that I am getting a too many connections error, and wondered if there was a proper configuration to handle this. I have the problem, regardless of using connect or pconnect. I originally used pconnect for the last year. But my site is growing and growing and am looking for anything to help fix the problem. So I switched to connect, with no luck in fixing the too many connections problem. Originallly, increasing max_connections in my.cnf solved the problem for a while. But the growth has caught up again. I thought I read that increasing this max_connections number too high could cause problems as well. So I am hesitant to raise it anymore. -- Nicole aeontrek.com Jason Sheets [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Generally persistent connections will almost always be faster there are some considerations though, first resource usage if you are busy site and don't have enough memory to support one connection to the db for each apache process you will run into problems, second if you site is not busy enough and you rarely connect to the database you wont see much of a performance increase. Sometimes you need to take precautions to safely restart apache otherwise you can have connections to the db left open. Obviously persistent connections are faster because you don't have the overhead of building and tearing down the connection on each request, I've seen a 5 to 15% increase in page generation time on some applications by using persistent connections depending on the db server and the protocol. Becoming Digital wrote: I'm with Chris on this one. I did some serious load testing on my servers and always faired better with persistent connections. I don't have the logs handy right now, but I can probably dig them up if anyone really wants to see the numbers. Edward Dudlik Becoming Digital www.becomingdigital.com - Original Message - From: Chris Shiflett [EMAIL PROTECTED] To: Curt Zirzow [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, 01 October, 2003 22:53 Subject: Re: [PHP] Too many connections fix? --- Curt Zirzow [EMAIL PROTECTED] wrote: This may be debatable, which is better? php searching through a pool of 1000 connections for a free one or the overhead of opening a new resource to the database each request. I suppose people can debate just about anything, but I doubt anyone can come up with any statistics to defend the stance that persistent connections are slower under heavy traffic. Of course, I'd love to see people's results, but my experience has shown quite the opposite. Also, the difference becomes exaggerated with heavier traffic. So, a better argument would be to ask whether the overhead of managing persistent connections is worth it when you only have one database connection per hour. In that case, it may actually be worse, but that's not the situation that was described. :-) Hope that helps. Chris = RAMP - Rapid AMP Training from the Experts http://www.nyphp.org/content/training/ramp.php HTTP Developer's Handbook http://shiflett.org/books/http-developers-handbook My Blog http://shiflett.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Session not working
Which method are you using to set and access your session variables? -- Nicole aeontrek.com Sheni R. Meledath [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi: We are facing some problems in using sessions in our applications. Recently we have moved our web site to a new Apache server (1.3). We have installed PHP on this server. But sessions are not working on this server. The values in the session variables are not carried forward to the consequent pages. PHP Module entry in httpd.conf file: LoadModule php4_module modules/mod_php4-4.3.2.so The same scripts web site are working fine on a similar Apache server and same version of PHP. Could you please help me to figure out this problem. Are we missing anything in the installation or settings in the php.ini file. PHP.INI [Session] session.save_handler = files session.save_path = /tmp session.use_cookies = 1 session.name = PHPSESSID session.auto_start = 0 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.serialize_handler = php session.gc_probability = 1 session.gc_maxlifetime = 1440 session.referer_check = session.entropy_length = 0 session.entropy_file = session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 1 url_rewriter.tags = a=href,area=href,frame=src,input=src,form=fakeentry Sheni R Meledath [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Yikes! Strange Occurrence of ! in mail
Has anyone experienced exclamation points ! in their emails from no where? This is a really strange thing I have been noticing lately in emails I send to myself via PHP. When I send an email from 2 different machines using 2 different smtp servers, I still get the exclamations in the email. Any ideas what on earth is causing that? Example: the!ir is an ex!clamation in my e!mail that I did not pu!t there. Why?? Thanks! -- Nicole -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: passthru loses php posted variables
Hi, Did you try using the system() command instead and skip using exec and passthru? -- Nicole Exasperated [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Anyone come across something like this before? I have made a little test script as follows: ? header (Content-Type: application/pdf); $command_line = /usr/bin/pdflabelseries . escapeshellcmd($_POST['labelstart']) . . escapeshellcmd($_POST['labelend']); exec (echo \$command_line\ /opt/specs/labels.txt); //passthru($command_line); ? The form takes input from a posted form with two variables, labelstart and labelend. In the above test, if I put in 'start' and 'end' as the posted variable data, the output from /opt/specs/labels.txt (writable by the http server) is: /usr/bin/pdflabelseries start end All is well and good. Now is where it heads South. I uncomment the passthru command above. The output from the script in /opt/specs/labels.txt from the same posted form with the same data entered is now: /usr/bin/pdflabelseries pdflabelseries is a C program that I have confirmed works perfectly on the command line (i.e. generates the requisite pdf file to stdout). Even if the C program fails (which it does not appear to do from the output in the httpd logs as it outputs its command line to stderr), surely php should not lose its own internal variables, especially, for a command that is executed BEFORE the passthru command. I am truly baffled. Any help appreciated. Regards Mark I am running vanilla Mandrake 9.1 with the following PHP rpms: libphp_common430-430-11mdk php-pear-4.3.0-3mdk apache2-mod_php-2.0.44_4.3.1-2mdk php-xml-4.3.0-2mdk php-dba_bundle-4.3.0-4mdk php-pgsql-4.3.0-4mdk php-xmlrpc-4.3.0-2mdk php-manual-en-4.3.0-2mdk php430-devel-430-11mdk php-gd-4.3.0-2mdk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Too Advanced? Re: Cookies Hidden Image
Thanks. The cookie sets fine using the redirect. The problem is accessing the cookie when the script is called via the image tag. If the script is called directly, the cookie is accessible. http://trackerurl/blahblah/script.php--- called directly can see the Cookie img src=http://trackerurl/blahblah/script.php height=1 width=1--- does not see the Cookie Not sure what else to do other than try something different. Using Cookie seems to be the only way to store the value on the client side for later retrieval. Thanks, Nicole Diego Fulgueira [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Nothing is too advanced for this newgroup and there is not other better. I did not read your problem very carefully, but I think you are trying to set a cookie on a page that does a redirect, that is just impossible unless you do the redirect with a meta tag on the client. Anyway, if that suggestion doesn't do it for you, I once used the following function to set cookies and it worked for me: function MySetCookie ($CkyName, $CkyVal, $exp, $pth, $Domain) { $exp = strftime(%A, %d-%b-%Y %H:%M:%S, $exp); $cookiestr = sprintf (%s=%s; domain=%s; path=%s; expires=%s, $CkyName, $CkyVal, $Domain, $pth, $exp); $mycky = (isset($mycky) ? $mycky\n : ).Set-Cookie: $cookiestr; header($mycky); } Cheers, Diego - Original Message - From: Nicole [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 03, 2003 3:57 PM Subject: [PHP] Too Advanced? Re: Cookies Hidden Image Is this question too advanced for this newsgroup? Is there a better newsgroup to post this one too? Thanks, -- Nicole Nicole [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I am working on a script that uses cookie to store some info on the client side. The user will click a link that contains info about where the link was placed. The script will then store that info so that when the user returns later and makes a purchase, I can see where they came from. The problem I am having is this: The link is a redirect url that first goes to one domain where the cookie is created by. Then they are taken to the site where products are sold. Then, after they make a purchase, they are taken to a thank you page that has a hidden tracker to track that sale. img src=http://trackerurl.com/?var=1var=2blahbla height=0 width= The image loads the script from a different domain (where the cookie was initialy created by). The problem now is that the script gets a blank cookie when using the hidden image to load the script. So does anyone know why this is happening? I have setCookie('CookieName', $value, $expires); Then I try to retrieve that cookie again later with $_COOKIE['CookieName'] ... but the value stored is not there when the script is called from the hidden image. HOWEVER, the value is there when the script is called directly. Any ideas? Thanks!! Nicole -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Too Advanced? Re: Cookies Hidden Image
Is this question too advanced for this newsgroup? Is there a better newsgroup to post this one too? Thanks, -- Nicole Nicole [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I am working on a script that uses cookie to store some info on the client side. The user will click a link that contains info about where the link was placed. The script will then store that info so that when the user returns later and makes a purchase, I can see where they came from. The problem I am having is this: The link is a redirect url that first goes to one domain where the cookie is created by. Then they are taken to the site where products are sold. Then, after they make a purchase, they are taken to a thank you page that has a hidden tracker to track that sale. img src=http://trackerurl.com/?var=1var=2blahbla height=0 width= The image loads the script from a different domain (where the cookie was initialy created by). The problem now is that the script gets a blank cookie when using the hidden image to load the script. So does anyone know why this is happening? I have setCookie('CookieName', $value, $expires); Then I try to retrieve that cookie again later with $_COOKIE['CookieName'] ... but the value stored is not there when the script is called from the hidden image. HOWEVER, the value is there when the script is called directly. Any ideas? Thanks!! Nicole -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Too Advanced? Re: Cookies Hidden Image
OK. Thanks. I have the hidden image code: img src=http://thetrackingurl/?param1=val1param2=val2etc... height=0 width=0 border=0 This hidden image code is placed on the ThankYou page that people see after they have bought something. What it does is load a script on the tracking site to let the owner know a sale was made. The tracking site is different from the site that the product is sold on. A cookie was placed on the client's (buyer) side to store where that client originated from. So when the hidden image is called, the tracking script is called and tries to access this cookie to retrieve where the buyer came from. But the script just gets a blank cookie when accessed this way(via hidden image); However, if the script was accessed directly, or the thankyou page resided on the same domain as the tracking script (which created the cookie to begin with), the cookie has the value that it was set with. Does this make sense? Thanks for any input. PHP's docs on sessions didn't seem to have anything relating to this situation; so I'm stuck. Nicole Chris Shiflett [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] --- Nicole [EMAIL PROTECTED] wrote: Is this question too advanced for this newsgroup? Somehow I doubt it. But, that's a nice tactic for grabbing some attention. :-) Show us some sample code of a very small test case. I can't really follow your description of what you are trying to do. Chris = Become a better Web developer with the HTTP Developer's Handbook http://httphandbook.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Too Advanced? Re: Cookies Hidden Image
The cookie is being accessed by the same domain it was generated by. The problem is, the script is being pulled up via a hidden image (which resides on a different domain). So that may still be the problem anyway. Thanks. -- Ernest E Vogelsinger [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] At 23:55 03.09.2003, Nicole said: [snip] But the script just gets a blank cookie when accessed this way(via hidden image); However, if the script was accessed directly, or the thankyou page resided on the same domain as the tracking script (which created the cookie to begin with), the cookie has the value that it was set with. [snip] That's it - cookies will only be sent to the same domain (hostname) they have been generated at. You cannot pass cookies between domains (hostnames). -- O Ernest E. Vogelsinger (\)ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cookies Hidden Image
Hi, I am working on a script that uses cookie to store some info on the client side. The user will click a link that contains info about where the link was placed. The script will then store that info so that when the user returns later and makes a purchase, I can see where they came from. The problem I am having is this: The link is a redirect url that first goes to one domain where the cookie is created by. Then they are taken to the site where products are sold. Then, after they make a purchase, they are taken to a thank you page that has a hidden tracker to track that sale. img src=http://trackerurl.com/?var=1var=2blahbla height=0 width= The image loads the script from a different domain (where the cookie was initialy created by). The problem now is that the script gets a blank cookie when using the hidden image to load the script. So does anyone know why this is happening? I have setCookie('CookieName', $value, $expires); Then I try to retrieve that cookie again later with $_COOKIE['CookieName'] ... but the value stored is not there when the script is called from the hidden image. HOWEVER, the value is there when the script is called directly. Any ideas? Thanks!! Nicole -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] testing - please ignore
test my subscription -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Returning a variable from a function problem
Hello, Where is $duplicate originally being set? Are you using global variables? is $duplicate being POST'd or GET'd or what? If it is only gaining it's value from the duplicate_name() function, is that function returning those possible values (1,2) based on whatever the result of the action taken in that fuction is? Maybe try this: if (empty($form[name])) { $error[name] = *; $message[name] = Required field!; } else { $duplicate = duplicate_name($form[name]); if ( $duplicate == 0 ) { $error[name] = *; $message[name] = Screen name already used!; } else if ($duplicate == 1) { $error[name] = *; $message[name] = Database error - Please try again in a few moments!; } elseif ($duplicate == 2) { $error[name] = *; $message[name] = Server error - Please tryagain in a few moments!; } else { // not a dup, do whatever } } Nicole @rogers.com wrote in message news:[EMAIL PROTECTED] I have a form where the user inputs information - the code below is the error checking for one of the fields. The first IF statement just checks that the filed is not empty and works fine. Then I check a function I made to see if the user is already in a mysql database and the function returns 0, 1, or 2 depending on the various conditions. The first elseif works as I would expect - but it seems that the next two elseif's are just being ignored. Could someone possibly explain what I have wrong here. Thanks if (empty($form[name])) { $error[name] = *; $message[name] = Required field!; } elseif($duplicate = duplicate_name($form[name]) == 0) { $error[name] = *; $message[name] = Screen name already used!; . } elseif ($duplicate == 1) { $error[name] = *; $message[name] = Database error - Please try again in a few moments!; } elseif ($duplicate == 2) { $error[name] = *; $message[name] = Server error - Please try again in a few moments!; } function duplicate_name($name) { if (!($connect = @mysql_connect($serverhost,$serveruser,$serverpass))) { These are all defined above but not included here. $server_error = 2; } if ([EMAIL PROTECTED]($databasename)) { $server_error = 1; } if($server_error) { $duplicate = $server_error; } else { $query = SELECT name FROM $tablename WHERE name = '$name'; if(!$query) { $duplicate = 1} else { $result = mysql_query($query); $line = mysql_fetch_array($result); if($line['name'] == $name) { $duplicate = 0; } mysql_free_result($result); mysql_close($connect); } } echo $duplicate; * This shows that the variable $duplicate is assigned 0, 1, or 2 depending on the what conditions were met. return($duplicate); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: $_SERVER[REMOTE_ADDR]
Try these: function getIP() { if (getenv('HTTP_CLIENT_IP')) $ip=getenv('HTTP_CLIENT_IP'); else if ( getenv('REMOTE_ADDR') ) $ip=getenv('REMOTE_ADDR'); else $ip = 'unknown'; return trim($ip); } function getISP($addr,$byIP=true) { /* Can pass in an ip, like 64.xxx.xxx.xx or a domain, like www.aeontrek.com; true if it is an IP; else false */ if ( $byIP ) return trim(gethostbyaddr( trim($addr) )); else return trim(gethostbyname ( trim($addr) )); } -- Nicole John [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Makes me think.. what exactly the $_SERVER[REMOTE_ADDR] is doing Cause it does not really show the actual IP address instead IP address within its range e.g. 66.87.25.122 output 66.87.25.2 any idea how to get their actual IP add and if possible the name of their computer Also, is it also possible to get or trace the IP add? many thanks, John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Strange Issues
--- My System: A dedicated server with: Red Hat 7.2 P4 2 GHZ 1GB Ram -Apache -PHP 4.2 -MySQL Ensim panel --- I am having strange occurrences of people telling me they cannot sign into their accounts. It happens every now and then, and it happens to anyone -- but not everyone. I am not sure what this could be a result of. I start to think it's a server issue. I see no common pattern, they are using either windows 98 or XP with IE 5 and 6. I personally run XP and have the same setup as some of these that report trouble signing in. If they try to sign in later, they get in fine. I run several sites on this server, and this particular site is high traffic. My other site has just about 30 members and I have had not a single complain in 6 months. So I'm baffled. The hour of the day varies,as well. There's no regular or common pattern that I can see. Could it be from an issue with Apache, MySQl and PHP? Maybe it is even an issue with PHP sessions. I wondered if anyone else has heard of or experienced something similar. If so, have you figured out what is causing this? Have you found a workaround? Thanks! -- Nicole -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: daylight savings time ?
I have some code to do that; But as far as fixing it up for someone else's code, dont' know. If you have full access to the server the code runs on, you could add some code or change the server's time to match yours. if you can edit the code, just add date('D M d, Y g i a', time()+60*60); //60*60 = 3600 seconds = 1hr ... but that's just a quick fix. Nicole -- Nicole URLTrak.com ElixirSafelist.com aeontrek.com Heather P [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello. I use a forum which has the time as the coding (D M d, Y g:i a) how do I add an hour for daylight savings time ? I live in the uk and the time on the forum is wrong. how do I change it ? Thanks _ Overloaded with spam? With MSN 8, you can filter it out http://join.msn.com/?page=features/junkmailpgmarket=en-gbXAPID=32DI=1059 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Send Output to Printer?
anyone know of a good tutorial for using PHP to send output to a printer? have a report that returns paged display (e.g., 20 rows max per page) ... too many rows to show on one page. need a print button that will send all the output directly to the printer and print all pages not talking about javascript print() either. I need something via PHP. any tips? thanks -- Nicole aeontrek.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] a conundrum -- php/mysql script
Dear all, Have written a wrapper to Christian Novak's excellent biffwriter class which writes out excel files based on query to a mysql database. A for loop, $zz=1; $zz =61; $zz++: generates the id needed for the WHERE condition: $sql = SELECT $arv, DATE_FORMAT(date_rec,'%m-%d-%Y') as nice_date from arviContacts WHERE fid=$zz; which is then passed to a function writeARV($sql); which then loops through the database for all data pertaining to that id, ($numoffields=mysql_num_fields($result);) opens a file, writes out the column heads and then loops through the data and parses into an excel file. 1. The counter is being incremented correctly, 2. all the files are created correctly, 3. all the column heads are generated correctly 4. and the data for 4 specific files do NOT get written in. 5. The file id numbers are 47,49,51 and 57 (all odd numbers but only 3 are in sequence) 6. These files are generated with NO DATA while all the other files are generated with the data. 7. If I explicity change the counter to one of these numbers and run the script singly, then these specific files get generated correctly WITH all the data. I do not even know how to begin to debug this which is why I posted to both lists -- any pointers? clues? TIA, Nicole -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Trouble with Exec
I am trying to load a php script to run in the background using the exec() function. My code looks like this: ? // $aqid = $db-insert_id();//grab id of newly inserted row $cmd = php -q sendit.php $aqid /dev/null 21 ; exec($cmd);// call sendit.php in background // ... ? Basically, the point of me doing this is so the script runs in the background so the member does not have to wait for the script to run after they have clicked a send button. But they are still waiting because they can't go to other pages until the script has completed running. My next alternative will be to run a cron job to do this instead. But I can't get cron working just yet. Any suggestions to get the script to run in background without stalling the script that calls it? -- Nicole -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP.ini help on Linux
I am having trouble doing things with PHP such as use the exec, system, etc. functions. I can't seem to find the correct php.ini to turn safe_mode off. The one file I did find has safe_mode turned off. When I view phpinfo() it shows the global column with safe_mode off, but for the local column, it is on. Is there a local php.ini file for each site? Where would it be? I need to call a script to run in the background and I want to be able to use exec() to call it. Is there an alternative way to do this without bothering with the safe_mode value? i'd prefer to leave safe_mode on; but at the same rate, I am the only one with access to the server as it is my dedicated server. I am not familiar enough with Linux just yet to know how to give permissions to my sites to use things such as cron which I desperately need to figure out. I know how to add a crontab for a user, etc. But when the cron file runs, I just get a permission denied. I have tried it for both root and the site user. The only thing that does work is me getting an email stating permission denied. So I know my crontab file is correct. As far as permissions, I'm in a cloud. I have no idea what to do to make it work and maintain a secure system. Anyone know where some great (free) docs that will show me how to fish around in Linux? I don't need to be hand fed. Just some direction. Thanks! -- Nicole -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP.ini help on Linux
Thank you. Yes, I did chmod my scripts. chmod 754 and tried 755 too. Don't see why it should be x on the world, though. I would think if the script is being called by its owner, then x on the owner and group should be enough, no? I'm even using !#/usr/bin/php ... but then it doesn't even seem to be using it. I'll go through the man pages again, too. The find and locate commands will be useful. I will try those. Thanks! Although since you mentioned the local configuration via apache's .htaccess, maybe that is what I need. I still can't figure out how to turn safe mode off for the local column. Thanks, Nicole -- Michael Mauch [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Nicole [EMAIL PROTECTED] wrote: I am having trouble doing things with PHP such as use the exec, system, etc. functions. I can't seem to find the correct php.ini to turn safe_mode off. The one file I did find has safe_mode turned off. When I view phpinfo() it shows the global column with safe_mode off, but for the local column, it is on. Is there a local php.ini file for each site? No. But the values found in the global php.ini can be changed in Apache's httpd.conf and in .htaccess files. See http://www.php.net/manual/en/configuration.changes.php. You can have a .htaccess file in every directory to pass additional options to Apache (and mod_php). A .htaccess is used for the directory where it resides and for all subdirectories. Try locate .htaccess or find / -name .htaccess. I need to call a script to run in the background and I want to be able to use exec() to call it. Is there an alternative way to do this without bothering with the safe_mode value? i'd prefer to leave safe_mode on; but at the same rate, I am the only one with access to the server as it is my dedicated server. If you're the only person on that machine, there's no point in using safe mode. I am not familiar enough with Linux just yet to know how to give permissions to my sites to use things such as cron which I desperately need to figure out. I know how to add a crontab for a user, etc. But when the cron file runs, I just get a permission denied. I have tried it for both root and the site user. The only thing that does work is me getting an email stating permission denied. So I know my crontab file is correct. As far as permissions, I'm in a cloud. I have no idea what to do to make it work and maintain a secure system. Perhaps you just forgot to make your program/script executable (chmod +x your_script). Anyone know where some great (free) docs that will show me how to fish around in Linux? I don't need to be hand fed. Just some direction. Thanks! Almost all programs have man pages, so you can use man chmod to find out about chmod. And then there's the Linux Documentation Project http://www.tldp.org/, which has lots of howtos. Regards... Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP.ini help on Linux
correction: #!/usr/bin/php -- Nicole URLTrak.com ElixirSafelist.com aeontrek.com Nicole [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Thank you. Yes, I did chmod my scripts. chmod 754 and tried 755 too. Don't see why it should be x on the world, though. I would think if the script is being called by its owner, then x on the owner and group should be enough, no? I'm even using !#/usr/bin/php ... but then it doesn't even seem to be using it. I'll go through the man pages again, too. The find and locate commands will be useful. I will try those. Thanks! Although since you mentioned the local configuration via apache's .htaccess, maybe that is what I need. I still can't figure out how to turn safe mode off for the local column. Thanks, Nicole -- Michael Mauch [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Nicole [EMAIL PROTECTED] wrote: I am having trouble doing things with PHP such as use the exec, system, etc. functions. I can't seem to find the correct php.ini to turn safe_mode off. The one file I did find has safe_mode turned off. When I view phpinfo() it shows the global column with safe_mode off, but for the local column, it is on. Is there a local php.ini file for each site? No. But the values found in the global php.ini can be changed in Apache's httpd.conf and in .htaccess files. See http://www.php.net/manual/en/configuration.changes.php. You can have a .htaccess file in every directory to pass additional options to Apache (and mod_php). A .htaccess is used for the directory where it resides and for all subdirectories. Try locate .htaccess or find / -name .htaccess. I need to call a script to run in the background and I want to be able to use exec() to call it. Is there an alternative way to do this without bothering with the safe_mode value? i'd prefer to leave safe_mode on; but at the same rate, I am the only one with access to the server as it is my dedicated server. If you're the only person on that machine, there's no point in using safe mode. I am not familiar enough with Linux just yet to know how to give permissions to my sites to use things such as cron which I desperately need to figure out. I know how to add a crontab for a user, etc. But when the cron file runs, I just get a permission denied. I have tried it for both root and the site user. The only thing that does work is me getting an email stating permission denied. So I know my crontab file is correct. As far as permissions, I'm in a cloud. I have no idea what to do to make it work and maintain a secure system. Perhaps you just forgot to make your program/script executable (chmod +x your_script). Anyone know where some great (free) docs that will show me how to fish around in Linux? I don't need to be hand fed. Just some direction. Thanks! Almost all programs have man pages, so you can use man chmod to find out about chmod. And then there's the Linux Documentation Project http://www.tldp.org/, which has lots of howtos. Regards... Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CRON?
Does anyone have a PHP script to enter cron jobs? I have a limited control panel (ensim) that doesn't have anyway to do cron, and I don't know how to do it at the command line yet. Anyone have a good tutorial or a PHP script to do this? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CRON?
Thanks. But I would think if you can run cron jobs as certain users, you could create cron jobs for those users only. I mean, if you can do it with CPanel or these other Control Panels, then why not? It wouldn't have to run as root? I have a good bit to learn about linux. I am new to getting around in ssh. I am learning from the command line now. It doesn't seem too bad yet. Not sure. Thanks! Leif K-Brooks [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... The problem is, PHP would have to be running as root. This creates a huge security risk... if I was you, I'd just learn to edit cron jobs at the command line. Nicole wrote: Does anyone have a PHP script to enter cron jobs? I have a limited control panel (ensim) that doesn't have anyway to do cron, and I don't know how to do it at the command line yet. Anyone have a good tutorial or a PHP script to do this? Thanks! -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: CRON?
LOL. Thanks; that's ok. ;) That wouldn't cut it, I'm afraid. ;) Alex [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Well, if you really wanted to, you could create a php script, and then have a meta refresh tag set to refresh the page whenever you want, and then just leave the page open in your browser :p Nicole [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Does anyone have a PHP script to enter cron jobs? I have a limited control panel (ensim) that doesn't have anyway to do cron, and I don't know how to do it at the command line yet. Anyone have a good tutorial or a PHP script to do this? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passing complete URL through php scripts using javascript popup
Gretings: I am trying to set up a referal script; I want to pass a URL query string to another php script. I am able to pass the complete query string with all the variables I want through to the javascript function call but then the string gets cut in the php script: in the shopping cart: a href=javascript: openWin('email.php?ref=?php echo $pageURL; ?')this page/a where 'ref' is set correctly and $pageURL is returned as 'http://mydomain.com/shop.php?val1=1val2=2val3=3' (this shows up on my status bar and I can 'echo' it on the shopping cart page - so Iknow it is getting captured correctly -- also - I removed the javascript and saw it get passet in the url as a 'get' correctly.) but in the email script in the popup window I try to display 'ref' and what I get is: 'http://mydomain.com/shop.php?val1=1' -- everything past the first '' gets cut off (ie, I lose the 'val2=2val3=3' portion of the query string ) Any ideas? Sorry if this is obvious - pulling an 'all nighter'... TIA, Nicole -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] can't pass complete URL (part of the query string) from one scriptto another --??
Gretings: I want to pass a URL query string to another php script. I am able to pass the complete query string with all the variables I want through to the javascript function call but then the string gets cut in the php script: in the shopping cart: a href=javascript: openWin('email.php?ref=?php echo $pageURL; ?')this page/a where 'ref' is set correctly and $pageURL is returned as 'http://mydomain.com/shop.php?val1=1val2=2val3=3' (this shows up on my status bar and I can 'echo' it on the shopping cart page - so Iknow it is getting captured correctly -- also - I removed the javascript and saw it get passet in the url as a 'get' correctly.) but in the email script I try to display 'ref' and what I get is: 'http://mydomain.com/shop.php?val1=1' -- everything past the first '' gets cut off (ie, I lose the 'val2=2val3=3' portion of the query string ) Any ideas? Sorry if this is obvious - pulling an 'all nighter'... TIA, Nicole -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP] can't pass complete URL (part of the query string) from
Dear Martin Erwin, Tried the urlencode - same thing happened - the variables after the first one were chopped off - so a href=email.php?ref=?=urlencode($pageURL);?this page/a where the url is http://mydomain.com/displayem.php3?cat=5olimit=0zid=1lid=1 results in http://mydomain.com/displayem.php3?cat=5 being passed and the 'olimit=0zid=1lid=1' gets cut off - still?? Thanks, Nicole hi nicole, do you have an example what your query contains ? maybe urlencode($pageURL) or quoting will help greetings martin -Urspr\xfcngliche Nachricht- Von: Nicole Lallande [mailto:[EMAIL PROTECTED]] Gesendet: Dienstag, 26. November 2002 15:40 An: [EMAIL PROTECTED] Betreff: [PHP] can't pass complete URL (part of the query string) from one script to another --?? Gretings: I want to pass a URL query string to another php script. I am able to pass the complete query string with all the variables I want through to -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP] can't pass complete URL (part of the query string) from
Chris -- thanks! didn't think to look - the 'ref' variable is being passed correctly in the form action=: form action=http://embitec.com/fishcart/email.php?ref=http://embitec.com/fishcart/displayem.php3?cat=5olimit=0zid=1lid=1; method=post but below in the text area where I display it: ?php echo $ref; ? or even ?php echo $_GET['ref']; ? it comes out as: http://embitec.com/fishcart/displayem.php3?cat=5 ??? Best, Nicole --- Nicole Lallande [EMAIL PROTECTED] wrote: a href=email.php?ref=?=urlencode($pageURL);?this page/a where the url is http://mydomain.com/displayem.php3?cat=5olimit=0zid=1lid=1 results in http://mydomain.com/displayem.php3?cat=5 being passed and the 'olimit=0zid=1lid=1' gets cut off Can you visit this page, view source, and show us what the a href tag looks like after it is processed by PHP? Chris -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP] can't pass complete URL (part of the query string)
Chris - Tried that -- I have urlencode in the script that sends the url and I have url encode right below the form action -- ref is getting cut off at the first ampersand - regardless: where: form action=http://embitec.com/fishcart/email.php?ref=http://embitec.com/fishcart/displayem.php3?cat=5olimit=0zid=1lid=1; method=post and: input type=hidden name=ref value? php echo rawurlencode($ref); ? or even input type=hidden name=ref value? php echo rawurlencode($_GET['ref']); ? yields: input type=hidden name=ref value=http%3A%2F%2Fembitec.com%2Ffishcart%2Fdisplayem.php3%3Fcat%3D4 still cutting off everything after the ampersand..?? Best, Nicole form action=http://embitec.com/fishcart/email.php?ref=http://embitec.com/fishcart/displayem.php3?cat=5olimit=0zid=1lid=1; method=post There is your problem right there. Here are the variables you are passing: ref=http://embitec.com/fishcart/displayem.php3?cat=5 olimit=0 zid=1 lid=1 The URL you want to set ref to needs to be URL encoded. You can use rawurlencode() to achieve this. You will know you have it right when your HTML form tag looks like this: form action=http://embitec.com/fishcart/email.php?ref=http%3A%2F%2Fembitec.com%2Ffishcart%2Fdisplayem.php3%3Fcat%3D5%26olimit%3D0%26zid%3D1%26lid%3D1; method=post Hope that helps. Chris -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP] can't pass complete URL (part of the query string) - aha-- that worked - except for the javascript
Chris -- I took out the javascript call to window.open and included the fix the way you described it and it worked! Thanks for clearing it up for me. Now I just have to figure own why the javascript is chopping the variable. Thanks for all your help! Best regards, Nicole I'm thinking you haven't, but I might be wrong. The HTML you showed us previously was of a form tag. The action attribute of that form tag is where your problem lies. form action=http://embitec.com/fishcart/email.php?ref=http://embitec.com/fishcart/displayem.php3?cat=5olimit=0zid=1lid=1; method=post See? It is still wrong. Remember, you will know when you fix your problem when this form tag looks like this: form action=http://embitec.com/fishcart/email.php?ref=http%3A%2F%2Fembitec.com%2Ffishcart%2Fdisplayem.php3%3Fcat%3D5%26olimit%3D0%26zid%3D Yours still does not look like this. input type=hidden name=ref value? php echo rawurlencode($ref); ? See, I am guessing that you are doing this on the next page. Meaning, you are URL encoding this: http://embitec.com/fishcart/displayem.php3?cat=5 This is what $_GET[ref] is going to be if you do not correct your form tag like I am describing. input type=hidden name=ref value=http%3A%2F%2Fembitec.com%2Ffishcart%2Fdisplayem.php3%3Fcat%3D4 Exactly as I would expect. Focus on fixing your form tag. This other URL encoding you are doing on this hidden form variable is actually unnecessary, because the browser is going to do it again for you. Hope that clears it up for you. Chris -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using '/' instead of '?' in url querystring
Kenni, I asked a similar question several months ago and got a lot of terrific info from the list. First some links: See this related link: Q How can I pass variables to a script in the url like /script/var1/var2? http://www.faqts.com/knowledge_base/view.phtml/aid/124 Includes tutorials for doing it in PHP, mod_rewrite and/or mod_mime. and Search Engine Friendly URLs with PHP and Apache http://www.evolt.org/article/Search_Engine_Friendly_URLs_with_PHP_and_Ap ache/17/15049/index.html Search Engine Friendly URLs (Part II) http://www.evolt.org/article/Search_Engine_Friendly_URLs_Part_II/17/1717 1/index.html and finally: http://httpd.apache.org/docs/mod/mod_rewrite.html The approach I used was the Apache web server's mod_rewrite (rewrite engine) and then apply the appropriate rules to an htaccess file. If you have the rewrite engine installed (and loaded in your httpd.conf file), then try the following in your .htaccess file: RewriteEngine On RewriteRule ^foo\.php(./*) $ http://your domainname.com/foo.php?id=$1 [R] The '.' is a concactenator in the rules so it must be escaped unless used as such. If you wanted to add an ending forward slash for foo.php/12/ then perhaps use (./*/) HTH, Nicole PS - many thanks once again to all who helped answer this question for me! Kenni Graversen wrote: Hi, I wonder if any of you have experience, sending variables in the url without using the ? character. When sending variables this is the normal way to do it: /foo.php?id=12 But I have read that the following URL should work: /foo.php/12/ and then fetch the id in this way: $id = ereg_replace('[^0-9]', '', $PATH_INFO); I have even seen it in function but the problem is that I can't get it to work on my local apache server. When I try to write /foo.php/12/ I get a '500 Internal Server Error' and in the apache error-log I can read that 'Premature end of script headers: c:/php/php.exe'. Does anyone know what could cause this error and why the url isn't working?? thanks Kenni Graversen -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] upgrading script from using GLOBALS
Hi, I am trying to upgrade my script which currently uses globals (and register_globals=on) to turning that flag off. The online documentation on register globas has the following code recommended by users in order to register the variables: $GLOBALS[dbname] = dbname; //register globals foreach ($GLOBALS as $key=$val) { if ($key !=GLOBALS') { eval(\$$key = '$val';); } } I am using the global array to connect to my database. I find that if I insert the code above, I get an error message that the document contains no data. Can anyone tell me why? Perhaps I would be better off just declaring the variable? Would that take care of the problem? $dbname= dbname; Thanks, Nicole -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can you recommend PHP shopping cart
http://www.fishcart.org/ - the guy who wrote this (in PHP) has been programming banking gateways for 20 years -- very security conscious. The cart is very robust... Best, Nicole Peter J. Schoenster wrote: Hi, Looking for a shopping cart. I've written plenty in the past but in Perl. I'm looking for one in PHP and I don't want to write my own. I looked at this: http://www.x-cart.com/ And I asked to see their code but I have not heard anything back. I'm already favorable to anything that uses Smarty. I'd like something that is as OO as possible. Something that's got all the core features and is then easy to extend as every customer has their uniqure requirements. Anyone got some suggestions? Peter http://www.coremodules.com/ Web Development and Support at Affordable Prices 901-757-8322 [EMAIL PROTECTED] -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .htaccess file
I think it is something like - can't remember if it's an underscore or dash between the 'php' and 'flag' php-flag register_globals off HTH, Nicole B i g D o g wrote: Is it possible to set register_globals to off in the .htaccess file. If so how do I do that? .: B i g D o g :. -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .htaccess file
it's php_flag register_globals off -- you can either place this within your Directory tags in your httpd .conf file or in an htaccess file -- for more info see http://www.php.net/manual/en/configuration.php#AEN2390 best, Nicole Nicole Lallande wrote: I think it is something like - can't remember if it's an underscore or dash between the 'php' and 'flag' php-flag register_globals off HTH, Nicole B i g D o g wrote: Is it possible to set register_globals to off in the .htaccess file. If so how do I do that? .: B i g D o g :. -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php Dynamic Pages Apache Server
This will read all '.pdf' files in a sub-directory and put them in a link - HTH, Nicole ?php // read the contents of this directory $dir = ('./accessories/'); $dir_stream = @ opendir($dir) or die (Could not open a directory stream for i$dir/i.); while($entry = readdir($dir_stream)) { // get the file extention $ext = substr($entry, strrpos($entry,'.')); // print the link to the file if ($ext == '.pdf') { echo a href='$entry'$entry/abr /; } } ? [EMAIL PROTECTED] wrote: I am trying to create a php page that will show the files on an apache server. Each file will show up as a link on the page. When clicked, the user will be able to download the file. Is there anyone out there that can lead me in the right direction. -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Readdir
Change: echo $file\n; to: echo a href='$file'$file/a\n; Note the nested quotes -- outer quotes - , inner quotes (around $file) single - ' Best, Nicole [EMAIL PROTECTED] wrote: New To Php so please bear with me... :) I used the readdir function to read the files listed on a Apache server. And it worked fine. Now I would like to be able to get the files the php code returns, to be links. Where the user can click the file and download it. Also for the files to sit within a table or at least look neat on the page. http://www.optimus7.com/findme.php is the result I get from the php code below. Help! ?php if ($handle = opendir('/my/directory')) { echo Directory handle: $handle\n; echo Files:\n; while (false !== ($file = readdir($handle))) { echo $file\n; } closedir($handle); } ? -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to test if rewrite rule is working
I have created the following htaccess file using rewrite rules for the purpose of having search engine friendly files created from my dynamic files. RewriteEngine On RewriteRule ^index-(.*),(.*)\.html$ index.php?section=$1page=$2 RewriteRule ^nav-(.*),(.*)\.html$ nav.php?section=$1page=$2 How do I test to see if this is working from a search engine robot standpoint? I don't see anything in my log files and I don't see that the URI in the address bar has changed. Am I doing something wrong? TIA, Nicole -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .php3 extension?
If you want your home page to be a .php3 file then you must add index.php3 to your DirectoryIndex directive: DirectoryIndex index.html index.htm index.cgi index.php3 index.php --- and so on. In addition, .php3 should be added to your AddType directive AddType application/x-httpd-php .php .php3 .php4 .phtml If you cannot access your httpd.conf file on your server, the same directives can be modified using a .htaccess file in the appropriate directive. HTH, Nicole The Gabster wrote: Hello all... I have Apache 2.0.35 and PHP 4.2.0 on a win2k machine... Everything works fine, etc. The question I have, how can I configure PHP (or Apache?) to support (and run) .php3 extension files? Thanks a lot, Gabi. -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Passing Variables
Why do you need the group by clause? Do one or the other, not both. either do a select count(id) from table or select field, count(id) from table group by field Check your query, Nicole Amashta www.aeontrek.com James Opere wrote: Hi All, I'm trying to pass variables from one form to the other.I have a problem when i want to do the the following: 1.COUNT($variable) 2.DISTINCT($variable) . I realise i can not use the brackets in my query and the variable be recognised.When i add COUNT without the brackets i still get an error. Example. test.html form action=me.php method=post input type=text name=this .. This is sent to : me.php ?php $db=mysql_connect('localhost','',''); mysql_select_db($database,$db); $sql=select COUNT($this) from $table group by $this; ? This gives an error. Please help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] explode
if you need to pass special characters (eg. +) in the url, you need to use a url encoding function like rawurlencode().. or choose another delimeter which can be passed in the url like these -_. s Richard Kurth wrote: Question about explode this work just perfect $name=what+ever; $name1=explode(+,$name); $fname=$name1[0] ;this has what $lname=$name1[0] ;this has ever But if I pass the info from another page like this a href=whatever.php?name=what+evertest/a $name1=explode(+,$name); $fname=$name1[0] ; this has what ever $lname=$name1[0] ; this has nothing in it $fname has both names in it How come I get this it does not make since Best regards, Richard mailto:[EMAIL PROTECTED] -- PHP General 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 General 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] toronto developers?
apologies for being not quite on topic.. i just moved to toronto, canada.. i'm trying to settle in (and look for work) and was wondering if there is a developer community there.. ? or even individuals who don't mind sharing a bit of local knowledge.. any contact appreciated :) nicole -- PHP General 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] Forum script
try phorum - http://phorum.org -- awesome... HTH, Nicole Rosen wrote: Hi Can someone recommend me some good script for forums ? Thanks, Rosen -- PHP General 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] -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General 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] Netscape 6, What a piece of s$#@ ,anyone else had problems with php and Netscape 6?
Hi Brandon, I don't know if this is the problem, but if you have a DOCTYPE declaration - I have found the only one that works in N6 with dhtml is: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd; this has to do with the modes N6 operates in - strict and quirky. I found this out because I have been programming in XHTML and ran into serious N6 problems with my DHTML menus. Mine are javascript/css/html and work great with N6. HTH, Nicole Brandon Orther wrote: Hello, I am making a drop down menu script in PHP so it is compatible with non JavaScript browsers like Netscape 6.0 The problem I am having is that when I make tables it doesn't always load the background in the tables. I suspect that maybe this is something with PHP because when I make html tables they seem to load pretty good. Any Ideas? Thanks Brandon -- PHP General 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] -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General 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] selected option values not being captured by form processing software
Hi, Working on a code that uses a select/option field. All my other fields are passing through to the form processing software just fine. Meloni's PHP Essentials does this funky thing, declaring each function value as selected or not although she shows it with the individual values not with variable - and I don't understand why she is doing that - I don't see it anywhere else. What I do know is whether I try her if_else selected method or without, my value is not being passed through http. echo "td width=\"550\" align=\"left\"select name=\"select_product\""; echo "option value=\"\"Cat. ID No? Description Pkg Size Price/option"; while ($row = mysql_fetch_array($result)) { $catid[] = $row["Cat_ID"]; } for ($i=0; $i sizeof($catid); $i++) { $cat = $catid[$i]; if($select_product =="cat") { echo "option value=\"$cat\" selected$cat/option"; } else { echo "option value=\"$cat\"$cat/option"; } Thanks, Nicole -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General 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] wordwrap() in php4.03pl1 does not work(?)
Hi All, Am trying to use this function which in the manual is defined as working in versions of php 4.02 -- well, I qualify - but the feature does not work. Anyone know what is going on? TIA, Nicole -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General 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] wordwrap() in php4.03pl1 does not work(?)
Sheesh - I forgot - the function is wordwrap() Nicole Lallande wrote: Hi All, Am trying to use this function which in the manual is defined as working in versions of php 4.02 -- well, I qualify - but the feature does not work. Anyone know what is going on? TIA, Nicole -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General 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] -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General 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] printing data using javascript with php
Dear Gurus: I am trying to use javascript with my php code to output data onChange. I have read the archives and know that because javascript is client side and php is server side I cannot interact natively on the page except to pass the variables through an http request. Here is what I have done based on what I have read in the archives etc.: script language="javascript" !-- function setboo() { var boo = ?php echo $boo ?; var dsc = ?php echo $dsc ?; var sz = ?php echo $sz ?; var prc = ?php echo $prc ?; document.forms[0].boo.value+=1;} -- /script $boo is set to 0 within the php code and I am setting it to one with the javascript because I thought I could then use an if statement: //here is where boo gets set to one echo "td width=\"100\" align=\"left\"select name=\"catalog_id\" onChange=\"setboo()\""; this is the html code for the document.forms input type="hidden" name="boo" value="1" so what is supposed to happen here is the user selects a product by its id number and presto - the rest of the information will be written to the fields along side (I wish): //here is the if statement if ($boo == '1') { echo "td width=\"350\" align=\"left\"input type=\"text\" name=\"description\" onChange=\"javascript: document.write(dsc)\"/td"; } where $dsc is set equal to an array element read in from a database in the php code. Now I KNOW I have got things MAJORLY confused here - but the more I read the more wrapped up I seem to get so if there a way to pull this off and someone knows - I would appreciate your help Thanks, Nicole -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General 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] Stumped Newbie: Can't get results in db query even though everything checks - what am I missing?
Greetings, I keep getting the message that I cannot get results. I have a simple user authentication code that uses a mysql database to authenticate from. Initially I had the code working when I had the mysql_connect variables in the code itself. When I moved the connection variables to an include file and then called them as variables, it was necessary to change the variable names in the database (both were initially $username, $password). Now, while I have the connection and opening the db correct I can't get results. Here is my code: require("connect.inc.php"); $connection = mysql_connect("$hostname","$username","$password") or die ("Unable to connect to database."); echo "I'm connected.br"; **__A-OK here mysql_select_db("dnaUsers") or die ("Unable to select database."); echo "I've opened the dnaUsers db.br"; echo "$ruser, $rpassbr"; //this is from the html login form **__Yup, no problem so far - // Formulate the query $sql = "SELECT rep_name FROM reps WHERE username='$ruser' and password='$rpass'"; // Execute the query and put the results in $result $result = mysql_query($sql,$connection) or die ("Couldn't get results."); **__Here it is - crash and burn - the database name is correct, the fields are correct, the username and password are in the db and have been input correctly and are even being passed from the form correctly. I have checked the names of all the fields to ensure they match the variables in the query, checked that the values in the fields are correct - (yes, I have checked that they match.) I have searched the archives but the hard thing about the archives is formulating the question in a way that will yield an answer. Sorry if this has been asked before. TIA, Nicole -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General 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] Stumped Newbie: Can't get results in db query even though everything checks - what am I missing?
Greetings, I keep getting the message that I cannot get results. I have a simple user authentication code that uses a mysql database to authenticate from. Initially I had the code working when I had the mysql_connect variables in the code itself. When I moved the connection variables to an include file and then called them as variables, it was necessary to change the variable names in the database (both were initially $username, $password). Now, while I have the connection and opening the db correct I can't get results. Here is my code: require("connect.inc.php"); $connection = mysql_connect("$hostname","$username","$password") or die ("Unable to connect to database."); echo "I'm connected.br"; **__A-OK here mysql_select_db("dnaUsers") or die ("Unable to select database."); echo "I've opened the dnaUsers db.br"; echo "$ruser, $rpassbr"; //this is from the html login form **__Yup, no problem so far - // Formulate the query $sql = "SELECT rep_name FROM reps WHERE username='$ruser' and password='$rpass'"; // Execute the query and put the results in $result $result = mysql_query($sql,$connection) or die ("Couldn't get results."); **__Here it is - crash and burn - the database name is correct, the fields are correct, the username and password are in the db and have been input correctly and are even being passed from the form correctly. I have checked the names of all the fields to ensure they match the variables in the query, checked that the values in the fields are correct - (yes, I have checked that they match.) I have searched the archives but the hard thing about the archives is formulating the question in a way that will yield an answer. Sorry if this has been asked before. TIA, Nicole -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General 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] Stumped Newbie: Can't get results in db query eventhough everything checks - what am I missing?
Thanks Joe - that showed me right away!! all better now -- on to the next step.. Nicole "Joe Sheble (Wizaerd)" wrote: I'd start by adding the mysql_error() function in your die() statement... $result = mysql_query($sql,$connection) or die ("Couldn't get results: " . mysql_error()); it might give more information to help you find the problem... At 10:15 AM 3/8/01 -0800, Nicole Lallande wrote: Greetings, I keep getting the message that I cannot get results. I have a simple user authentication code that uses a mysql database to authenticate from. Initially I had the code working when I had the mysql_connect variables in the code itself. When I moved the connection variables to an include file and then called them as variables, it was necessary to change the variable names in the database (both were initially $username, $password). Now, while I have the connection and opening the db correct I can't get results. Here is my code: require("connect.inc.php"); $connection = mysql_connect("$hostname","$username","$password") or die ("Unable to connect to database."); echo "I'm connected.br"; **__A-OK here mysql_select_db("dnaUsers") or die ("Unable to select database."); echo "I've opened the dnaUsers db.br"; echo "$ruser, $rpassbr"; //this is from the html login form **__Yup, no problem so far - // Formulate the query $sql = "SELECT rep_name FROM reps WHERE username='$ruser' and password='$rpass'"; // Execute the query and put the results in $result $result = mysql_query($sql,$connection) or die ("Couldn't get results."); **__Here it is - crash and burn - the database name is correct, the fields are correct, the username and password are in the db and have been input correctly and are even being passed from the form correctly. I have checked the names of all the fields to ensure they match the variables in the query, checked that the values in the fields are correct - (yes, I have checked that they match.) I have searched the archives but the hard thing about the archives is formulating the question in a way that will yield an answer. Sorry if this has been asked before. TIA, Nicole -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General 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 General 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] -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General 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] newbie: ye ol' nemesis using mysql_fetch_array to load data
Hello all, I have an order form where I am trying to load an option button with a field column from a database file: This part works fine (actually Professional PHP has an example using the do...while statement - I wonder which is better?): $len = mysql_num_rows($result); for ($i=0; $i=$len; $i++) { echo "option value=\"$catid[$i]\"$catid/option"; } The problem I have is loading the array - either I get the first or last element of the array as a scalar variable or I get arrays of the word 'Array': while ($row = mysql_fetch_array($result)) { $rowid[] = $row["dnaProd_ID"]; $catid[] = $row["Cat_ID"]; $desc[] = $row["Description"]; $size[] = $row["Pkg_size"]; $price[] = $row["Price"]; } and I have tried it without the [] - neither works. I also tried this with a for loop - replacing the while statement with for($j=0; $j=$len; $j++) { $row = mysql_fetch_array($result); $rowid[$j] = $row["dnaProd_ID"]; $catid[$j] = $row["Cat_ID"]; etc, etc nope ;{ sigh - checked the archives, books - saw a similar question but I tried what they did and it did not work. This is one of those instances where the solution is so simple I can't find it. TIA for your help, Nicole -- Nicole Lallande [EMAIL PROTECTED] 760.753.6766 -- PHP General 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]