[PHP] Re: using strcmp()
Anthony Ritter wrote: The following test script for the function strcmp() is from page 114 -115 of PHP (Hungry Minds). I'm getting a parse error on line 6. Using PHP 4.1.1 / MS Win 98 / Apache Server. Many thanks... Tony Ritter .. ? // using strcmp() $firstword=peach; $secondword=mango; $result=strcmp($firstword, $secondword) if ($result=1) { $statement=comes after; } else if ($result=-1) { $statement=comes before; } else { $statement=is the same as; } echo The word b$firstword/b $statement; ? You were missing a semicolon: $result=strcmp($firstword, $secondword); Justin Garrett -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Does PHP supports threads?
PHP does not support threading. Depending on what you're trying to do you may find the process control functions useful http://www.php.net/manual/en/ref.pcntl.php Justin Garrett C. F. Scheidecker Antunes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello all, I have a few scripts writen and I wonder if PHP does support threads like a Java Program. What I mean is, with Java I can have multiple threads of tasks running at the same time and I would like to know if I could accomplish the same with PHP although the books I have and the documentation do not seem to answer me this question. Does anyone know anything about it? This is a though question. Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: line number
http://www.php.net/manual/en/language.constants.predefined.php Justin Garrett Jacob R Chandler [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] What function can I use to find out the current line number? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problems with SQL queries in PHP script
http://www.php.net/manual/en/function.addslashes.php Justin Garrett Mike Hilty [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, I am running into an issue where when a user inputs an apostrophie ' into the textarea section of my form, it will generate an error in the SQL statement. I have narrowed down the issue to this snippet of code: $insertQuery = INSERT INTO changeLog(vendorNumber, newVendorNumber, oldName, newName, changedBy, dateChanged, comments) VALUES('$vendorNumber','$newVendorNumber','$oldName','$newName','$changedBy' ,'$dateChanged','$comments'); The thing that is causing this issue is the use of apostrophies to designate my variables in the SQL query. How do I rewrite this to avoid this issue? Thanks, Mike Hilty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: question about quote and double-quoted strings
http://www.php.net/manual/en/language.types.string.php Just the way ' and are defined. understands more escape sequences then '. Justin Garrett Duncan [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, i am just adding some mail() functions to my script and had to realize, that this: $email_from = 'From: [EMAIL PROTECTED]\r\nReply-To: [EMAIL PROTECTED]\r\n'; mail($_POST['email'],'Your account details','You can login with your account details\r\nusername: '.$_POST['username'].'\npassword: '.$_POST['password'].'\n\nhere: http:///index.php',$email_from); will make the email include the \r\n instead of adding a line feed, but this works just fine: $email_from = From: [EMAIL PROTECTED]\r\nReply-To: [EMAIL PROTECTED]\r\n; mail($_POST['email'],'Your account details',You can login with your account details\r\nusername: .$_POST['username'].\npassword: .$_POST['password'].\n\nhere: http:///index.php,$email_from); Why is there this difference in the normal- double-quoted string, i though it would only affect included variables, where one shows them and the other would need them to be added via '.' ? ...just curious :) Regards, Duncan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Data Structures
You'd create a linked list in PHP just like you would in most languages, however IMHO it's best just to stick with PHP arrays. They grow dynamically and are so easy to work with. There is an ADT extension scheduled for PHP5 http://www.php.net/~sterling/adt/ Justin Garrett Laborda [EMAIL PROTECTED] wrote in message 007501c2cfed$777f1090$ad629c40@galaxy">news:007501c2cfed$777f1090$ad629c40@galaxy... Hello, Does anyone know where can I find information about data structures implemented in PHP. I need to find something about Linked Lists, implemented in PHP.. If anyone has any info, I'd appreciate it. I've tried to google it out but I can't find anything. Thanks. Laborda.- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Class Interfaces
Nope. You're stuck with straight single inheritance for now. Justin Garrett Laborda [EMAIL PROTECTED] wrote in message 005201c2cfe9$47c704b0$ad629c40@galaxy">news:005201c2cfe9$47c704b0$ad629c40@galaxy... Hello, I have a question.. Does PHP have support for Class Interfaces declaration? What in Java would be: public interface MyInterface { final String aString = Str; final String oString = String; void aFunction(String inter, double face); } ? If not, how can I do this?.. Thanks a lot. Laborda.- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mysql auto increment question
http://www.php.net/manual/en/function.mysql-insert-id.php Justin Garrett Van Andel [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] m... I have an application that updates two MySQL database tables. One table has an auto_increment id field. I need to use this id to link to an entry in the other table. Is there an easy way to find out what the auto_incremented number is so I can use it to update the other table? Robbert van Andel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: instantiating objects
http://www.php.net/manual/en/language.references.php http://www.php.net/manual/en/language.oop.php Examples 1 and 4 are equivalent Example 2 assigns a reference of the new object to $form Example 3 assigns the value from the DB class method connect() to $dbh (could be an object or some other value) Example 5 is the same as 3 except that it assigns a reference of the value returned from the Mail class method factory() to $mail_object. Justin Garrett Beau Hartshorne [EMAIL PROTECTED] wrote in message 01c2ce00$d19797d0$6401a8c0@laptop">news:01c2ce00$d19797d0$6401a8c0@laptop... I'm just starting to use PEAR, and have seen several ways of instantiating the PEAR objects: $form = new HTML_QuickForm(); $form = new HTML_QuickForm(); $dbh = DB:connect(dsn); $dbh = new DB(); $mail_object = Mail::factory('sendmail', $params); Can anyone explain (or point to dome docs that explain) what the differences are, and when I should be using which method to work with PEAR objects? Thank you, Beau -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: passing variables and functions between a base class and subclass
?php class base { var $a; function hello(){ echo hello; } } class sub extends base { function hi(){ $this-a = hi; $this-hello(); } } $foo = new sub; $foo-hi(); echo $foo-a; ? Justin Garrett Electroteque [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... hi there sorry about the long subject , but i have not mastered yet how to pass funtcions and variables between a base and subclass , i cant seem to access variables properly between the bass class and subclass and functions from the subclass in the base class ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Include directoive on PHP.
Edit php.ini and add the pear directory to your include_path or use ini_set to set your include_path in your script: http://www.php.net/manual/en/function.ini-set.php Justin Garrett Harring Figueiredo [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I would like to include some of the files ( tabel.php, etc ) from PEAR on my scripts - Do I have to hardcode the installation path ? or is there a directive that tells the preprocessor to look on the right place (Like in c)? Thanks in advance. HArring __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php headers already sent error.
http://www.php.net/manual/en/faq.using.php#faq.using.headers-sent Justin Garrett Chris Winters [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Im SO CLOSE! Welll to start I had everything running FINE (MySQL, Apache, and PHP) until I installed STUPID Zend Studio for PHP. After their 30 day trial expired, I uninstalled it and everything just went downhill. After re installing everything, I have these errors left over. Now the code is already on production server running (but with Linux). Im on a win2K box (dont laugh)- BUT before it worked. I have no idea what this means since Im new to apache and PHP installs. Thanks for any help in for what to check Notice: Constant false already defined in c:\www\html\defines.php on line 4 Notice: Constant true already defined in c:\www\html\defines.php on line 5 Warning: Cannot add header information - headers already sent by (output started at c:\www\html\defines.php:4) in c:\www\html\index.php on line 9 Warning: Cannot send session cookie - headers already sent by (output started at c:\www\html\defines.php:4) in c:\www\html\index.php on line 89 Warning: Cannot send session cache limiter - headers already sent (output started at c:\www\html\defines.php:4) in c:\www\html\index.php on line 89 Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: OOP confused
class one{ var $prev; } class two{ var $head; function two(){ $this-head = new one(); $this-head-prev = NULL; } } Change prev which is in head which is in this to NULL. Justin Garrett Michael P. Carel [EMAIL PROTECTED] wrote in message 004001c2cd77$6af2e220$[EMAIL PROTECTED]">news:004001c2cd77$6af2e220$[EMAIL PROTECTED]... Hi to all; Just a little question about OOP. I'm just confused with the symbol '-' . In the article that i've red : #this reads change the value of the variable $head within this class to black $this-head=black #how do i read this line $this-head-prev=NULL I'm just confused with this line, i can't translate the class file that i'm using. Thanks in advance. mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: New as of today
Look at fgets and explode. Depending on the format of your txt file you can use a combination of fgets and explode to get your desired results. http://www.php.net/manual/en/function.fgets.php http://www.php.net/manual/en/function.explode.php If each picture name is on a separate line then the following will work: while (!feof($zFile)){ $buffer = fgets($zFile, 4096); echo a href=test.php$buffer/abr; } Justin Garrett Stu9820 [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Im new to PHP (came from ASP). I'm trying to make pictures (.jpgs) come out of a folder and display on a page. Here is my code so far: ?php $fileLoc = Bid2002/pictures.txt; $zFile = fopen($fileLoc, r); $zContents = fread($zFile, filesize($fileLoc)); fclose($zFile); echo a href=test.php$zContentsbr/a; ? I dont have database support on the server i use (school server). I have all the picture names in a text file and i want to pull out the name of pictures from the text file and make it pull out of the picture folder. Is there an easier way to do this? Or is this the best way. ASP is very because you can loop through the file and I thought I could do it with php but it ends up in one big link. Thanks in advance. Jeff UWG Student [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: AOL problem with remote IP address
Yup, AOL's proxy servers do this. Justin Garrett Joseph Szobody [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... In a portion of a website, I have implemented user authentication and management using sessions. When a user first logs in, the $REMOTE_ADDR is stored is a session variable SESSION['ip']. On each of the protected pages, a header.php is included with the following code: if ($SESSION['ip'] != $REMOTE_ADDR){ header(Location: error.php?err=2); die; } As you can see, this is an attempt to see if someone is trying to hijack a session. The problem is, AOL doesn't like this. Whenever an AOL user logs into the website, the session starts successfully, but when the user goes to a protected page, he's redirected to error.php?err=2. For some reason, the IP address appears to be changing. Is this a known issue with AOL? Is the IP really changing from page to page? That seems weird. Any way around this, or must I stop using this security approach? Thanks, -- : Joseph Szobody : Computers are like airconditioners: They stop working properly if you open windows. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] AOL problem with remote IP address
AOL uses load balancing proxy servers which means every new page load could come from a different IP address. A quick google search brought up this article that mentions it: http://surfaid.dfw.ibm.com/web/home/whitepapers/weblog.html Read the section on 'Effects of Dynamically Changing IP addresses' Justin Garrett Justin French [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I haven't heard about address' changing midway through a session (ie, without reconnecting), but it's worth pointing out that there will be a few other reasons why this isn't a good idea: 1. if they have to reconnect, they're near guaranteed to have a new IP 2. with most big ISPs, all users may *appear* to have the same IP... so any of them could hijack the session? The only way to test if IPs ARE changing is to get/borrow an AOL account, and create a page which you can refresh 30 times over an hour, looking at the IP address' each time. That should confirm/deny the problem. But I wouldn't be relying on a remote IP for anything... they're too unreliable. Justin French on 29/08/02 7:29 AM, Joseph Szobody ([EMAIL PROTECTED]) wrote: In a portion of a website, I have implemented user authentication and management using sessions. When a user first logs in, the $REMOTE_ADDR is stored is a session variable SESSION['ip']. On each of the protected pages, a header.php is included with the following code: if ($SESSION['ip'] != $REMOTE_ADDR){ header(Location: error.php?err=2); die; } As you can see, this is an attempt to see if someone is trying to hijack a session. The problem is, AOL doesn't like this. Whenever an AOL user logs into the website, the session starts successfully, but when the user goes to a protected page, he's redirected to error.php?err=2. For some reason, the IP address appears to be changing. Is this a known issue with AOL? Is the IP really changing from page to page? That seems weird. Any way around this, or must I stop using this security approach? Thanks, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need example of Next 5
http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#SEL ECTSELECT * FROM table LIMIT 5,5; # Retrieve rows 6-10 SELECT * FORM table LIMIT 10,5; # Retrieve rows 11 - 15Justin GarrettPax [EMAIL PROTECTED] wrote in message 001901c24d49$e7830530$6401a8c0@pawel">news:001901c24d49$e7830530$6401a8c0@pawel... Hi, I am looking for an example in php/MySql dealing with Next 5 type of queries ..does anyone have any links? Thank you for your help Pax -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need example of Next 5
Let's try that again. SELECT * FROM table LIMIT 5,5; # get rows 6 - 10 SELECT * FROM table LIMIT 10,5 # get rows 11 - 15 Justin Garrett Hi, I am looking for an example in php/MySql dealing with Next 5 type of queries ..does anyone have any links? Thank you for your help Pax -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Only show certain files in directory
There are several regular expression and string matching functions you could use. http://www.php.net/manual/en/ref.strings.php http://www.php.net/manual/en/ref.pcre.php http://www.php.net/manual/en/ref.regex.php Justin Garrett [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am showing a directory of files and I don't what all the files to show on the screen. I was able to get the . and the .. not to show with what I have below but there are some other files in there that look like this mylist.confg. I don't want them to show in the directory list. I tried $files != *.config but this did not work . Anybody have an suggestions if ($handle = opendir('/path/to/list/directory')) { while (false !== ($files = readdir($handle))) { if ($files != . $files != ..) { echo $files; } -- Best regards, rdkurth mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: yesterday's day of week
Get the current timestamp and subtract a day's worth of seconds. date('D', time() - 24 * 60 * 60); Justin Kenton Letkeman [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have been able to get yesterdays date eg. $yesterday = date('d')-1; result is 17 but am having trouble getting yesterdays day of the week. eg. $yesterday = date('D')-1; result is -1 eg. $yesterday = date('l')-1; result is -1 Is there something I am missing? I cannot find the documentation on this. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Upgraded to PHP 4.2.2 and completely lost all GET and POST variables
http://www.php.net/ChangeLog-4.php As of version 4.2 register_globals defaults to off. You can turn it on in your php.ini file, but it is recommended to use the new super global arrays instead. Justin James Daily [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... RE: phpsecurityadmin-2002-07-24.zip and PHP 4.2.2 PLATFORM: win 98 BACKGROUND: in order to use the above classes i had to upgrade to PHP 4.2.2 PROBLEM: when i upgraded to 4.2.2, all my old scripts lost the GET or POST info being passed. COMMENTS: everything except the phpsecurityadmin classes worked as expected under PHP 4.0. after upgrade, phpsecurityadmin classes work but any old scripts that are accepting data from previous page via GET or POST do not. i can manually parse the GET query string, but this is foolish and time consuming. it's as if the automatic variables are not getting assigned the data being passed. QUESTION: has anybody else run across this and what was the resolution? - James Daily Phone : 816 943 9891 Email : [EMAIL PROTECTED] (or hit reply button) Web : http://tellmama.com/ Philosophy: 4 2 1000 ( cos(ø - r) - sin ø ) * ( r - 2r cos(2ø + 2.4) + 0.9) + 0.62r) 0 Education is a progressive discovery of our own ignorance. Will Durant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: !== (was Re: [PHP] how many files are in a directory)
Here is an example that might help. $a = 1; if($a) echo '1'; if($a == true) echo '2'; if($a === true) echo '3'; The first and second conditional statements execute but the third doesn't. This is because $a evaluates to true but is not of type 'boolean'. === and !== not only compare value but type as well. Justin Garrett Chris Boget [EMAIL PROTECTED] wrote in message 07bb01c243c2$1b3045a0$8c01a8c0@ENTROPY">news:07bb01c243c2$1b3045a0$8c01a8c0@ENTROPY... // Note that !== did not exist until 4.0.0-RC2 I took a quick look at the docs to find out what !== meant (because I'd never seen it before). I'm not sure I understand what it's use is. Could someone explain why you would use it and for what purpose? I couldn't really infer from the example that was included in the previous message. thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ClibPDF
http://www.php.net/manual/en/install.configure.php --with-cpdflib[=DIR] Include cpdflib support (requires cpdflib = 2). DIR is the cpdfllib install directory, defaults to /usr. Justin Garrett Don [EMAIL PROTECTED] wrote in message news:000c01c1c3d5$03b92440$[EMAIL PROTECTED]; Does any one know how I use ClibPDF with PHP? I assume I have to recompile PHP with a switch but I can't find anyting in the docs. Thanks, Don -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Using strings in switches
Try it. But to answer your question, yes. Don't forget to put quotes around your strings in the case statements. switch($name){ case beesly: break; } Phantom [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... The manual shows that you can use switches with numeric values but is it also possible to use strings? Is this possible? If not, what can I do? Just a bunch of if statements? ? if (isset($Name)) { switch ($Name) case Homer Simpson: echo DO'Hp; break; case Fred Flinstone: echo Yabba Dabba Dop; break; default: echo Do not know youp; break; } } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] relative path vs. INCLUDE() !!!!!
There is also include_path in the php.ini file. Bogdan Stancescu [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... This is a kind of a shit happens answer -- ummm... nope, there's no workaround. The only workaround is providing a global path variable and use that for all pages, but you probably already thought about that. Sorry for the bad news on Christmas! :-) Bogdan Arcadius A. wrote: Hello ! I've just made a nice navavigation bar for my website -- 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: How to use Clibpdf
Clibpdf is not complied by default as a Shared Object. Once you compile it in you should just be able to use it. -- Justin Carlo loiudice [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I'm trying to install Clibpdf, but when I compile the source code, It doesn't seem to be a .so library. So when I say in php.ini to load the extension, it give me an error. Ciao __ Abbonati a Yahoo! ADSL con Atlanet! Naviga su Internet ad alta velocità, e senza limiti di tempo! Avrai sempre il telefono libero e non dovrai pagare il traffico telefonico per collegarti a Internet. Per saperne di più vai alla pagina http://adsl.yahoo.it -- 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: Problem redirecting
From the manual: Remember that the header() function must be called before any actual output is sent, either by normal HTML tags blank lines in a file, or from PHP. This is the cause of your error. Something is sending output before your call to header(); -- Justin Garrett Don [EMAIL PROTECTED] wrote in message 000c01c15f67$1a06ad80$[EMAIL PROTECTED]">news:000c01c15f67$1a06ad80$[EMAIL PROTECTED]... Hi, I have a form which when submitted, calls an html page which contains PHP code. Within that code, I wish to redirect my users to another page under certain conditions. So, in my code, I have the following lines: Header( Location:http://www.mydomain.com/mypage.html;); exit; However, when the above is run, I get the following error generated: Warning: Cannot add header information - headers already sent by (output started at /usr/local/www/vhosts/mydomain.com/htdocs/mypage.html:7) in ../phpscript/general/formmail.php on line 100 Does anyone know what this error means? hanks, Don -- 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: cant redeclare class.....
Move include(class.jm_sms.php) outside of the loop. -- Justin Garrett Sagar [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, I'm using jm_sms class in mysql dowhile($myrow=mysql_fetch_array($result)) loop. the class is running fine for the first time. But when it is called for the second time i'm getting an error saying cant redeclare the class. How to make this class work within a loop. i'm attaching the files if u want to look inside. any help is highly appreciated. thanks, /sagar -- 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: how many day between the two time format
If both times are UNIX timestamps $seconds_per_day = 60 * 60 * 24; $dif = $today - $last_day; $days = (int)($dif / $seconds_per_day); -- Justin Garrett Yang [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... i want to check about how many day between the two time format like $last_day=time format; $today=time(); $between_day=?($today-$last_day); echo $between_day is the between day... -- 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: Troublesome complex fetching from database
Try the following to organize your results. You'll have to check the table names and typos etc. $sql = SELECT schooltypes.schooltypes, schools.schoolname, teachers.lastname, teachers.tuserid FROM schooltypes, schools, teachers, teachers_school WHERE schooltypes.typeid = schools.typeid AND schools.schoolid = teachers_schools.schoolid AND teacher_schools.tuserid = teachers.tuserid; $result = /* perform query */; while($row = mysql_fetch_object($result)){ $data[$row-schooltypes][$row-schoolname][] = $row-tuserid $row-lastname; } /* organize */ for(reset($data); $school_type = key($data); next($data)){ echo $school_typebrbr; $schools = $data[$school_type]; for(reset($schools); $school_name = key($schools); next($schools)){ echo $school_namebrbr; $teachers = $data[$school_type][$school_name]; $count = count($teachers); for($i = 0; $i $count; $i++){ echo $teachers[$i]br; } } } -- Justin Garrett Kath [EMAIL PROTECTED] wrote in message 002601c149f3$7dec4000$[EMAIL PROTECTED]">news:002601c149f3$7dec4000$[EMAIL PROTECTED]... Quite an interesting quandry I have. What I have is this: Table schooltypes: (typeid is a unique# iding the type, schooltypes is the type of school, say Elementary School or High School) | typeid | schooltypes | Table schools: (typeid is the type the school falls under, schoolid is the unique# iding the school, schoolname is the general name like Park Shore High School) | typeid | schoolid | schoolname | Table teachers: (tuserid is their unique id, salutation is the Mr/Mrs/Miss/Ms/Dr, last name is well, duh :)) | tuserid | salutation | last name | Table teachers_schools: (tuserid is the teacher's id, next to the school they are assigned to. Note the possiblity for a teacher assigned to more than one school (hello, cutbacks and skeleton budgets)). | tuserid | schoolid | What I need to be able to do is list all this information as such: School type: + School 1 - Teacher and their Teacher ID - Teacher and their Teacher ID + School 2 - Teacher and their Teacher ID - Teacher and their Teacher ID - Teacher and their Teacher ID + School 3 - Teacher and their Teacher ID - Teacher and their Teacher ID Another School Type: + School 5 - Teacher and their Teacher ID - Teacher and their Teacher ID + School 7 - Teacher and their Teacher ID - Teacher and their Teacher ID Currently, I AM able to list the school type and the school correctly. However, when I come to listing the teachers in the school, every teacher is listed under every school, some more than one time. Any ideas/code snips on how to do this? In what direction should be I solving this? Going from type-school-teachers assigned-teacher info? Or teachers assigned-teacher info-schools-type? Right now I am doing the first, sorta. - k -- 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: displaying certain columns
$result = mysql_db_query($dname, $sql); $row = mysql_fetch_object($result); echo $row-field_name; -- Justin Garrett Melih Onvural [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... i have a database and it randomly selects one piece of data from a table of quotes, but it will only print the quote when I include the row that it's picked with. I have my SELECT statement at $sql = SELECT $dbrow FROM $dbtable ORDER BY RAND() LIMIT 1; and then to display the result $result = mysql_db_query($dbname, $sql) then in the code, print td $result /td; what do i need to add? (the result is Resource id #3) thank you, Melih -- 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: Making variable global / accessing variable
Maybe something similar to this? function test($td){ $global = global \$$td._error, \$$td._ok;; eval($global); $set = \$$td._error = \ERROR\; \$$td._ok = \OK\;; eval($set); } test(foo); echo $foo_error $foo_ok; -- Justin Garrett Martin [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello! How can I make a variable, which name I give to a function, global in this function? I want to make something like: function MyFunc($sVarName) {GLOBAL [$sVarName]_error, $sVarName_ok; } So if $sVarName = sHello, I want to access $sHello_error and $sHello_ok in this function. Any idea how I can make this variable gloabl and whats the easyst way to access this var then? Martin -- 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: Making variable global / accessing variable
But how would you use this to create new global variables with $td as the prefix? $td = foo; then we want new global variables $foo_error and $foo_ok created. -- Justin Garrett Jason G. [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... function MyFunction($td) { global $$td; echo $$td; // echos 3 $$td = 5; } $billybob = 3; MyFunction(billybob); file://Now $billybob = 5 -Jason Garber IonZoft.com At 10:25 PM 9/30/2001 -0400, you wrote: I have used: global $$td; in the past with success... -Jason Garber IonZoft.com At 07:38 PM 9/30/2001 -0700, Justin Garrett wrote: Maybe something similar to this? function test($td){ $global = global \$$td._error, \$$td._ok;; eval($global); $set = \$$td._error = \ERROR\; \$$td._ok = \OK\;; eval($set); } test(foo); echo $foo_error $foo_ok; -- Justin Garrett Martin [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello! How can I make a variable, which name I give to a function, global in this function? I want to make something like: function MyFunc($sVarName) {GLOBAL [$sVarName]_error, $sVarName_ok; } So if $sVarName = sHello, I want to access $sHello_error and $sHello_ok in this function. Any idea how I can make this variable gloabl and whats the easyst way to access this var then? Martin -- 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] At 10:25 PM 9/30/2001 -0400, Jason G. wrote: I have used: global $$td; in the past with success... -Jason Garber IonZoft.com At 07:38 PM 9/30/2001 -0700, Justin Garrett wrote: Maybe something similar to this? function test($td){ $global = global \$$td._error, \$$td._ok;; eval($global); $set = \$$td._error = \ERROR\; \$$td._ok = \OK\;; eval($set); } test(foo); echo $foo_error $foo_ok; -- Justin Garrett Martin [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello! How can I make a variable, which name I give to a function, global in this function? I want to make something like: function MyFunc($sVarName) {GLOBAL [$sVarName]_error, $sVarName_ok; } So if $sVarName = sHello, I want to access $sHello_error and $sHello_ok in this function. Any idea how I can make this variable gloabl and whats the easyst way to access this var then? Martin -- 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]