RE: [PHP] Using sessions
An idea is to put the session id in your web page addresses. e.g. http://level1/level2/12123234234234234234/test.php Then setup your web server to filter all addresses to remove the session id from the address before it is displayed in the browser window (you can set apache to do this) so the user won't see it. You can then write a little code to get the session id from the address (the full address including session should be passed to your app). And then recreate the session etc.. I've got some code at home demonstrating this technique. I can send it to you later of you want it. -Stewart -Original Message- From: Rosen [mailto:[EMAIL PROTECTED]] Sent: 14 March 2001 08:52 To: [EMAIL PROTECTED] Subject: Re: [PHP] Using sessions Thanks, but cookies are disabled ! Rosen Marinov ""Yasuo Ohgaki"" <[EMAIL PROTECTED]> wrote in message 98nai7$2gb$[EMAIL PROTECTED]">news:98nai7$2gb$[EMAIL PROTECTED]... > "Rosen" <[EMAIL PROTECTED]> wrote in message > 98n8ut$m26$[EMAIL PROTECTED]">news:98n8ut$m26$[EMAIL PROTECTED]... > > Hi, > > When I use sessions, on the URL row of the browser shows > > "PHPSESSID=CXXX". > > Can I hide id ? > > > > Thanks, > > Rosen Marinov > > Use cookie for session. It seems there are some browsers that will not take > cookie on initial request, and fallback to URL mode. See notes session section > in Online PHP Manual for details. > > Regards, > -- > Yasuo Ohgaki > > > > -- > 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 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] RE: Function to compare an array with another array
How about using the array_diff function instead. array_diff ($array1,$array2) = elements in $array1 not in $array2; array_diff ($array2,$array1) = elements in $array2 not in $array1; >From manual: array array_diff (array array1, array array2 [, array ...]) Array_diff() returns an array containing all the values of array1 that are not present in any of the other arguments. Note that keys are preserved. Example 1. Array_diff() example $array1 = array ("a" => "green", "red", "blue"); $array2 = array ("b" => "green", "yellow", "red"); $result = array_diff ($array1, $array2); This makes $result have array ("blue"); -Original Message- From: Fang Li [mailto:[EMAIL PROTECTED]] Sent: 15 March 2001 14:03 To: Tim Ward; 'Jimmy Bäckström'; PHP General List Subject: RE: [PHP] RE: Function to compare an array with another array Hi, I am trying to use the Function ArrayCompare, but it always has an error in "if(($key = array_search($element, $array2)) == false)", and also I couldn't get the page of http://www.stivesdirect.com/e-mail-disclaimer.html Would you please give me a clue? Thanks! Fang -Original Message- From: Tim Ward [mailto:[EMAIL PROTECTED]] Sent: March 5, 2001 5:48 AM To: 'Jimmy Bäckström'; PHP General List Subject: [PHP] RE: Function to compare an array with another array function ArrayCompare($array1, $array2) { $answer = new Array() foreach ($array1 as $element) { if (($key = array_search($element, $array2)) === false) { $answer[$key] = $array2[$key]; } } return $answer; } this will return an array that is a copy of the first array with only those elements that are not in array2. If you only want the first one either just use the first one( foreach(){ ... break;}) or put a break in the if. Tim Ward Senior Systems Engineer Please refer to the following disclaimer in respect of this message: http://www.stivesdirect.com/e-mail-disclaimer.html > -Original Message- > From: Jimmy Bäckström [mailto:[EMAIL PROTECTED]] > Sent: 05 March 2001 06:38 > To: PHP General List > Subject: Function to compare an array with another array > > > Shu! > I need some help here. > I have a script where I want to compare two arrays with > eachother, and return one value from that does not exists in > both arrays. I have an array of pictures id number created > from a database query. I use sessions to save id numbers of > pictures into an array. I want the first array to be compared > to the second and return the first key/value-pair that are > not found in the session array... > Is there a way I can do this? > > Thankful for any help! > /Broder B > -- 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 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] POST conversion.
PHPLIB http://phplib.netuse.de/ has a Query class in sql_query.inc which is used in conjunction with the DB_Sql class. It can be used to create dynamic insert and update queries by assuming that global variables exist which map onto a paricular tables field. You basically name the table and it creates the query for you. You can also use it to create the select part of your sql queries say to select all the fields from the table, to fill in a form. The PEAR library (come with PHP install files) may also have something similiar but I haven't got it at hand to look at. -Stewart -Original Message- From: Nick Davies [mailto:[EMAIL PROTECTED]] Sent: 15 March 2001 16:32 To: [EMAIL PROTECTED] Subject: [PHP] POST conversion. Hi (again). Is there a simple was to take post data from a form and create a query string out of it? Thanks. Nick. -- 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] RE: [PHP-DB] validating checkboxes
The javascript syntax is document.form_name.elements['preq[]'][indx] -Stewart -Original Message- From: Adv. Systems Design [mailto:[EMAIL PROTECTED]] Sent: 15 March 2001 15:39 To: PHP List Subject: [PHP-DB] validating checkboxes Hello all: I have to validate that AT LEAST ONE checkbox is checked in a series of checkboxes...the checkboxes all use the name=preq[] so that when I process it, it will go into a php array...the problem is that I want to validate it using javascript and the [] in the object name (preq[]) causes problems in traversing the checkbox values to check if they are =true!! Any ideas? Validating on the PHP side is not an option because this page is part of a series of pages and I encounter the dreaded "post operation reload" problem if the user has to hit the back button. Thanks Luis __ Do You Yahoo!? Yahoo! Auctions - Buy the things you want at great prices. http://auctions.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP 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] use strict alternative
php variables are local by default. -Original Message- From: Costas [mailto:[EMAIL PROTECTED]] Sent: 19 March 2001 10:27 To: [EMAIL PROTECTED] Subject: [PHP] use strict alternative Is there a PHP alternative to Perls use strict command. For anyone who doesnt know Perl, use strict forces local declaration of variables thanks -- 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]
RE: [PHP] Editing Variables from another script.
include "database.inc" . . . . $dbhost='localhost'; -Stewart -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 20 March 2001 09:26 To: Jason Stechschulte Cc: 'PHP General List. (E-mail)' Subject: Re: [PHP] Editing Variables from another script. Okay, basically, I'm trying to create a script such that it will change the variables inside of my .inc page. Something like lets say I have this file called "database.inc" Inside it I have : $dbhost = 'blah' $dbuser= 'blah' $dbpass= 'blah' I would like to make a script such that I can modify the $variables into something else like, $dbhost into localhost. How can it be done? - Original Message - From: "Jason Stechschulte" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: "'PHP General List. (E-mail)'" <[EMAIL PROTECTED]> Sent: Monday, March 19, 2001 11:03 PM Subject: Re: [PHP] Editing Variables from another script. > On Sun, Mar 18, 2001 at 01:06:34PM +0800, [EMAIL PROTECTED] wrote: > > > I'm trying to create a form whereby I can edit the variables with just the form. > > > > It will be something like a form for me to change the database details(username,server,password) in a .inc I'm using. > > > > Is there anyway for me to pass information into another file's variable and have it saved in there? > > > > If anyone have seen Newspro (CGI) before, when you edit some parts in a form, the information will be saved. How can it be done in PHP? > > There is probably a hundred or more ways this can be done. For me to be > able to give you specifics, you will have to be more specific with what > you are doing and what you have tried. > > -- > Jason Stechschulte > [EMAIL PROTECTED] > -- > Well, I think Perl should run faster than C. :-) > -- Larry Wall in <[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 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] Easy Object Reading
You could try echo serialize($object_var); to display the object in it's serialized form. -Stewart -Original Message- From: Thorsten Viel [mailto:[EMAIL PROTECTED]] Sent: 20 March 2001 12:59 To: [EMAIL PROTECTED] Subject: [PHP] Easy Object Reading Hi, does somebody know a function where I can read all variables of an object independent of there name? I have to test with large classes, more than 30 vars per class, and dont want to implement a function just for testing. I want to echo all values of vars of a class without specifyieng explicitly every single varname. Hope somebody can help me. Thanks Thorsten -- 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]
RE: [PHP] PDF reading via IE5.5
Try, header("Content-type: application/pdf"); header("Location:$filename"); -Stewart -Original Message- From: Dennis Moore [mailto:[EMAIL PROTECTED]] Sent: 21 March 2001 04:14 To: [EMAIL PROTECTED] Subject: [PHP] PDF reading via IE5.5 I have searched long and hard to resolve this issue. I've tried many variations for the header tag. However, I cannot seem to get it to work with IE5.5. I am trying to read an Acrobat created PDF file that I uploaded into my MySQL database. The problem occurs when I print the data via IE5.5. All I get is echoing of the binary to the browser. Any ideas or suggestions? /dkm -- 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]
RE: [PHP] Optional Parameter ?
You can give $maybe3 a default value which will be used if it is not passed in the function call. You can only do this for the last parameter in the function. function print_this ($value1, $value2, $maybe3=false) { do whatever if ($maybe != false) do whatever with $maybe } -Stewart -Original Message- From: Jack Sasportas [mailto:[EMAIL PROTECTED]] Sent: 21 March 2001 08:42 To: php Subject: [PHP] Optional Parameter ? Is it possible to have a function that looks something like function print_this( $value1, $value2, $maybe3) { do whatever; } that would expect $value1, $value2 BUT would not care if $maybe3 came in or not ? and not give an error message that there is a missing paramter ? I know I can do a condition within the function, but just want to see if there is a more technical approach as in from php to ignore that optional per say variable. I did look in my PHP book by wrox, but no luck. Thanks !!! -- 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]
RE: [PHP] Finding every even 100
If the number divided by 100 hundred has no remainder e.g. if (($num % 100) == 0) even_100 = true; -Stewart -Original Message- From: Nicklas af Ekenstam [mailto:[EMAIL PROTECTED]] Sent: 21 March 2001 09:38 To: [EMAIL PROTECTED] Subject: [PHP] Finding every even 100 Hi Propably a really simple question, but my math skills are not up to speed anymore: How do I find out if an int is an even 100? I.e. 100, 200, 1200, 9900 etc. I could always divide by 100 and have a look at the result and se if it has any decimals but I'm guessing this could be done prettier using modulus. Right? - Nille -- 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]
RE: [PHP] Post -vs- Get
It would be better to use randomly generated strings for your client ids e.g. md5(uniqid(rand())); This would be must harder for another use to guess. Even better would be to store your users details in a session variable so that the id will never appear in the url at all. e.g. a very basic example. session_name("YOURSESSIONID") session_start(); authenticate etc.. and read user details into $user array/object; session_register($user); then as long as your using the same browser session and you have session_name("YOURSESSIONID"); session_start(); at the beginning of each page you can access $user. If you open a new window you can do something like abc.php?session_id=session_id() abc.php session_id($session_id); session_name("YOURSESSIONID"); session_start() and carry on using $user. -Stewart -Original Message- From: Jack Sasportas [mailto:[EMAIL PROTECTED]] Sent: 21 March 2001 10:02 To: php Subject: [PHP] Post -vs- Get I have written a system with authentication to gain access to individual data. Since I am using the post method the command line has something like abc.com?client_no=5 Now even though if that person emails you that url, you won't gain access to it bascause of authentication that is needed, what can happen is an authorized user could change the 5 in the url to 8, and then see the information that is there which belongs to client 8. Because of this I am thinking in this case I should be using the post method instead of the get method. Does anyone have a link to a doc that has a good example in both methods along with a good explanation so that I can make sure I understand what it's doing? Thanks for your help! Jack -- 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]
RE: [PHP] linking classes together
Your need to define $db as a property of your sessions class. e.g. class sessions { var $db; function sessions { $this->db = new mysql_connect; } function testprint() { $this->db->connect() } } $sess = new sessions; $sess-> testprint(); -Original Message- From: Tobias Talltorp [mailto:[EMAIL PROTECTED]] Sent: 21 March 2001 22:38 To: [EMAIL PROTECTED] Subject: [PHP] linking classes together I have two classes, one with mysql-connections and one with session-stuff. The session-class relies on the mysql to check if the user is registered and such. What is the proper way to connect/link these classes together? I got it working if I created a $db = new mysql_connect; in the function, but there are other functions that need to be able to connect to a database aswell. Putting the $db = new mysql_connect; in the constructor did not work. (See code below) // This works ---> class sessions function testprint() { $db = new mysql_connect; $db-> connect() } } $sess = new sessions; $sess-> testprint(); // This does not work --> class sessions { function sessions { $db = new mysql_connect; } function testprint() { $db-> connect() } } $sess = new sessions; $sess-> testprint(); Any thoughts? // Tobias -- 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]
RE: [PHP] please help with this simple problem
You need to copy the contents of the current file. Then recreate the file by writing the new message then writing back the original contents. e.g. $fname = basename($PHP_SELF). ".comment"; $fsize = filesize($fname); fp = fopen(basename($fname)); $data = fread($fp,fsize); fwrite($fp,$message); fwrite($fp,$data); fclose($fp); -Stewart -Original Message- From: adam [mailto:[EMAIL PROTECTED]] Sent: 22 March 2001 11:17 To: [EMAIL PROTECTED] Subject: [PHP] please help with this simple problem i am coding a simple script to post a text area into a file. it works, but it posts it at the bottom and i wanted to have it post to the top of the text already there.. here's a snip of the important part of the script: $fp = fopen (basename($PHP_SELF) . ".comment", "a"); fwrite ($fp, $message); fclose ($fp); } any help would be much appreciated -- 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]
RE: [PHP] multiple selection dropdown lists
You need to add '[]' to the selects name which informs php that the select field will have more than one value. Once your form has been submitted an array called $comboResultPlan will be available containing the selected options. -Stewart -Original Message- From: Angie Bauer [mailto:[EMAIL PROTECTED]] Sent: 22 March 2001 11:31 To: [EMAIL PROTECTED] Subject: [PHP] multiple selection dropdown lists Hi we've got a dropdown list from a select statement, after you choose an option from there it creates another dropdown list also from a select statement. We want to know how to be able to select multiple values from the 2nd one and send them through to the next page for display. Below are the two dropdown lists we have. _ > LIST OF MEDICAL AID SCHEMES FROM SEARCH: > > _ -- 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] please help with this simple problem
Sorry I missed "w+" from the fopen function $fname = basename($PHP_SELF). ".comment"; $fsize = filesize($fname); $fp = fopen(basename($fname),"w+"); <--- added "w+" $data = fread($fp,$fsize); fwrite($fp,$message); fwrite($fp,$data); fclose($fp) -Stewart -Original Message- From: adam [mailto:[EMAIL PROTECTED]] Sent: 22 March 2001 12:00 To: [EMAIL PROTECTED] Subject: Re: [PHP] please help with this simple problem i tryed it and it ended up having an error that was caused originally by a lack of a $ on the 3rd line variable... after i fixed that it said wrong perameter count for fopen() on the third line, and "Warning: Supplied argument is not a valid File-Handle resource" for the remaining lines below that in that block of code. i'm sorry, i'm kinda new to this : ( "Stewart Taylor" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > You need to copy the contents of the current file. > Then recreate the file by writing the new message then writing back the > original contents. > > e.g. > $fname = basename($PHP_SELF). ".comment"; > $fsize = filesize($fname); > fp = fopen(basename($fname)); > $data = fread($fp,fsize); > fwrite($fp,$message); > fwrite($fp,$data); > fclose($fp); > > -Stewart > > -Original Message- > From: adam [mailto:[EMAIL PROTECTED]] > Sent: 22 March 2001 11:17 > To: [EMAIL PROTECTED] > Subject: [PHP] please help with this simple problem > > > i am coding a simple script to post a text area into a file. it works, but > it posts it at the bottom and i wanted to have it post to the top of the > text already there.. > > here's a snip of the important part of the script: > > $fp = fopen (basename($PHP_SELF) . ".comment", "a"); > fwrite ($fp, $message); > fclose ($fp); > } > > any help would be much appreciated > > > > -- > 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 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]
RE: [PHP] Unwanted signs!
You can use the strip_tags function to remove HTML tags from the user inputted data e.g. $name = strip_tags($name) -Stewart -Original Message- From: Brian Rosenkrantz [mailto:[EMAIL PROTECTED]] Sent: 22 March 2001 15:50 To: [EMAIL PROTECTED] Subject: [PHP] Unwanted signs! I'm new to php (and from Denmark:-) and I've just made my first guestbook, but I don't want people to be able to write there name like this name How can I delete these signs? Please help!! -- 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]
RE: [PHP] sort multidimensional array?
Swap your indexes round i.e. $list[$r]["priority"] changes to $list["priority"][$r]; This, $list = array_multisort($list["priority"], SORT_NUMERIC, SORT_DESC); should work ok now. -Stewart. -Original Message- From: phpman [mailto:[EMAIL PROTECTED]] Sent: 28 March 2001 03:33 To: [EMAIL PROTECTED] Subject: Re: [PHP] sort multidimensional array? I'm still confused. I'm looking to sort the list[$r] part of the array based on what value $list[$r]["priority"] is. What would the function's arguments be? ""Stuart J. Browne"" <[EMAIL PROTECTED]> wrote in message 99rajk$i0v$[EMAIL PROTECTED]">news:99rajk$i0v$[EMAIL PROTECTED]... > > while ($row = mysql_fetch_array($results)) { > > $tmp = get_item_reorder_priority($row["item_sku"]); > > $list[$r]["priority"] = $tmp[0]; > > $list[$r]["sku"] = $row["item_sku"]; > > $r++; > >} > > > >$list = array_multisort($list["priority"], SORT_NUMERIC, SORT_DESC); > > > > and it returns this error: > > Warning: Argument 1 to array_multisort() is expected to be an array or a > > sort flag in d://www/inventory_specific.phtml on line 109 > > > > function get_item_reorder_priority() returns an array - with $tmp[0] > being > > an integer 1-5 > > $row["item_sku"] is simply a string. > > > Umm, dunno about anybody else but it appears as if you are missing a > dimension.. > > In the array creation: > > $list[$r]["priority"] > > is used.. emphasis on the [$r] part. > > When trying to re-order, you are using just $list["priority"]. missing the > [$r] dimension.. > > bkx > > > > -- > 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 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] split string value again
$addr = "[EMAIL PROTECTED]"; $splitaddr = explode("@",$addr); resulting in $splitaddr[0] = "test"; $splitaddr[1] = "foo.com"; -Stewart -Original Message- From: Jacky [mailto:[EMAIL PROTECTED]] Sent: 29 March 2001 23:52 To: [EMAIL PROTECTED] Subject: [PHP] split string value again Hi again have to try again after I have not recieved any advice, I have a vairable that stores email address value. I need to break it so that I will only get the dmain name bit to store in another variable so that I can redirect user to that domain, like if user email is [EMAIL PROTECTED] then I would like to break that and take only foo.com bit to use for navigation. How can I do that? Jack [EMAIL PROTECTED] "There is nothing more rewarding than reaching the goal you set for yourself" -- 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] Shell Programming with PHP, but where is the PHP?
Under linux you can use lynx to run php scripts under the shell. e.g. Assuming lynx is setup correctly lynx -source your.server.com/devel/newtrlkit/test.php?param=whatever>test.txt -Stewart -Original Message- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: 03 April 2001 17:02 To: PHP User Group Subject: RE: [PHP] Shell Programming with PHP, but where is the PHP? Hello, It is installed as a module, Is there a way I can keep it installed as a module but install it so I can use it to shell script also? Thanks Ahead Of Time Brandon -Original Message- From: Renze Munnik [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 03, 2001 8:32 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Shell Programming with PHP, but where is the PHP? Brandon Orther wrote: > > Hello, > > I am looking for the path to my php so I can put it on the top of my php > script. Like this: #!/path/to/php > > All I can find that looks like this is libphp4.so Does anyone know where to > look for the binary? > > 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] Try locate and/or whereis. And you should make sure PHP isn't installed as module. -- * R&zE: *** ** Renze Munnik ** ** E: [EMAIL PROTECTED] ** M: +31 6 218 111 43 *** -- 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 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] IF this then, move to this line...
You could use continue to skip to the start of a loop. e.g. while (1) { start of code you want to jump back too . . . if (so and so is true) continue; . . . . break; // exit loop } Unlike c php does not have a goto command. However what you describe does not sound like very good programming practice anyway. You should be able to arrange your code using functions etc so that you dont need this sort of goto method. -Stewart -Original Message- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: 05 April 2001 18:43 To: PHP User Group Subject: [PHP] IF this then, move to this line... Hello, Is there a way to make my script jump to a certain line in my code if a certain variable is true. like use an if then statement to check for a certain value, then if it is true jump back to line 34 (Any line really). 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] -- 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] putting a list of data into 3 columns?
Here is a basic (untested) example. $link = mysql_connect("localhost", "username", "password"); mysql_select_db("database", $link); $result = mysql_query("SELECT product_name FROM products", $link); $num_rows = mysql_num_rows($result); // read in data while ($row = mysql_fetch_array ($result)) { $products[] = $row["product_name"]; } // display data $num_display_rows = ceil($num_rows / 3) $indx = 0; while ($indx < $num_display_rows) { echo "{$products[$indx]}, {$products[$indx+$num_rows]}, {$products[$indx+$num_rows*2]}"; $indx++; } -Stewart -Original Message- From: DRN [mailto:[EMAIL PROTECTED]] Sent: 07 April 2001 19:55 To: [EMAIL PROTECTED] Subject: [PHP] putting a list of data into 3 columns? Hi, I would like to display a list of products from a MySQL database in 3 columns. as shown below: Product A Product D Product G Product B Product E Product H Product C Product F The problem I have is I don't know how many products there will be, so I can't just print out the first 3, start new column, print out next three, start new column, print out rest, end table. I presume I will have to count the number of results, then use this to wok out how many have to go in the first column etc. As I have only recently started using PHP / MySQL I am not sure how this should be done, has anybody done this (or something similar) so that I could look at the relevant code. Many thanks for your help, Donald -- 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]