Re: [PHP-DB] setting session variables via a form
Not to beat a dead horse, but I have a problem associated with differences between 4.3 and 4.0.6. My local server (Mac OSX) is running 4.3 and has globals off. I designed the code to run with $_SESSION for my log in pages, and they work fine. Then I had to move the files to a client's server and discovered that he was running 4.0.6 and globals on. Now I have to revise my login scripts to accomodate. Is there a function like $_SESSION['user_name'] vs. $session_register('user_name') that would work on both? I tried $HTTP_SESSION_VARS[user_name] but that didn't keep the user_name going into the next page, which causes the login to fail and send back to the login page. Snippets as they are now (for 4.0.6): // this is the log in page ? session_start(); if ($user_name $login_pass) { // if the user has just tried to log in from FORM session_register(user_name); } if (session_is_registered(user_name)) { header(Location: content.php); exit(); } .. rest of file ? // content.php ? session_start(); if (!session_is_registered(user_name)) { header(Location: index.php); exit(); } die(check:.$user_name); -- may actually accept the registry of user_name but still does not display it .. rest of file ? On Monday, June 16, 2003, at 11:11 AM, Ford, Mike [LSS] wrote: -Original Message- From: Hutchins, Richard [mailto:[EMAIL PROTECTED] Sent: 16 June 2003 17:08 session_start(); session_register(isRegistering); $_SESSION[isRegistering] = true; B't! If you're using the $_SESSION array, then you MUST NOT use session_register() and friends. (Well, ok, maybe that's overstating it a bit, but you still shouldn't do it!) Cheers! Mike
Re: [PHP-DB] Storing an array in the database
just as a quick fix. I use the following snip to take an array of choices, enter it into a varchar field (or text if you expect alot) and extract back to array: $choicesArray is a list of checkboxes from a form // put data into table $checkList = implode(;, $choicesArray); mysql_query(update table set choices='$checkList' where id=$itemID); ... // get data out of table mysql_query(select choices from table where id=$itemID); $choiceArray=explode(;,$row['choices']); // this is of course, rough and simplified, but you should get the idea. Terry On Friday, February 28, 2003, at 10:09 AM, Jonathan Villa wrote: How would I store an array in the database? I want to store 2 things. One array of shirt sizes and one array of which holds other arrays. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] question about access
I'd like to get some opinions from the list. We run php/mysql on our linux servers located behind a firewall. Many of our clients have scripts that access their databases via php running on the hosting server, and the general access is set up as: $hostname = localhost; $database = clientsDB; $username = client; $password = ; etc.. One of our clients has a friend who wants to do some php/mysql and has asked for access to the database. We gave them the information above, and he complains that localhost is insufficient. We think that if he is requesting servername.domain.net:accessPort that that gives him access through the firewall. Instead, he should upload his scripts using ftp and use localhost, as all our other clients do. What is the general consensus? If giving an outsider this kind of access just asking for trouble? Terry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] picture into mysql (file address)
One comment is to be sure the destination folder has write privileges for world. My typical usage is: 2) // datafile is field name for image/file upload browser $img_dir = ../photos; // must be 777 access if($datafile_name != ) { if ($datafile_name != none) { $newFileName = $datafile_name; if (!(copy($datafile, $img_dir/$newFileName))) { $errmsg = bcopying $newFileName failed/bbr; } else { $errmsg = bcopying $newFileName succeeded/bbr; } } } On Wednesday, December 18, 2002, at 02:20 PM, Seabird wrote: exec(cp $_POST[picture] //localhost/seabird.jmtech.ca/OTF.com/images/$_POST[picture_name]);
Re: [PHP-DB] first Array value duplicating..
An Real World example of how I do a similar thing might help: My list with checkboxes (since this is dynamic, I don't know what numbers are assigned) $itemID is the id of the record from the mysql table, so the check box name is 'chk_12' for id=12. $checkAll is a flag if the user selected the Check All button, echos(selected) to check all the checkboxes. tdinput type='checkbox' name='chk_$itemID' value='$itemID' $checkAll/td The in my process code I switch the submit button and test for delete. $maxID is the max(id) from the list of items. I walk through the possible list of items and see if any were checked and if so append them to my list of deletes. Note that I use where id in () to gather all the items at once. case Delete Selected Records: for($x=0;$x=$maxID;$x++){ $varname=chk_$x; $value=$$varname; if($value) { $events[] = $value; } } if($events) $events_IDs = implode(',', $events); $sql= delete from $tableName where id in ('$events_IDs'); mysql_query($sql) or die($sql . mysql_error()); $message_str=Record(s) deleted; break; HTH Terry On Thursday, November 7, 2002, at 09:24 AM, Aaron Wolski wrote: Hi All, In a form I have checkboxes associated with order records. The checkboxes are for deleting order records (should a client choose to do so). It looks like this: form name=form action=process_bank.php method=POST input type=hidden name=order_index[0] value=1 td class=cartlink align=centerinput type=checkbox name=delete[0] value=1/td input type=hidden name=order_index[1] value=3 td class=cartlink align=centerinput type=checkbox name=delete[1] value=1/td input type=hidden name=order_index[2] value=8 td class=cartlink align=centerinput type=checkbox name=delete[2] value=1/td input type=hidden name=order_index[3] value=12 td class=cartlink align=centerinput type=checkbox name=delete[3] value=1/td /form Now.. when the process button is pressed the information is carried off to the process_bank.php script. Lets assume for this example.. I selected the checkbox delete[0] (which equals value 1) and delete[3] (which equals value 12). In the script I have this code: for ($i=0;$isizeof($order_index);$i++) { $orderQuery = db_query(SELECT id FROM TestOrderTable WHERE id=.$order_index[$i]); $orderResult = db_fetch($orderQuery); if ($delete[$i] == 1) { $ids .= $orderResult[id]; echo $ids; } } The echo'd value that I get is 1,1,12 when it should be 1,12. When only ONE checkbox is selected I just get the one value displayed (i.e. if I selected the first checkbox the echo'd value would be 1). Does anyone know why the first value is being duplicated on a multiple select but not on a single select? Sorry if this sounds confusing :( Aaron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] sort by date
I have two tables, one contains event information and the other dates that the event takes place: | id| int(11) | | PRI | 0 | auto_increment | | title | varchar(100) | YES | | NULL|| | location | varchar(100) | YES | | NULL|| | address | varchar(100) | YES | | NULL|| | contact | varchar(100) | YES | | NULL|| | category | varchar(100) | YES | | NULL|| | event_time| varchar(200) | YES | | NULL|| | urllink | varchar(100) | YES | | NULL|| | descript | text | YES | | NULL|| | id | int(11) | | PRI | 0 | auto_increment | | event_key | int(11) | YES | | NULL|| | event_date | date| YES | | NULL|| They are linked via dateTable.event_key=eventTable.id I want to be able to sort by the first date that the event takes place. I tried: $sql=select e.*,d.event_date from eventTable e,dateTable d where e.id=d.event_key order by d.event_date,d.event_key but it still shows each date that the event takes place. I tried doing a min(d.event_date) as event_date and then group by instead of order by but still get too many results. Any help to straighten this out? Terry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] sort by date
Thanks. My error seemed to be just in the group declaration. Comparing yours and mine with slight modifications to yours that eventually worked as desired: yours: select e.id, title, min(event_date) as event_date from eventTable e, dateTable d where e.id = d.event_key group by e.id; mine: select e.*,min(d.event_date) as event_date from eventTable e,dateTable d where e.id = d.event_key group by d.event_date,d.event_key; As you see, I was already trying to do a join, but the group by was throwing me. Terry On Wednesday, November 6, 2002, at 09:15 AM, Marco Tabini wrote: My guess? Because we're all professionals at work and trying to solve a specific problem...since we're adults, I guess the learning part should be up to each of us--the information is certainly there even in the answer. :-) Marco -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] sort by date
I have a manual and use it plus lots of sample code to work through, but there are times when we hit a wall and a simple second set of eyes to spot what should be obvious is helpful. I appreciate having a forum to throw out a question and get a rapid response. I could have rewritten this problem, taking the wrong way around and spending more time than my client would like. This way I not only have the solution, but the reason behind it, as well. Thanks again. Terry On Wednesday, November 6, 2002, at 09:35 AM, [EMAIL PROTECTED] wrote: Agreed. we prove day in and out that the answers are only an email away...why would anyone go a different route. manual? whats a manual? There are some brilliant people on this list, but some equally intelligent people wrote some fine documentation. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] assist with SORT array
I have a head scratcher.. prob just a glitch on my side, but somehow I am confused with the results. I have a php script pulling from a mysql database for id/names which is getting choices through a check box form. All of that works just fine, but I wanted to display the results sorted by title. My snippet of code is: // $restaurants = array() of ids back from form for($i=0;$isizeof($restaurants);$i++) { $rest_id = $restaurants[$i]; $sql=select name from restaurants where id=$rest_id; $result=mysql_query($sql) or die($sql . mysql_error()); while($row=mysql_fetch_object($result)) { $rest_name .= ucwords(stripslashes($row-name)) . ;; } } $rest_array=explode(;,$rest_name); $rest_sort=sort($rest_array); // -- the problem line die(checking: $rest_namebrbr size = .sizeof($rest_array) . sorted: . sizeof($rest_sort)); the results come back with 6 in the $rest_array but only 1 in the $rest_sort array! How is that?? checking: Hi-Ho Tavern;Village Inn;Speak Easy;Duane's House Of Pizza;Atomic Coffee; size = 6 sorted: 1 What I am trying to accomplish is an array('Atomic Coffee', 'Duane's House Of Pizza','Hi-Ho Tavern','Speak Easy','Village Inn') Help?? Terry Romine Web Developer JumpInteractive.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: [PHP-DB] database result: tables with 2 coloumns
my improvement is: === $counter = 1; echo table border=1tr; //start of table for ($i=0;$i$num_rows; $i++) //loop through the number of records { $row = mysql_fetch_array($result); //Get associate row echo td$row[0]/td; //Print out the NAME if($counter =(! $counter)) echo /trtr; //Make a new Table row } echo /tr/table; Terry On Thursday, September 5, 2002, at 06:39 PM, Brad Bonkoski wrote: How's this? (MYSQL example) $query = select NAME from table_name; $result = mysql_query($query) or die(Invalid Query: $query); $num_rows = mysql_num_rows($result); $counter=1; echo table border=1tr; //start of table for ($i=0;$i$num_rows; $i++) //loop through the number of records { $row = mysql_fetch_array($result); //Get associate row echo td$row[0]/td; //Print out the NAME if ($counter == 2) { echo /trtr; //Make a new Table row $counter=1; //Reset Counter } else { $counter++; //Just increment the counter } } echo /tr/table; mysql_free_result($result); HTH -Brad -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Comparison with formatted numbers
I've run into a sticky case where my query is failing (PHP4.x/MySQL). I have a table where the price value is imported from an external source, so I can't change it on the fly, and they embed thousands seperators (in my case ','). When I try to do a query such as .. where price = '25' .. if finds values that meet or exceed that value (returns some in the range of 2,500,000. I gather that it is failing because of the comma (the price field contains values of '2,500,000'). Is there a function that I can use to force the price format to integer before/during the query? Or would it work if I did a number_format on the test value? ie: '.. where price = '200,000' ..' Help would be appreciated. Terry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] multiple selections to input variables
I have a form with a multi-line select field: select name=cities size=5 multiple ? $sql=select City from table group by City ; $result = mysql_query($sql) or die($sql . mysql_error()); while($row=mysql_fetch_object($result)) { $city = $row-City; $cityCode = strtolower(eregi_replace( ,_, $city)); $cityName = ucwords(strtolower($city)); echo(OPTION value='$cityCode'$cityName/OPTION); } } ? /SELECT and I am trying to read the multiple selections on the process form, but only seeing the last selected item. [ sample parameter list based on get method ] filename.php?cities=waterfordcities=wintoncities=woodbridge [snip] if($cities) { // multiple may be selected -- figure that out later die(multiple cities: $cities);// results in displaying 'multiple cities: woodbridge' } [snip] I'm using PHP and MYSQL to hold the results. Terry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] multiple selections to input variables
Great!! Works like a charm. Terry On Thursday, July 18, 2002, at 10:27 AM, Jason Wong wrote: On Thursday 18 July 2002 23:18, Terry Romine wrote: I have a form with a multi-line select field: select name=cities size=5 multiple Use: select name=cities[] size=5 multiple if($cities) { // multiple may be selected -- figure that out later die(multiple cities: $cities);// results in displaying 'multiple cities: woodbridge' } You can then use: foreach ($cities as $value) { echo Selected $valuebr; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] cookies multiple pages
I'm having a problem with cookies over several pages. I've tried to set them up per the manual, ie: prior to header, and using setcookie('cookiename',$value,time()+3600). The cookie seems to be created fine on the first page, and passed to the second page, but is not maintained when the pages are re-viewed. I am trying to use this to assign a user id when someone comes in, and keep their id while they go through various searches and resulting pages, as well as keeping their search parameters for them. But when they go to a new search, all the data gets wiped and it starts all over. I have the cookie set for an hour, but it is empty when the search is run again. I thought cookies would remain in effect for the duration of the life (an hour) and be accessible to the pages over again. Help?? My code is as follows: search.php: if (!isset($user_data)) { setcookie(user_data,,time()+(3600));// set for 6 weeks *24*7*6 } [snip] if($user_data==) { $sql=insert into user (last_login) values (now()); mysql_query($sql); $myID= mysql_insert_id(); $user_data = $myID; } search_result.php: if (isset($user_data)) { $myID = $user_data; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] cookies multiple pages
1) no, the commented setcookie(user_data,,time()+(3600));// set for 6 weeks *24*7*6 I would move the *24*7*6 back into the (3600) to make it so. I just want to test for an hour 2) so maybe this is a problem with the server? I've been tearing my hair out because neither cookies nor sessions are acting the way that I have done them in the past on a different server. **sigh** On Wednesday, July 3, 2002, at 10:05 AM, [EMAIL PROTECTED] wrote: Is this a issue with register _globals = off. try referencing it with $_COOKIE['user_data']. Also isn't 3600 only an hour. 60secs * 60mins? i think 6 weeks would be... 151200 60 * 60 * 42days does that work? Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] cookies multiple pages
as in if (!isset($_COOKIE['user_data'])) { setcookie(user_data,,time()+(3600));// set for 6 weeks *24*7*6 } ?? nah.. that doesn't work either. It still creates a new cookie. On Wednesday, July 3, 2002, at 10:05 AM, [EMAIL PROTECTED] wrote: Is this a issue with register _globals = off. try referencing it with $_COOKIE['user_data']. [EMAIL PROTECTED] said: Trust me this does not work with php 4.2.1 and apache 2.0.39 from what I am told if you get the cvs for apache 2.0.4 it should but I just down graded to apache 1.3.26 and php 4.0.6 and eveything works like a champ. Just my .02 of course if you get it working let me know what you did as I spent a week on it... but since this isn't my server, I can't downgrade or reset settings. *sigh* Thanks, so far.. Terry
Re: [PHP-DB] cookies multiple pages
just checked and the server is running Apache 1.6.19 and PHP 4.0.6 Terry On Wednesday, July 3, 2002, at 09:52 AM, [EMAIL PROTECTED] wrote: Trust me this does not work with php 4.2.1 and apache 2.0.39 from what I am told if you get the cvs for apache 2.0.4 it should but I just down graded to apache 1.3.26 and php 4.0.6 and eveything works like a champ. Just my .02 of course if you get it working let me know what you did as I spent a week on it...
Re: [PHP-DB] How do I get a ' in my sql statement?
Any text field that has the possibility of getting quotes should be handled by $textfield = addslashes($textfield); prior to insert. Then on displaying, use $textfield = stripslashes($textfield); If it is a big text (including paragraphs) I use $textfield = nl2br(stripslashes($textfield)); On Monday, June 10, 2002, at 12:40 PM, Daniel Brunner wrote: Hello!! Spit some code out...I put a lot of ' in my inserts... Is it from a form?!?!!? Is it from a Insert, or Select or Update?!? That's why we need some code... Dan On Monday, June 10, 2002, at 12:01 PM, [EMAIL PROTECTED] wrote: I have noticed that when I try to assign the value of a input field that has a ' in it for example : can't It will goof up my attempt to load the information to the database. Anyone know a way around this? Do I have to send each string through a parsing routine before assigning my string to a variable that will be used in a SQL statement? Thanks, Blaine -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Terry Romine Web Developer JumpInteractive.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: [PHP-DB] PHP amd MYSQL
I'll add this snippet in to prevent accidental deletes: a href=delete.php?id=' . $row[id] . ' onClick='return confirm(\Do you really want to delete this record?\)' ' . $row[name] . '/a On Wednesday, June 5, 2002, at 09:20 AM, [EMAIL PROTECTED] wrote: One way to do it would be thusly: $result=mysql_query(yadayada); foreach($result as $row){ echo ' trtd a href=delete.php?id=' . $row[id] . '' . $row[name] . '/a ... /tr'; } This would set up a url that when the user clicks on $row[name] (such as Record Description it would call delete.php with the argument of $row[id] Within that delete.php, you remove the selected record, then call the original page. Use: $sql=DELETE from table where id=$id; Then do: echo ' Header(Location: original_location.php); You can't have any html previous to the Header command, though. This will return you to your original page where you can do your select again, and the deleted row won't show up. You may need to pass parameters on the Header line to let original_location.php exactly where you were previously. This would have to be passed either on the url or as a post/get operation when first calling delete.php Terry Romine Web Developer JumpInteractive.com
Re: [PHP-DB] move next
Look at setting up a couple of vars (I use $start_rec and $max_display) and then use these to do a LIMIT on your SELECT statement. Then use a link to go to next item or previous item. Pseudo code: $first_rec = ($first_rec) ? $first_rec : 0; // if rec is passed in, use it else start at 0 $max_display = 1; // show one record at a time // first do a select of all records to get mysql_numrecs and assign to $num_recs // then get the current record $sql = select * from $table LIMIT $first_rec,$max_display; ... $next = $first_rec+1; $prev_rec=$first_rec-1; $this_rec = $next; // same record number as current, except 1-based echo a href='file.php?first_rec= $prev_rec'Previous/a Showing $this_rec of $num_recsa href='file.php?first_rec=$next'Next/a; HTH On Thursday, May 16, 2002, at 08:32 AM, Natividad Castro wrote: Hi to all, how do I move through a recordset? For example, if I have 4 records and I want to display one at a time and let the user to click a MoveNext button to go to the next record or a Previous button to go to the Previous record. Thanks in advanced Nato -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Terry Romine Web Developer JumpInteractive.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] session variables across several pages
First, forgive me if this seems to be cross post -- but it does involve both PHP and MySQL. My client requirements are: From their website, they display a list of classes. On registering for a class, the user is sent to a secure page that is hosted on a different secured server that does not have access to the client's MySQL database. I pass in the class info so the registration form can display Registering for class $titlebr$start_datebr$cost The form then gathers name, address, etc including credit card info. On submitting the form, the data is processed and a PGP email is sent out to the registar. Then a thank you page is displayed and the user is forwarded back to the main site, where a second page is displayed allowing for either download of class materials or to return to the class list. This page is where I post the necessary info into the MySQL database. So my dilemma -- I want to use session_register to capture the field info from the registration form and then read it back out on the website thank you page. I have session_start(); session_register(start_date); session_register(end_date); session_register(section); session_register(class); session_register(title); session_register(class_id); session_register(register_id); session_register(name); session_register(employer); session_register(e_address); session_register(e_city); session_register(e_state); session_register(e_zip); at the beginning of the form page (select_class.php) and the thank you page on their website (thanks.php) where I post the info to MySQL. The form includes inputs such as tdpbName:/b/p/td td colspan=3 input type=text name=name maxlength=100 size=60 value=? echo($name); ? /td What happens is that old data shows up for name, and address (the only fields I have tested so far) regardless of what I enter in the form. I was under the impression that a registered variable is updated once the page is processed. If I am calling the same page (select_class.php) to process the form, does the data get reverted somehow? The data just doesn't seem to get updated to the form inputs. What might I be missing? Thanks in advance Terry Romine Web Developer JumpInteractive.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] session variables across several pages
I believe you.. I added $HTTP_SESSION_VARS['e_address'] = $e_address; in my process form code and it's still not updating the var. snippit from select_class.php where I have reference to $e_address: session_register(e_address); ... switch($doAction) { case Save Information: // save data in cookies $HTTP_SESSION_VARS['e_address'] = $e_address; die($e_address); ... form name='myForm' method='POST' action='select_class.php' enctype='multipart/form-data' tr tdpbEmployer Address:/b/p/td td colspan=3 input type=text name=e_address maxlength=100 size=60 value=? echo($e_address); ? /td /tr input type='submit' name='doAction' value='Save Information' ... entering any new data does not replace the old data as the die($e_address) shows. Whatsupwiththat??? On Wednesday, May 15, 2002, at 09:57 AM, matt stewart wrote: You need to look up $HTTP_SESSION_VARS['name'] - that's how to change the variables when they are already set.. i think most people have this problem when they first use sessions! Terry Romine Web Developer JumpInteractive.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] session variables across several pages
This is freaky. If I change the form method='get' I can see the e_address coming in correctly, but it gets changed back to old value -- by the session_register('e_address')?? should I have something along the line of if(!$e_address) register_session('e_address'); ??? On Wednesday, May 15, 2002, at 09:57 AM, matt stewart wrote: You need to look up $HTTP_SESSION_VARS['name'] - that's how to change the variables when they are already set.. i think most people have this problem when they first use sessions! Terry Romine Web Developer JumpInteractive.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] session variables across several pages
huh.. seems to work, now. I do the following: session_start(); session_register(form_data); if($doAction) { switch($doAction) { case Save Information: // save data in cookies $HTTP_SESSION_VARS['form_data'] = array($name,$employer,$e_address); ... and on the thanks page: session_start(); session_register(form_data); list($name,$employer,$e_address) = $form_data; and it displays the correct data now. S the trick seems to be to not use the same var names. Ok. I got it. Thanks!! On Wednesday, May 15, 2002, at 11:01 AM, matt stewart wrote: don't think you can have an array as a session variable, you'd have to set it as character delimited string or something. Terry Romine Web Developer JumpInteractive.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] finding a link in large text blob
Is there an easy way (say using eregi_replace) to find a link reference in a blob of text and add the a href anchor around it? Something like: text has a link to a website at http://www.whatever.com/mydirectory/mypage.html ... and converts it to text has a link to a website at a href='http://www.whatever.com/mydirectory/mypage.html'website/a ... My thoughts are that I should be able to do something like a eregi_replace, finding any occurances of http:// and trapping all non-space characters following it to convert to the anchor. But what about multiples? How do I rebuild the text with the substitute strings? Thanks in advance Terry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Embedding Perl
I have a small situation where it would be good to be able to embed a perl routing in a php script. Is this possible? Or do I need to pass control from php to a perl script and return? A quick synopsis would be (in pseudo code) ?php if($theFileType == pdf { // call convert.pl to get a thumbnail } else { // other file type processing } ? Alternatively, is there a module that can take a pdf file and make a thumbnail of the first page? Thanks, Terry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Embedding Perl
Ok, I found snippets that talk about using either exec() or backticks. The problem is that it still doesn't call the perl script. Or at least doesn't seem to. exec(convert-pdf.pl Blank.gif,$out); echo(implode(\n,$out)); $out = `convert-pdf.pl Blank.gif`; echo($out); If I run perl convert-pdf.pl Blank.gif from the shell, it responds with 135x105 and creates a secondary file. This is what the script is meant to do. Calling it in either of the example above, results in either an Array or nothing being displayed. No secondary file gets created. On Wednesday, October 24, 2001, at 11:05 AM, Terry Romine wrote: I have a small situation where it would be good to be able to embed a perl routing in a php script. Is this possible? Or do I need to pass control from php to a perl script and return? A quick synopsis would be (in pseudo code) ?php if($theFileType == pdf { // call convert.pl to get a thumbnail } else { // other file type processing } ? Alternatively, is there a module that can take a pdf file and make a thumbnail of the first page? Thanks, Terry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] security in PHP under Apache
But how do you set it so a webuser would run sudo? That sounds pretty dangerous, to me. I have a similar situation where I want PHP to create a subdirectory and set privileges to it based on the login user. I end up having to create the directory by hand via SSH and then run the php script. Terry On Wednesday, May 23, 2001, at 12:36 PM, Jonathan Hilgeman wrote: PHP runs via Apache, so it adopts the user that Apache uses, essentially. You can use a program like sudo to allow them to run certain commands on the server. Jonathan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] PHP and Access
I normally work PHP/MySQL but now I have a customer that is adamant about keeping their data in an Access DB. I tried to use ADODB to do generic access scripts, but that doesn't seem to work out for me. I get an unsupported function just trying to make a connection. One problem is that my server is running PHP3. I have the db file; but where does it go on the server? Or does it matter? Is there any simple wrapper type script that I can use to access their db? Tips would be helpful or links to other solutions... Thanks Terry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] variables
On Thursday, March 29, 2001, at 04:58 PM, Scott Kalbach wrote: I have the individual queries in include files. It does the first 2 queries fine,but when it gets to the third, the value of $customer seems to be gone, so I get no result for the rest of the query's. I looked in my scripts but can't figure out any reason it would lose this value. Any ideas? I'd check over between the last query that has a valid value of $customer and make sure that my code for input type='hidden' name='customer' value='? echo $customer; ?' is there. I have had a number of these to have to track down *grin* HTH Terry -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Hold that insert!
I like your simplicity and straightforwardness. My code tends toward: switch($submit) { case: "Accept": .. insert record break; case: "Delete": .. delete record break; case "Cancel": .. cancel record changes and return to previous condition break; } if($submit) { show form } else { show list } where list is a display of the records in the database (browse) and the form is a one record dataentry/modification/delete form. On Tuesday, March 27, 2001, at 10:46 AM, Boget, Chris wrote: I do something similar. However, my layout is like this: -- if( isset( $submit )) { errorChecking(); if( $noErrors ) { doDBInsert(); header( "location: blah" ); exit(); } // end if( $noErrors ) showErrors(); } // end if( isset( $submit )) displayForm(); In Light and Love EaTrom Order of Melchizedek Michael's Legions - EaTrom's Site: http://www.blazing-trails.com Spirituality Conspiracy - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How to sort numerically ?
"select data_name,data_number from myTable order data_number DESC" The "DESC" is descending. HTH Terry On Friday, March 23, 2001, at 03:02 PM, Sunil Jagarlamudi wrote: I am trying to read a file which has two columns with names and numbers and I am trying to sort them numerically, with the highest at the top. Is there anyway you can do that in php ? Thank You Sunil In Light and Love EaTrom Order of Melchizedek Michael's Legions - EaTrom's Site: http://www.blazing-trails.com Spirituality Conspiracy - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] How do I test on number of fields ?
check where you are getting "$mysql_link" that is the problem I usually associate with the error you report. if $mysql_link is undefined, MySQL can't perform the query. Terry On Tuesday, March 20, 2001, at 12:06 AM, Toke Herkild wrote: $mysql_result = mysql_query($query, $mysql_link); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] PHP how to compare?
even better to use: echo("\$PASS = $PASSbr\$PASSNOG = $PASSNOG"); which will show the variable name whether it has anything defined or not. Terry On Wednesday, March 14, 2001, at 03:21 PM, Ivo Stoykov wrote: Hi Duky Try to add this before if statement echo("$PASSbr$PASSNOG"); -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]