[PHP] File array mailing Loop problem. Help needed urgently
Hello I do have the following problem I read a file line by line into an array I use to email address ( a value of the line) to email each client with custom information from this file what I read into the buffer. The script is working everything is send the way I wish, the only problem is that the 200 user would see all 199 useres email addresses before him .. and so on each member Member 800 sees 799 emails in the email as well 799 times the from address big problem. I want to send each email in single loop ? so that each client gets only one email address to see and my whole doing is not a security risk Here is my code I use can somebody help me out to show me a way where I prevent the above from happening: $fp = fopen ("data/default2.users", "r"); while (!feof ($fp)) { $buffer = fgets($fp, 4096); list ($User, $UserN, $Pass, $Date, $Realf, $RealL, $Email, $Street, $City, $State, $Postal, $Country, $Phone, $Webaddress, $ex1, $ex2, $ex3, $ex4, $ex53, $ex7 ) = split ("\|", $buffer); $myname = "browseabit"; $myemail = "[EMAIL PROTECTED]; $myreplyemail = "[EMAIL PROTECTED]"; $contactname = "$Realf"; $contactemail = "$Email"; $message = "Dear $Realf $RealL . message text here"; $subject = "Subject Text here"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: ".$myname." <".$myemail.">\r\n"; $headers .= "To: ".$contactname." <".$contactemail.">\r\n"; $headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n"; $headers .= "X-Priority: 1\r\n"; $headers .= "X-MSMail-Priority: High\r\n"; $headers .= "X-Mailer: Server Text here"; mail($contactemail, $subject, $message, $headers); echo " Mail has been send to $Realf $RealL "; } fclose ($fp);
Re: [PHP] File array mailing What to do
I do not use any loop comand yet how come I have all email addresses from the data file in the TO: line but each email is send with unique information to the client, only TO and From: line is filled with all the values from the data file. What do I do ? I hope I explain my self good enough can you help me a bit with the code ? message text here ... use of above arrays . "; $subject = "Subject text here"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: ".$myname." <".$myemail.">\r\n"; $headers .= "To: ".$contactname." <".$contactemail.">\r\n"; $headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n"; $headers .= "X-Priority: 1\r\n"; $headers .= "X-MSMail-Priority: High\r\n"; $headers .= "X-Mailer: Server here"; mail($contactemail, $subject, $message, $headers); echo " mail to $Realf $RealL done ... "; } fclose ($fp); ?> - Original Message - From: John W. Holmes <[EMAIL PROTECTED]> To: 'WebDev' <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Sunday, March 02, 2003 7:23 PM Subject: RE: [PHP] File array mailing Loop problem. Help needed urgently > [snip] > > The script is working everything is send the way I wish, the only > problem > > is > > that the 200 user would see all 199 useres email addresses before him > .. > > and so on each member Member 800 sees 799 emails in the email as well > 799 > > times the from address big problem. > > > > I want to send each email in single loop ? so that each client gets > only > > one email address to see and my whole doing is not a security risk > [snip] > > $headers .= "MIME-Version: 1.0\r\n"; > > $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; > > $headers .= "From: ".$myname." <".$myemail.">\r\n"; > > $headers .= "To: ".$contactname." <".$contactemail.">\r\n"; > > $headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n"; > > $headers .= "X-Priority: 1\r\n"; > > $headers .= "X-MSMail-Priority: High\r\n"; > > $headers .= "X-Mailer: Server Text here"; > > > > mail($contactemail, $subject, $message, $headers); > > You're constantly building up $headers with each loop. You're first line > should be > > $headers = "MIME-Version: 1.0\r\n"; > > so that it starts from an empty string and adds the rest. Or, clear > $headers after you call mail(), so the next loop starts with an empty > variable. > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File array mailing list
well i can not do it I turned the code up side down put the header tags above like u sugested but still dosnt work I see your point that it is in a growing loop /but I am not so good yet in php to fix the code my self to do it in a better way I looked online ??? Does nobody has a data file like mine with name and email addreses and info in and uses the data to mail his clients all at ones??? Please if it that is easy for you can u help me out ? - Original Message - From: John W. Holmes <[EMAIL PROTECTED]> To: 'WebDev' <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Sunday, March 02, 2003 7:50 PM Subject: RE: [PHP] File array mailing What to do > > I do not use any loop comand yet > > Yes you do. You have a while() loop. > > > how come I have all email addresses from the data file in the TO: line > > but each email is send with unique information to the client, > > Because that info is the result of one split() call, but you're building > up headers with continuous data each time you loop through the lines of > the file. > > > only TO and From: line is filled with all the values from the data > file. > > What do I do ? > > I hope I explain my self good enough can you help me a bit with the > code ? > > Just try as I suggested and use > > $headers = "MIME-Version: 1.0\r\n"; > > as your first line of building headers. > > ---John Holmes... > > > > > > $fp = fopen ("data/default2.users", "r"); > > while (!feof ($fp)) { > > $buffer = fgets($fp, 4096); > > list ($User, $UserN, $Pass, $Date, $Realf, $RealL, $Email, > $Street, > > $City, $State, $Postal, $Country, $Phone, $Webaddress, $ex1, $ex2, > $ex3, > > $ex4, $ex53, $ex7 ) = split ("\|", $buffer); > > > > $myname = "name text "; > > $myemail = "[EMAIL PROTECTED]; > > $myreplyemail = "[EMAIL PROTECTED]"; > > $contactname = "$Realf $RealL"; > > $contactemail = "$Email"; > > > > $message = "Dear $Realf $RealL message text here ... use of > above > > arrays . "; > > > > $subject = "Subject text here"; > > > > $headers .= "MIME-Version: 1.0\r\n"; > > $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; > > $headers .= "From: ".$myname." <".$myemail.">\r\n"; > > $headers .= "To: ".$contactname." <".$contactemail.">\r\n"; > > $headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n"; > > $headers .= "X-Priority: 1\r\n"; > > $headers .= "X-MSMail-Priority: High\r\n"; > > $headers .= "X-Mailer: Server here"; > > mail($contactemail, $subject, $message, $headers); > > echo " mail to > $Realf > > $RealL done ... "; > > } > > fclose ($fp); > > > > ?> > > > > > > > > > > - Original Message - > > From: John W. Holmes <[EMAIL PROTECTED]> > > To: 'WebDev' <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > Sent: Sunday, March 02, 2003 7:23 PM > > Subject: RE: [PHP] File array mailing Loop problem. Help needed > urgently > > > > > > > [snip] > > > > The script is working everything is send the way I wish, the only > > > problem > > > > is > > > > that the 200 user would see all 199 useres email addresses before > him > > > .. > > > > and so on each member Member 800 sees 799 emails in the email as > well > > > 799 > > > > times the from address big problem. > > > > > > > > I want to send each email in single loop ? so that each client > gets > > > only > > > > one email address to see and my whole doing is not a security risk > > > [snip] > > > > $headers .= "MIME-Version: 1.0\r\n"; > > > > $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; > > > > $headers .= "From: ".$myname." <".$myemail.">\r\n"; > > > > $headers .= "To: ".$contactname." <".$contactemail.">\r\n"; > > > > $headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n"; > > > > $headers .= "X-Priority: 1\r\n"; > > > > $headers .= "X-MSMail-Priority: High\r\n"; > > > > $headers .= "X-Mailer: Server Text here"; > > > > > > > > mail($contactemail, $subject, $message, $headers); > > > > > > You're constantly building up $headers with each loop. You're first > line > > > should be > > > > > > $headers = "MIME-Version: 1.0\r\n"; > > > > > > so that it starts from an empty string and adds the rest. Or, clear > > > $headers after you call mail(), so the next loop starts with an > empty > > > variable. > > > > > > ---John W. Holmes... > > > > > > PHP Architect - A monthly magazine for PHP Professionals. Get your > copy > > > today. http://www.phparch.com/ > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File array mailing list pharse error
Hello again I worked on it so long now I have to come back to you it gives me an Parse error: Parse error: parse error, expecting `'('' in members_read_send.php on line 5 Iam so sorry to bug u so much but can u help me finish here please? \r\n"; $headers .= "To: ".$contactname." <".$contactemail.">\r\n"; $headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n"; $headers .= "X-Priority: 1\r\n"; $headers .= "X-MSMail-Priority: High\r\n"; $headers .= "X-Mailer: browseabit"; mail($contactemail, $subject, $message, $headers); echo "Memmber $Realf $RealL from $City $State $Country is been notified... "; } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] working with file and mail
Hello all I hat some help last night from John Holmes but I am still stuck with even more option in the code My Problem: I have a text data file of users I wish to email all with custom information from the file, each line represents a user with 21 seperated datafields ( serperator "|" ) ... User|UserN|UserL|Pass|Email|Country|etc..|etrc..|| etc.|| ... The following code makes the loop a security risk well User 100 sees 99 email address \r\n"; $headers .= "To: ".$contactname." <".$contactemail.">\r\n"; $headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n"; $headers .= "X-Priority: 1\r\n"; $headers .= "X-MSMail-Priority: High\r\n"; $headers .= "X-Mailer: Server mail($contactemail, $subject, $message, $headers); echo " mail to $Realf $RealL done ... "; } fclose ($fp); ?> Can somebody please help me with the script ?
Re: [PHP] working with file and mail
I just got it working with this following code and again the problem the first person in the list gets a perfect email, 2 person will see the first person emailed in the list and so on the third sees the 2 and 1 I got 1000 entries in the file and it is unexceptable to let person nr. 800 see 799 reply addresses ! Text here."; $subject = "Subject here"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: ".$myname." <".$myemail.">\r\n"; $headers .= "To: ".$contactname." <".$contactemail.">\r\n"; $headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n"; $headers .= "X-Priority: 1\r\n"; $headers .= "X-MSMail-Priority: High\r\n"; $headers .= "X-Mailer: Server"; mail($contactemail, $subject, $message, $headers); echo " Sendit mail to $Realf $RealL done ... "; } ?> what is now wrong ? Thank you very much for any input > Impossible. The list() = split() construct will initialize any variables > that do not contain values so it cannot possibly be a security risk. User > 100 cannot possibly see user 99's email address unless user 99's email > address is on line 100. If you want to be absolutely certain then > initialize your variables before you split the line. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] working with file and mail
Ok I got it figuered please do not reply to this subject anymore Thank you all who helped - Original Message - From: Kevin Stone <[EMAIL PROTECTED]> To: WebDev <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, March 03, 2003 1:56 PM Subject: Re: [PHP] working with file and mail > Impossible. The list() = split() construct will initialize any variables > that do not contain values so it cannot possibly be a security risk. User > 100 cannot possibly see user 99's email address unless user 99's email > address is on line 100. If you want to be absolutely certain then > initialize your variables before you split the line. > > - Kevin > > - Original Message - > From: "WebDev" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, March 03, 2003 5:29 PM > Subject: [PHP] working with file and mail > > > Hello all > I hat some help last night from John Holmes but I am still stuck with even > more option in the code > > My Problem: > > I have a text data file of users I wish to email all with custom information > from the file, each line represents a user with 21 seperated datafields ( > serperator "|" ) > > ... > User|UserN|UserL|Pass|Email|Country|etc..|etrc..|| etc.|| > ... > > The following code makes the loop a security risk well User 100 sees 99 > email address > > $fp = fopen ("data/default2.users", "r"); > while (!feof ($fp)) { > $buffer = fgets($fp, 4096); > list ($User, $UserN, $Pass, $Date, $Realf, $RealL, $Email, $Street, > $City, $State, $Postal, $Country, $Phone, $Webaddress, $ex1, $ex2, $ex3, > $ex4, $ex53, $ex7 ) = split ("\|", $buffer); > > $myname = "browseabit"; > $myemail = "[EMAIL PROTECTED]"; > $contactname = "$Realf $RealL"; > $contactemail = "$Email"; > > $message = "Dear $Realf $RealL message "; > > $subject = "Subject text here"; > > $headers = "MIME-Version: 1.0\r\n"; > $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; > $headers .= "From: ".$myname." <".$myemail.">\r\n"; > $headers .= "To: ".$contactname." <".$contactemail.">\r\n"; > $headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n"; > $headers .= "X-Priority: 1\r\n"; > $headers .= "X-MSMail-Priority: High\r\n"; > $headers .= "X-Mailer: Server > > mail($contactemail, $subject, $message, $headers); > > echo " mail to $Realf > $RealL done ... "; > } > fclose ($fp); > > ?> > > > Can somebody please help me with the script ? > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] pharse file random work with -n lines
how can you return this randomized? how can I get every time I call this function a random set of lines ? Working Code to read 10 first lines and split the individual line into info careeners and do something with it $i = 0; $fp = fopen ("../../../../../public/httpd/html/datacontainer/data/storage.data", "r"); while (!feof ($fp) && $i < 10) { $i++; $buffer = fgets($fp, 4096); list ($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split ("\|", $buffer); \\ do something } fclose ($fp);
Re: [PHP] pharse file random work with -n lines
the last script gives me no error but it returns nothing on the page only empty - Original Message - From: Marek Kilimajer <[EMAIL PROTECTED]> To: WebDev <[EMAIL PROTECTED]> Sent: Tuesday, March 04, 2003 9:11 AM Subject: Re: [PHP] pharse file random work with -n lines > You don't need to use fgets after the while loop (you are at the end of > the file), $rand_array will contain your desired random rows: > > $i = 0; > $fp = fopen ("../../../../../home/httpd/html/Classifieds/data/ads.data", > "r"); > while($tmp= fgetcsv($fp,5,"\|")) { $array[]=$tmp; } > fclose ($fp); > $rand_array=array_rand($array, 10); > > foreach($rand_array as $line) { > list ($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, > $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, > $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, > $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, > $dreidrei, $dreivier, $dreifunf, $dreisechs ) = $line; > > echo " href=\"http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session > _key=&search_and_display_db_button=on&db_id=$adnr&query=retrieval\" > target=\"_blanko\">$Endzwei $End3"; > } > > ?> > > > > WebDev wrote: > > >Parse error: parse error in > >/home/virtual/browse/home/httpd/html/Classifieds/infobox.php on line 9 > > > > > > >$i = 0; > >$fp = fopen ("../../../../../home/httpd/html/Classifieds/data/ads.data", > >"r"); > >while($tmp= fgetcsv($fp,5,"\|")) { $array[]=$tmp; } > >$rand_array=array_rand($array, 10); > >$buffer = fgets($fp, 4096); > >list ($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, > >$usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, > >$ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, > >$Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, > >$dreidrei, $dreivier, $dreifunf, $dreisechs ) = split ("\|", $buffer); > >echo " >href=\"http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?sessio n > >_key=&search_and_display_db_button=on&db_id=$adnr&query=retrieval\" > >target=\"_blanko\">$Endzwei $End3"; > >} > >fclose ($fp); > >?> > >- Original Message - > >From: Marek Kilimajer <[EMAIL PROTECTED]> > >To: WebDev <[EMAIL PROTECTED]>; PHP <[EMAIL PROTECTED]> > >Sent: Tuesday, March 04, 2003 8:25 AM > >Subject: Re: [PHP] pharse file random work with -n lines > > > > > > > > > >>Sorry, I forgot about the random part. Append the lines to an array, and > >>then use array_rand: > >> > >>while($tmp= fgetcsv($fp,5,"\|")) { $array[]=$tmp; } > >> > >>$rand_array=array_rand($array, 10); > >> > >> > >> > >>WebDev wrote: > >> > >> > >> > >>>Yes it works here only this way "\|" but I have not figuered it to > >>> > >>> > >return > > > > > >>>it random > >>>- Original Message - > >>>From: Marek Kilimajer <[EMAIL PROTECTED]> > >>>To: WebDev <[EMAIL PROTECTED]> > >>>Cc: <[EMAIL PROTECTED]> > >>>Sent: Tuesday, March 04, 2003 5:00 AM > >>>Subject: Re: [PHP] pharse file random work with -n lines > >>> > >>> > >>> > >>> > >>> > >>> > >>>>while(list ($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, > >>>> > >>>> > >>>> > >>>> > >>>$vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, > >>>$ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, > >>>$End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, > >>>$dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = fgetcsv > >>>($fp,5,"\|") { > >>> > >>> > >>> > >>> > >>>>// here you can do what you need to do > >>>> > >>>>} > >>>> > >>>> > >>>>are you sure you want "\|" and not "|"? > >>>> > >>>> > &g
[PHP] pharse file random work with -n lines
// Code start $i = 0; $fp = fopen ("./../../cgi-bin/Classifieds/data/ads.data", "r"); while($tmp= fgetcsv($fp,5,"\|")) { $array[]=$tmp; } fclose ($fp); $rand_array=array_rand($array, 10); foreach($rand_array as $line) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = ($line); echo " $line $Endzwei $End3 "; } // Code end Only returns the random line numbers on the page : $line no errors no content the arrays are empty ? can not find out whats wrong, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pharse file random work with -n lines
Yes I did all what you suggested ! tried all value carrieres and none has a value as well tried print_r($line); and it gives me the last random line number from 10 random line numbers displayed already if I use $line The sdcript dosn't grab the line only the random numbers are ready Can somebody expierenced give advice please, so I can display listed value carrierers. // Code start $i = 0; $fp = fopen ("./../../cgi-bin/Classifieds/data/ads.data", "r"); while($tmp= fgetcsv($fp,5,"\|")) { $array[]=$tmp; } fclose ($fp); $rand_array=array_rand($array, 10); foreach($rand_array as $line) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = ($content); echo " $Endzwei $End3 $line"; } // Code end -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] reading last -n lines array is emty
How to grab the last -n lines from a data file and display the stored data Only the the last 10 line numbers coming back when I echo $i How do I get the list($adnr, $user, $date, $listed to catch the datafields datafile looks like 23|Werner|LastN|Street|etc|etc.|etc|| 24|Veronika // code start $file = file("data/ads.data"); for ($i = count($file); $i > count($file) - 10; $i--) foreach($i as $line) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split ("\|", $buffer); print " $i $Endzwei $End3 "; }; // Code end
[PHP] reading last -n lines array is emty
How to grab the last -n lines from a data file and display the stored data Only the the last 10 line numbers coming back when I echo $i How do I get the list($adnr, $user, $date, $listed to catch the datafields datafile looks like 23|Werner|LastN|Street|etc|etc.|etc|| 24|Veronika // code start $file = file("data/ads.data"); for ($i = count($file); $i > count($file) - 10; $i--) foreach($i as $line) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split ("\|", $buffer); print " $i $Endzwei $End3 "; }; // Code end
[PHP] reading last -n lines array is emty
How to grab the last -n lines from a data file and display the stored data Only the the last 10 line numbers coming back when I echo $i How do I get the list($adnr, $user, $date, $listed to catch the datafields datafile looks like 23|Werner|LastN|Street|etc|etc.|etc|| 24|Veronika // code start $file = file("data/ads.data"); for ($i = count($file); $i > count($file) - 10; $i--) foreach($i as $line) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split ("\|", $buffer); print " $i $Endzwei $End3 "; }; // Code end
[PHP] read -n lines from end of file - Empty array ?
How to grab the last -n lines from a data file and display the stored data Only the the last 10 line numbers coming back when I echo $i How do I get the list($adnr, $user, $date, $listed to catch the datafields datafile looks like 23|Werner|LastN|Street|etc|etc.|etc|| 24|Veronika // code start $file = file("data/ads.data"); for ($i = count($file); $i > count($file) - 10; $i--) foreach($i as $line) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split ("\|", $buffer); print " $i $Endzwei $End3 "; }; // Code end
Re: [PHP] reading last -n lines array is emty
I again have no values in my list names $adnr, $user, $date, $listed, $hlong, $eins, $zwei, . themn are always emty no matter what I do with your code my code // code start $file = file("data/ads.data"); $num_lines = count($file); if ($num_lines > 10) $start_line = $num_lines - 10; else $start_line = 0; for ($i=$start_line; $i<$num_lines; $i++) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split ("\|", $buffer); echo "Line #$i.\n "; print "http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session _key=&search_and_display_db_button=on&db_id=$adnr&query=retrieval\" target=\"_blanko\">$Endzwei $End3"; } // Code end - Original Message - From: Kevin Stone <[EMAIL PROTECTED]> To: WebDev <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, March 06, 2003 11:42 AM Subject: Re: [PHP] reading last -n lines array is emty > You could do it reading back to front the way you propose but I think it > will work much better in a proper for loop. > > // the number of elements in the array. > $num_lines = count($file); > > // the line we want to start the loop at. > if ($num_lines > 10) > $start_line = $num_lines - 10; > else > $start_line = 0; > > // loop through the array > for ($i=$start_line; $i<$num_lines; $i++) > { > echo "Line #$i.\n"; > file://do your work here.. > } > > Hope that helps. > > - Kevin > > - Original Message - > From: "WebDev" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, March 06, 2003 3:24 PM > Subject: [PHP] reading last -n lines array is emty > > > How to grab the last -n lines from a data file and display the stored data > Only the the last 10 line numbers coming back when I echo $i > > How do I get the list($adnr, $user, $date, $listed to catch the > datafields > > datafile looks like > 23|Werner|LastN|Street|etc|etc.|etc|| > 24|Veronika > > // code start > > > $file = file("data/ads.data"); > for ($i = count($file); $i > count($file) - 10; $i--) > foreach($i as $line) { > list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, > $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, > $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, > $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, > $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split ("\|", $buffer); > > print " $i href=\"classifieds.cgi?session_key=&search_and_display_db_button=on&db_id=$a > dnr&query=retrieval\" target=\"_blanko\">$Endzwei $End3 "; > > }; > > // Code end > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reading last -n lines array is emty
still empty Got the code like you described: // start $file = file("data/ads.data"); $num_lines = count($file); if ($num_lines > 10) $start_line = $num_lines - 10; else $start_line = 0; for ($i=$start_line; $i<$num_lines; $i++) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split('\|', $line[$i]); echo "Line #$i. \n "; print "http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session _key=&search_and_display_db_button=on&db_id=$adnr&query=retrieval\" target=\"_blanko\">$Endzwei $End3"; } // end - Original Message - From: Kevin Stone <[EMAIL PROTECTED]> To: browseabit <[EMAIL PROTECTED]> Sent: Thursday, March 06, 2003 12:15 PM Subject: Re: [PHP] reading last -n lines array is emty > $buffer is undefined in your code. Do split('|', $line[$i]); > - Kevin > > - Original Message - > From: "browseabit" <[EMAIL PROTECTED]> > To: "Kevin Stone" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Thursday, March 06, 2003 4:09 PM > Subject: Re: [PHP] reading last -n lines array is emty > > > > > > I again have no values in my list names $adnr, $user, $date, $listed, > > $hlong, $eins, $zwei, . themn are always emty no matter what I do with > > your code my code > > > > > > > > // code start > > $file = file("data/ads.data"); > > > > $num_lines = count($file); > > if ($num_lines > 10) > > $start_line = $num_lines - 10; > > else > > $start_line = 0; > > for ($i=$start_line; $i<$num_lines; $i++) > > { > > list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, > > $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, > > $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, > > $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, > > $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split ("\|", $buffer); > > echo "Line #$i.\n "; > > print " > > href=\"http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session > > _key=&search_and_display_db_button=on&db_id=$adnr&query=retrieval\" > > target=\"_blanko\">$Endzwei $End3"; > > } > > > > > > // Code end > > > > > > - Original Message - > > From: Kevin Stone <[EMAIL PROTECTED]> > > To: WebDev <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > Sent: Thursday, March 06, 2003 11:42 AM > > Subject: Re: [PHP] reading last -n lines array is emty > > > > > > > You could do it reading back to front the way you propose but I think it > > > will work much better in a proper for loop. > > > > > > // the number of elements in the array. > > > $num_lines = count($file); > > > > > > // the line we want to start the loop at. > > > if ($num_lines > 10) > > > $start_line = $num_lines - 10; > > > else > > > $start_line = 0; > > > > > > // loop through the array > > > for ($i=$start_line; $i<$num_lines; $i++) > > > { > > > echo "Line #$i.\n"; > > > file://do your work here.. > > > } > > > > > > Hope that helps. > > > > > > - Kevin > > > > > > - Original Message - > > > From: "WebDev" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Thursday, March 06, 2003 3:24 PM > > > Subject: [PHP] reading last -n lines array is emty > > > > > > > > > How to grab the last -n lines from a data file and display the stored > data > > > Only the the last 10 line numbers coming back when I echo $i > > > > > > How do I get the list($adnr, $user, $date, $listed to catch the > > > datafields > > > > > > datafile looks like > > > 23|Werner|LastN|Street|etc|etc.|etc|| > > > 24|Veronika > > > > > > // code start > > > > > > > > > $file = file("data/ads.data"); > > > for ($i = count($file); $i > count($file) - 10; $i--) > > > foreach($i as $line) { > > > list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, > > > $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, > > > $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, > > > $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, > > > $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split ("\|", $buffer); > > > > > > print " $i > > > > > href=\"classifieds.cgi?session_key=&search_and_display_db_button=on&db_id=$a > > > dnr&query=retrieval\" target=\"_blanko\">$Endzwei $End3 "; > > > > > > }; > > > > > > // Code end > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reading last -n lines array is emty
If I remove the "/" then I get this error Warning: bad regular expression for split() in /home/virtual/browse/home/httpd/html/Classifieds/infobox2.php on line 14 - Original Message - From: Kevin Stone <[EMAIL PROTECTED]> To: WebDev <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, March 06, 2003 12:40 PM Subject: Re: [PHP] reading last -n lines array is emty > No you did not do it as I described. > > Here's what I wrote: > split('|', $line[$i]); > > Here's what you wrote: > split('\|', $line[$i]); > > See the difference? Remember single quotes denote a literal. You do not > have to limit the pipe character when you use single quotes. > > - Kevin > > - Original Message - > From: "WebDev" <[EMAIL PROTECTED]> > To: "Kevin Stone" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Thursday, March 06, 2003 4:33 PM > Subject: Re: [PHP] reading last -n lines array is emty > > > > still empty > > > > Got the code like you described: > > > > // start > > > > $file = file("data/ads.data"); > > > > $num_lines = count($file); > > if ($num_lines > 10) > > $start_line = $num_lines - 10; > > else > > $start_line = 0; > > for ($i=$start_line; $i<$num_lines; $i++) > > { > > list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, > > $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, > > $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, > > $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, > > $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split('\|', $line[$i]); > > > > echo "Line #$i. \n "; > > print " > > href=\"http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session > > _key=&search_and_display_db_button=on&db_id=$adnr&query=retrieval\" > > target=\"_blanko\">$Endzwei $End3"; > > } > > > > > > // end > > - Original Message - > > From: Kevin Stone <[EMAIL PROTECTED]> > > To: browseabit <[EMAIL PROTECTED]> > > Sent: Thursday, March 06, 2003 12:15 PM > > Subject: Re: [PHP] reading last -n lines array is emty > > > > > > > $buffer is undefined in your code. Do split('|', $line[$i]); > > > - Kevin > > > > > > - Original Message - > > > From: "browseabit" <[EMAIL PROTECTED]> > > > To: "Kevin Stone" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > > Sent: Thursday, March 06, 2003 4:09 PM > > > Subject: Re: [PHP] reading last -n lines array is emty > > > > > > > > > > > > > > I again have no values in my list names $adnr, $user, $date, $listed, > > > > $hlong, $eins, $zwei, . themn are always emty no matter what I do > > with > > > > your code my code > > > > > > > > > > > > > > > > // code start > > > > $file = file("data/ads.data"); > > > > > > > > $num_lines = count($file); > > > > if ($num_lines > 10) > > > > $start_line = $num_lines - 10; > > > > else > > > > $start_line = 0; > > > > for ($i=$start_line; $i<$num_lines; $i++) > > > > { > > > > list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, > > > > $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, > $ClassCat, > > > > $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, > > > > $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, > > > > $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split ("\|", $buffer); > > > > echo "Line #$i.\n "; > > > > print " > > > > > > > > > href=\"http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session > > > > _key=&search_and_display_db_button=on&db_id=$adnr&query=retrieval\" > > > > target=\"_blanko\">$Endzwei $End3"; > > > > } > > > > > > > > > > > > // Code end > > > > > > > > > > > > - Original Message - > > > > From: Kevin Stone <[EMAIL PROTECTED]> > > > > To: WebDev <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > > > Sent: Thursday, March 0
Re: [PHP] reading last -n lines array is emty
Buitiful it works finaly thanks to your help Could you be so nice and as well look what I am doing wrong with the random array display I send it today to the list already again with the lates code it uses the same data file but only random line numbers is all what I get - Original Message - From: Kevin Stone <[EMAIL PROTECTED]> To: Kevin Stone <[EMAIL PROTECTED]>; WebDev <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, March 06, 2003 12:55 PM Subject: Re: [PHP] reading last -n lines array is emty > Holy crap looks like I was wrong! I just tested it and sure enough '|' does > return an error.. how do you like that. So use split("\|", $file[$i]). > - Kevin > > - Original Message ----- > From: "Kevin Stone" <[EMAIL PROTECTED]> > To: "WebDev" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Thursday, March 06, 2003 1:50 PM > Subject: Re: [PHP] reading last -n lines array is emty > > > > Sorry that should be $file[$i] not $line[$i]. I failed to see your other > > mistake. Just trust me on the '|' thing. > > - Kevin > > > > - Original Message - > > From: "WebDev" <[EMAIL PROTECTED]> > > To: "Kevin Stone" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > Sent: Thursday, March 06, 2003 4:44 PM > > Subject: Re: [PHP] reading last -n lines array is emty > > > > > > > If I remove the "/" then I get this error > > > > > > Warning: bad regular expression for split() in > > > /home/virtual/browse/home/httpd/html/Classifieds/infobox2.php on line 14 > > > > > > > > > - Original Message - > > > From: Kevin Stone <[EMAIL PROTECTED]> > > > To: WebDev <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > > Sent: Thursday, March 06, 2003 12:40 PM > > > Subject: Re: [PHP] reading last -n lines array is emty > > > > > > > > > > No you did not do it as I described. > > > > > > > > Here's what I wrote: > > > > split('|', $line[$i]); > > > > > > > > Here's what you wrote: > > > > split('\|', $line[$i]); > > > > > > > > See the difference? Remember single quotes denote a literal. You do > > not > > > > have to limit the pipe character when you use single quotes. > > > > > > > > - Kevin > > > > > > > > - Original Message - > > > > From: "WebDev" <[EMAIL PROTECTED]> > > > > To: "Kevin Stone" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > > > Sent: Thursday, March 06, 2003 4:33 PM > > > > Subject: Re: [PHP] reading last -n lines array is emty > > > > > > > > > > > > > still empty > > > > > > > > > > Got the code like you described: > > > > > > > > > > // start > > > > > > > > > > $file = file("data/ads.data"); > > > > > > > > > > $num_lines = count($file); > > > > > if ($num_lines > 10) > > > > > $start_line = $num_lines - 10; > > > > > else > > > > > $start_line = 0; > > > > > for ($i=$start_line; $i<$num_lines; $i++) > > > > > { > > > > > list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, > $vier, > > > > > $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, > > $ClassCat, > > > > > $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, > > > > > $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, > $dreizwei, > > > > > $dreidrei, $dreivier, $dreifunf, $dreisechs ) = split('\|', > > $line[$i]); > > > > > > > > > > echo "Line #$i. \n "; > > > > > print " > > > > > > > > > > > > > > href=\"http://www.browseabit.com/cgi-bin/Classifieds/classifieds.cgi?session > > > > > _key=&search_and_display_db_button=on&db_id=$adnr&query=retrieval\" > > > > > target=\"_blanko\">$Endzwei $End3"; > > > > > } > > > > > > > > > > > > > > > // end > > > > > - Original Message - > > > > > From: Kevin Stone <[EMAIL PROTECTED]> > > > > > To: browseabit <[EMAIL PROTEC
[PHP] random -n lines array problem
the code only displays the 10 random line numbers somehow again the arrays are empty, tried all tricks to see if arrays are carrieng anything but the are all empty data file loks like : 123|name|LastN|City|Country|||etc|etc| 124|names|lastN|||etc||etc| could somebody please find the error, thanks for any help // Code start $Endzwei $End3 "; } // code end
[PHP] mailist all subjects
Hello all can somebody please tell how do I get any subject of the general list into my inbox not only the topics I start Tx
[PHP] replace question
Hello all how do we replace this out of an array element "~nl~" with " " Thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 4.2.0 replace
OK This function is supported in PHP 4.2.0 or higher. mb_ereg_replace() scans string for matches to pattern, then replaces the matched text with replacement and returns the result string or FALSE on error. ok gotta try that now quick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] replace question
- Original Message - From: WebDev <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, March 12, 2003 1:24 AM Subject: Re: [PHP] replace question Hello How could I know recognize a URL in $a $a contains often a URL htp://www.mysite.com but as well more text how is it possible now to recognize a URL could be in $s and if so we make it a actual html link, for the end user... // start $a= str_replace("Dog", "Cat", $b); $a_tooklinkout = if ($a == foundlink) { echo " $c"; } else echo "$a"; // end anybody has a tip for me .. > Thank you all -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] replace question
- Original Message - From: WebDev <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, March 12, 2003 1:24 AM Subject: Re: [PHP] replace question Hello How could I know recognize a URL in $a $a contains often a URL htp://www.mysite.com but as well more text how is it possible now to recognize a URL could be in $s and if so we make it a actual html link, for the end user... // start $a= str_replace("Dog", "Cat", $b); $a_tooklinkout = if ($a == foundlink) { echo " $c"; } else echo "$a"; // end anybody has a tip for me .. > Thank you all
[PHP] writing to file count multiple impression..
Hello all A frind of mine likes to count the impressions on each of his photgraphy online and as well he likes to display this number under each image he dosn't wish to use for each image a new request to the different count script ..all should be counted with one script and saved in one datafile // Code start // Image ID $ImageNr=$HTTP_GET_VARS['n']; if(!$ImageNr){$ImageNr=0;} // Full sys path to count.txt $counter_file = "count2.txt"; // Puts the file lines into $counter_file_line array $counter_file_line = file($counter_file); // adds one to the number in the [0] array or the very first line $counter_file_line[0]++; // I use a+ well I need each line representing an induvitual image ? ?? // opends the file and then writes the new number and then closes it $cf = fopen($counter_file, "a+"); fputs($cf, "$counter_file_line[0]"); fclose($cf); // prints out the full count // ?? echo " Views $counter_file_line[0] "; // Code end
[PHP] ho to remove an empty space
somehow when I have try to develop an application where I read five or six values into an individual arrays the array who carries the emails has the email and an additional empty field after the email somehow complex well they way the information has been stored is that the email was the last value in the line of arrays and somehow carries always an empty field or the tab field I can see when I upload the data in binary mode however I tried around for some time how do remove an empty space in an erray I tried arround with $E2= str_replace(" ", "", $Email); and I tried as well $E2= str_replace(" ", "", $Email); with no success it totally ignored the empty space in the email what is stored in this way:|data1|data2|[EMAIL PROTECTED] |data3|etc...|||. when I phrased the data file any help and advice would be appreciated... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Visual PHP Studio--comments?
Hello Alex, www.visualphpstudio.com /Merle Friday, October 19, 2001, 6:19:30 PM, you wrote: AS> Where you find it? Why not show up the link? AS> Actually I have been always thinking of a php studio. I think at least AS> following AS> things could be integrated into such a studio: a php IDE bundled with a web AS> authority tool, and port to SQL server and web server. AS> Alex AS> - Original Message - AS> From: "René Fournier" <[EMAIL PROTECTED]> AS> To: "Php-General" <[EMAIL PROTECTED]> AS> Sent: Friday, October 19, 2001 3:50 PM AS> Subject: [PHP] Visual PHP Studio--comments? >> Just found this app, and wondered if anyone here is using it and could >> comment on it. I was just wondering how it might help me do basic PHP >> development more than a good editor alone. (I am a PHP newbie, so perhaps >> it's just overkill.) >> >> ...Rene >> >> --- >> Rene Fournier >> [EMAIL PROTECTED] >> >> >> _ >> Do You Yahoo!? >> Get your free @yahoo.com address at http://mail.yahoo.com >> >> >> -- >> 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[2]: [PHP-DB] Re: PHP and MySQL queries...
Hello Jason, your resource name from the query is '$result' not '$results' change '$results' to '$result' on both lines. /Merle Tuesday, October 23, 2001, 5:07:37 PM, you wrote: J> Ok I made the changes and now I am getting these 2 errors... J> Warning: 0 is not a MySQL result index in search01.php on line 141 J> and this one... J> Warning: 0 is not a MySQL result index in search01.php on line 143 J> No rows found J> On line 141 - $count = mysql_num_rows($results); J> On line 143 - if (mysql_num_rows($results) ) J> I am not sure what this error message means, does that mean that there were J> no results to display? Oh by the way I sincerely want to thank you for J> helping me out with this, I have been working on it for a few days and just J> today decided I should get help with it. Thanks again. J> Jason J> "Rick Emery" <[EMAIL PROTECTED]> wrote in message J> news:[EMAIL PROTECTED]... >> OK. Ya followed me just a little too literally. We needed you to >> restructure. So you're part way there. >> i've made some changes below. >> >> I don't have access to PHP here at work, otherwise I'd test the changes I >> made below. So you'll have to test them. >> >> You'll note that I placed the while(){} loop where it should be. >> I also split the Name line into two different array elements. The array >> element names refer directly to the variables after SELECT in your SELECT >> query. >> I did the same in the Phone line. >> >> -Original Message- >> From: Jason Gerfen [mailto:[EMAIL PROTECTED]] >> Sent: Tuesday, October 23, 2001 2:23 PM >> To: [EMAIL PROTECTED] >> Subject: RE: [PHP-DB] Re: PHP and MySQL queries... >> >> >> Ok here is what I have done after your suggestions... >> if ($date == "") >> {$date = '%';} >> >> $result = mysql_query ("SELECT >> J> fname,lname,address,city,state,zip,phonea,phone,email,crty,crnum,crmo,cryr,w >> eeks,ogden,rock,logan,ipaddress,ad,total,num,date,time >> FROM ads WHERE date LIKE >> '%$date%' LIMIT 0, 30 "); >> $count = mysql_num_rows($results); >> >> if (mysql_num_rows($results) ) >> { >> while( $row = mysql_fetch_array($result) ) >> { >> >>print "Name: ".$row['fname'].", ".$row[' lname']."\n"; >>print "Address: ".$row['address']."\n"; >>print "City: ".$row['city']."\n"; >>print "State: ".$row['state']."\n"; >>print "Zip: ".$row['zip']."\n"; >>print "Phone: ".$row['phonea'].", ".$row[' phone']."\n"; >>print "Email: ".$row['email']."\n"; >>print "Credit Type: ".$row['crty']."\n"; >>print "Credit Number: ".$row['crnum']."\n"; >>print "Credit Date: ".$row['crmo']."\n"; >>print "Weeks: ".$row['weeks']."\n"; >>print "Ogden: ".$row['ogden']."\n"; >>print "Logan: ".$row['logan']."\n"; >>print "IP Address: ".$row['ipaddress']."\n"; >>print "Ad: ".$row['ad']."\n"; >>print "Total: ".$row['total']."\n"; >>print "Ad Number: ".$row['num']."\n"; >>print "Date: ".$row['date']."\n"; >>print "Time: ".$row['time']."\n"; >> } >> } >> else { >> print "No rows found"; >> } >> ?> >> After I have uploaded it to the webserver I now get a parse error on line >> 201 and that is the end of the php file, so there isn't anything to J> change. >> >> I am still fairly new to this so any help you can provide would be great. >> Thanks again. >> Jason >> >> >> >From: Rick Emery <[EMAIL PROTECTED]> >> >To: 'Jason' <[EMAIL PROTECTED]>, [EMAIL PROTECTED] >> >Subject: RE: [PHP-DB] Re: PHP and MySQL queries... >> >Date: Tue, 23 Oct 2001 13:13:21 -0500 >> > >> >First o all, GET RID of the 19 constructs using mysql_result(). You've >> >already captured the row with the $row=mysql_fetch_array(). >> >mysql_result() cannot be mixed with mysql_fetch_arry(). >> > >> >So instead of: >> >echo "Address: "; >> >printf(mysql_result($result,$count,"address")); >> >echo "\n"; >> > >> >use: >> >print "Address: ".$row['address']."\n"; >> > >> >Next, dates are stored in MySQL as -MM-DD. Use that format in your >> >input. >> > >> >Next, don't combine that "if(mysql_fetch_array())" with the "do while()" >> >Instead, use: >> > >> >if (mysql_num_rows($results) ) >> >{ >> > while( $row = mysql_fetch_array($result) ) >> > { >> > } >> >} >> >else { >> >print "No rows found"; >> >} >> > >> >Do the above. Re-submit. Tell me the results. W'ell go from there... >> > >> >rick >> > >> >-Original Message- >> >From: Jason [mailto:[EMAIL PROTECTED]] >> >Sent: Tuesday, October 23, 2001 12:37 PM >> >To: [EMAIL PROTECTED] >> >Subject: [PHP-DB] Re: PHP and MySQL queries... >> > >> > >> >As of yet I have tried all sorts for date formating for the search field J> to >> >work. I.E. 2001-10-23, 10/23/2001, 10/%/2001, 10%, %10%, etc. The date >> >field in the database is stored as 10/23/2001 and yet when a user enters >> >the >> >date and clicks the search button it does not display the results. I am >> >almost certain that as the user clicks the submit button the php script J> is >> >parsing the search string (i.e. 10/23/2001) incorrectly.
Re: [PHP] Searchengine friendly URLs
Hello Andy, Its just a way of passing along variable information as you would do with a form except you attach the variable/args directly to the URL. For example if you have a script that list all records in a database, you may have a link for deleting records that would be attached to each record with identifying information. The link may look something like http://somedomain.com/processRecord.php?action=delete&recID=24 So when you click this link for the processRecord.php script you pass in the action=delete and recID=24 as variable information. So in your processRecords.php script you may have something like: Hope this helps. -Merle Friday, October 26, 2001, 3:13:31 PM, you wrote: A> Hi there, A> I heared that search engines are not following things after the question A> mark. Now I looked arround and noticed, that some sites yust have numbers A> behind the .php extension. How does this work? Can anybody make an example A> and list advantages and disadvantages? A> Thanx, A> Andy -- 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] protecting files
Hi what is the script that was mentioned a while back that you use to allow apache access to a directory that has all world/group access turned off. It think the discussion was protecting mysql information on a shared server. I know this is a popular topic, sorry. I did check the archives but could not find that script name that was mentioned. Thanks, -Merle -- 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[2]: [PHP-DB] Performance problems in NC
Hello, Andy I have been trying to solve the same problem. But after some testing I have found that it is not only db access that causes the lag, it seems to be when submitting forms. I wrote a very simple test script have a form reload itself. In IE it happens almost instantly, but in NC it takes up to 5 secs (this is a lot since it is running locally, no network involved at all). And the script does have html and body tags (open and close) in there. Does NC process forms more vigorously before submitting than IE does?? I don't know. -Merle Monday, October 29, 2001, 11:43:27 AM, you wrote: MN> This could be due to missing tags such as /body and /html >> -Original Message- >> From: Andy [mailto:[EMAIL PROTECTED]] >> Sent: Monday, October 29, 2001 6:41 AM >> To: [EMAIL PROTECTED] >> Subject: [PHP-DB] Performance problems in NC >> >> >> Hi there, >> >> I have problems with the performance while using NC. It >> workes fine with IE. >> As soon as I access the db. It takes aproximatelly 1 -2 min >> till I see the >> page. >> >> Does anybody know some help? >> >> Thank you >> >> Andy >> >> >> >> -- >> 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]
[PHP] email receipt confirmation
Hi all, I have a form which sends off the contents of a page as an HTML formatted email. However, it appears that certain attempts to send these emails never show up at the intended email address even though no errors are reported upon sending while others work perfectly. It there any way to confirm if an email was received (opened/read) using headers or some other method? Thanks -Merle -- 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] CRM software
Sorry if this is a little off topic. I was wondering if anyone knew of a simple yet effective CRM package written in PHP and MySQL. If have seen a couple on hotscriptsw.com but they are a little outside what I need. All I need is a package that you can install on a webserver which would allow various people at different locatioons access to the data data. This data would be tracking information on customers, similar to a sales activity manager. I have tried a few which come close to what I want, but they do not allow all users access to the the same data. Each users data is kept separately. We basically just need a tool to store event and activities so that everyone is on the same page. Thanks merle -- 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] Check for existence of mail address
Hi, folks, I'm wondering how to checking existence of a given mail address like f...@bar.com . At 1st I tried: if f (filter_var ($maddr, FILTER_VALIDATE_EMAIL) === false) { /* some sort of error handling code here */ } where $maddr is the address to be checked. But this checks only syntax.. :-( Is there any other function which checks whether this address really exists? And, of course, I want to avoid sending a test mail just for checking :-) Many THX in advance for suggestions, pointers... Rolf -- Dipl.phys. Rudolf Otto Blättner, D 91074 Herzogenaurach, Germany. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Check for existence of mail address
Hi Daniel, hi Jonathan, hi folks, many THX for Your quick replies! On Mon, 25 Oct 2010 18:46:02 -0400, "Daniel P. Brown" wrote: > On Mon, Oct 25, 2010 at 18:38, wrote: > > > > Is there any other function which checks whether this > > address really exists? > > Of course not! Can you imagine the implications, insecurities, > and privacy concerns that would be associated with that? Some > mailservers will confirm or deny if a local address exists, but not > most --- thankfully. Yeah, You're right! After 2 seconds of thinking I got it! And, on Mon, 25 Oct 2010 19:48:55 -0300, Jonathan Tapicer wrote: > You can use this class: > http://www.webdigi.co.uk/blog/wp-content/uploads/2009/01 > /smtpvalidateclassphp.txt > > It may not work for some SMTPs. Many THX !! I'll give it a try ... > It uses the concepts explained here: > http://www.webdigi.co.uk/blog/2009/how-to-check-if-an-email > -address-exists-without-sending-an-email/ ... after reading this concept :-) THX, bye, greetings to Canada and USA from (now pitch dark) Ol'Germany! Your Rolf APPENDIX: My original posting was: --snipsnipsnipsnipsnipsnipsnipsnipsnip-- > Date: Tue, 26 Oct 2010 00:38:56 +0200, From: web...@blaettner.com > > Hi, folks, > > I'm wondering how to checking existence of a given > mail address like f...@bar.com . > > At 1st I tried: > > if f (filter_var ($maddr, FILTER_VALIDATE_EMAIL) === false) { > /* some sort of error handling code here */ > } > > where $maddr is the address to be checked. > But this checks only syntax.. :-( > > Is there any other function which checks whether this > address really exists? > > And, of course, I want to avoid sending a test mail just > for checking :-) > > Many THX in advance for suggestions, pointers... > > Rolf --snapsnapsnapsnapsnapsnapsnapsnapsnap-- -- Dipl.phys. Rudolf Otto Blättner, D 91074 Herzogenaurach, Germany. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Warning when calling session_start()
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Warning when calling session_start()
Hi, folks, good morning ! Since I'm a newbie with respect of sessions & cookies I'm quite lost here getting always a warning when calling session_start(); I developed and tested some php code using a session to pass some values betwen different scripts on my local machine. All went O.K. But when I transferred the code to my provider's server where my website is hosted, I constantly get this warning when calling session_start(): Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /./sess.php:3) in /./sess.php on line 5 In line 5 is session_start(); I dotted-out the path prefices in this warning. Lines 1-5 of my script "sess.php" are as follows: 1
[PHP] Re: Warning when calling session_start()
Hi, folks, On Tue, 21 Dec 2010 21:35:17 -0800 [06:35:17 AM CET], Michael Shadle wrote: > first - this is probably your culprit: > don't output empty lines before you do > anything (just a general good practice) Whow! This did the trick ! Warning vanished when I changed beginning of script to: 1 also i'd turn on output buffering. Since it worked without warning at 1st try, I haven't changed output buffering (yet). Mike, many thanks for Your PROMPT and HELPFUL answer! Have a nice day! Rolf -- Dipl.phys. Rudolf Otto Blättner, D 91074 Herzogenaurach, Germany. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] xmdom clone(true) & CDATA + html(?) encoding
lo all, don't really know if it's the correct list to post to but didn't see any xml lists besides the dev one, so don't hesitate to tell me where i should post if i was wrong.. i'm no php coder so my experience is quite thin, if you have an answer to my prob please keep that in mind ;) i'm using php 4.3 on linux / apache2 (debian stable) my little project is quite simple and my problem is too.. I need to get some data from a remote server hosting various websites, i've build a small "soap style" script on the remote server to provide the requested data to the client thru xml.. the xml data produced by the remote server is very simple, like the following sequence : my php script on the client server places requests for various data on the remote server and then stores each of them in a local xml file, used as a cache.. the xml tree of the local file is exactly the same as the one provided by the remote server, although the local file stores multiple "typeX" and "idXX" nodes, of course.. The first thing i had to deal with was the fact you can't append a node from one xmldom object to another, the first xmldom object being a handle to my local (cache) file and the second being the data returned by the request placed on the remote server.. So i'm using the clone(true) method to clone the node (with child tree) in my second xml object (remote data) so i can append it at the right place in my first object (cache file).. And that works fine BUT when performing the clone(true) the original CDATA section, inside the idXX node, desapears.. So the cloned node appended to my cache file has no CDATA section and the text, that was inside that CDATA section, seems to be html encoded.. with things like "légende" which should be "légende" (legend in english :) So i'd like to know what's the matter with xmldom and CDATA, or maybe simply the clone() method and CDATA sections.. and maybe also why xmldom encodes the text that way.. html special chars are also htmlencoded like "" for "".. but when extracted fro the xml cache file to be displayed in an php script the html codes are correct but the special ascii chars are screwed like this "légende" for word i mentionned earlier.. I've tried a few things but couldn't find any ways to properly restore those ascii chars.. and i really wouldn't like to have to create and append the cdata section manually.. Thx for you help.. Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] xmdom clone(true) & CDATA + html(?) encoding
Richard Lynch wrote: In my limited XML experience... I have found that firing up the fancy XML parsers and tree-walkers and XML-writers and all that stuff, pretty much entailed a *LOT* more work than just hacking the file directly, and stuffing in the XML text that need to be there, or reading the XML and using http://php.net/explode on it. well i would personnaly go straight to regexp then Just my opinion. Disclaimer: I consider XML the biggest bugaboo since Y2K -- Blown all out of proportion and over-saturated by hypesters who have NO CLUE what they're talking about. you're probbaly partialy right about that, i've seen some quite lame xml stuff considering the extreme verbosity of that kind of structure.. anyways i guess the main idea with xml was to build a serious replacement for our current html.. And considering your opinion above i guess you must think quite the same thing of html, right ? but what i was merely pointing out in my first email was that php seriously lacks a solid xmldom library.. I've used xml to do many many things including some fancy ones, using various languages and never had to scratch my head trying to understand what was going on, like what happens here with php xmldom test.. maybe if you had a more reliable xmldom in php then you'd use it more often and find out about the ease of use it can provide sometimes.. Please send flammable replies to /dev/null Thanks. sorry don't have /dev/null on my windows 2k crap :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php