Re: [PHP] date conversion/extraction issues
Haluk, After you retrieve the date from the database you still have to convert it from a string to time and then to a date. Try: Terry On 2 May 2012 22:36, Haluk Karamete wrote: > This is my code and the output is right after that... > > $PDate = $row['PDate']; > //row is tapping into ms-sql date field. > //and the ms-sql data field has a value like this for the PDate; > //07/12/2001 > $PDate = $PDate->date; > echo "[", $PDate , "]"; > echo "[", var_dump($row['PDate']) , "]"; > echo "[", serialize($row['PDate']) , "]"; > the output is as follows. And my question is embedded in the output. > > [] ??? WHY IS THIS BLANK? WHY IS THIS NOT 2001-12-07 00:00:00? > > [object(DateTime)#3 (3) { ["date"]=> string(19) "2001-12-07 00:00:00" > ["timezone_type"]=> int(3) ["timezone"]=> string(19) > "America/Los_Angeles" } ] > > [O:8:"DateTime":3:{s:4:"date";s:19:"2001-12-07 > > 00:00:00";s:13:"timezone_type";i:3;s:8:"timezone";s:19:"America/Los_Angeles";}] > > if I were to directly insert the $row['date'] ms-sql value into mysq, > I get this error; > Catchable fatal error: Object of class DateTime could not be converted > to string in sql.php on line 379 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- *Terry Ally* Twitter.com/terryally Facebook.com/terryally ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~ To print or not to print this email is the environmentally-searching question! Which has the highest ecological cost? A sheet of paper or constantly switching on your computer and connecting to the Internet to read your email?
Re: [PHP] Retrieve pages from an ASP driven site
Tom, Here is how you would paginate in PHP. // // Number of records to show per page: $display = 4; // Determine how many records there are. if (isset($_GET['np'])) { $num_pages = $_GET['np']; } else { $query = "SELECT * FROM mytable"; $query_result = mysql_query ($query) or die (mysql_error()); $num_records = @mysql_num_rows ($query_result); if ($num_records > $display) { $num_pages = ceil ($num_records/$display); } else { $num_pages = 1; } } // Determine where in the database to start returning results. if (isset($_GET['s'])) { $start = $_GET['s']; } else { $start = 0; } // Number of records to show per page: $display = 4; // Determine how many records there are. if (isset($_GET['np'])) { $num_pages = $_GET['np']; } else { $query3 = "SELECT * FROM mytable"; $query_result = mysql_query ($query3) or die (mysql_error()); $num_records = @mysql_num_rows ($query_result); if ($num_records > $display) { $num_pages = ceil ($num_records/$display); } else { $num_pages = 1; } } // Determine where in the database to start returning results. if (isset($_GET['s'])) { $start = $_GET['s']; } else { $start = 0; } // On 3 May 2012 05:37, EPA WC wrote: > Hi List, > > I am trying to write a crawler to go through web pages at > http://www.freebookspot.es/CompactDefault.aspx?Keyword=. But I am not > quite familiar with how asp uses _doPostBack function with the "next" > button below the book list to advance to the next page. I hope someone > who knows ASP well can help out here. I need to know how to retrieve > next page with PHP code. > > Kind regards, > Tom > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- *Terry Ally* Twitter.com/terryally Facebook.com/terryally ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~ To print or not to print this email is the environmentally-searching question! Which has the highest ecological cost? A sheet of paper or constantly switching on your computer and connecting to the Internet to read your email?
Re: [PHP] Retrieve pages from an ASP driven site
Terry Ally (Gmail) wrote: Here is how you would paginate in PHP. Terry - Tom is not trying to create this in PHP, but read existing ASP pages. Tom - I don't think that it's simply a matter of the ASP code here, but rather how they have constructed the set of information they are sending back. That is done in javascript, but the navigation buttons are simple form submit. BNext is submitted for 'next'. Interestingly, the sales side seems to be .php ;) -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why might fclose() block?
I'm currently seeing this in 5.3.10, although it's an intermittent problem I've seen earlier versions too. Occasionally I get a "maximum execution time" error when calling fclose() on a parallel port file descriptor. Code looks like this: $fp = fopen('/dev/lp0','w'); if ($fp){ fwrite($fp,$LongStringOfData); fclose($fp); } The printer attached to the parallel port does print the data sent in the fwrite line and the execution time error identifies the fclose line. It does not appear to be OS dependent. I've seen the error in both CentOS and Ubuntu as well as Windows (with LPT1: instead of /dev/lp0). What could cause fclose() to block rather than fail and return False? Is there anything vaguely equivalent to socket_select that I can use to wait for a blocking file descriptor with a specified timeout? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Retrieve pages from an ASP driven site
Thanks Lester. On Thu, May 3, 2012 at 3:49 AM, Lester Caine wrote: > Terry Ally (Gmail) wrote: >> >> Here is how you would paginate in PHP. > > > Terry - Tom is not trying to create this in PHP, but read existing ASP > pages. > > Tom - I don't think that it's simply a matter of the ASP code here, but > rather how they have constructed the set of information they are sending > back. That is done in javascript, but the navigation buttons are simple form > submit. BNext is submitted for 'next'. > > Interestingly, the sales side seems to be .php ;) > > -- > Lester Caine - G8HFL > - > Contact - http://lsces.co.uk/wiki/?page=contact > L.S.Caine Electronic Services - http://lsces.co.uk > EnquirySolve - http://enquirysolve.com/ > Model Engineers Digital Workshop - http://medw.co.uk// > Firebird - http://www.firebirdsql.org/index.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Mailto() - Google now displaying HTML as Plain Text
Do you know if the mailto script allow set headers? Probably you must set a html header, something like this $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; Regards, Gerardo. On Tue, May 1, 2012 at 5:14 PM, Marco Behnke wrote: > > > Am 29.04.2012 22:31, schrieb Terry Ally (Gmail): > >> Hi all, >> >> I have been using a mailto() script for the last three years and from >> April >> 25, 2012 incoming HTML email in Goggle mail is displaying as Plain Text. >> Something clearly changed with Google. Perhaps there is some change I >> need >> to make with my script?? >> >> $message .= "Message:<**blockquote> ".$m.""; >> >> > As far as I can see your main html tags are missing? > > $message = '' . $message . ''; > > > -- > Marco Behnke > Dipl. Informatiker (FH), SAE Audio Engineer > Zend Certified Engineer PHP 5.3 > > Tel.: 0174 / 9722336 > e-Mail: ma...@behnke.biz > > Softwaretechnik Behnke > Heinrich-Heine-Str. 7D > 21218 Seevetal > > http://www.behnke.biz > > > -- Gerardo Benitez - Programador Web Freelance
Re: [PHP] PHP Mailto() - Google now displaying HTML as Plain Text
Hi all, This question is now closed. There is nothing wrong with my script. It was an error by Google when they switched over to the new-look email and have since rectified the issue and all is back to normal. Thanks to all who have responded. Terry On 3 May 2012 21:05, Gerardo Benitez wrote: > Do you know if the mailto script allow set headers? > > Probably you must set a html header, something like this > $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; > > > Regards, > Gerardo. > > On Tue, May 1, 2012 at 5:14 PM, Marco Behnke wrote: > > > > > > > Am 29.04.2012 22:31, schrieb Terry Ally (Gmail): > > > >> Hi all, > >> > >> I have been using a mailto() script for the last three years and from > >> April > >> 25, 2012 incoming HTML email in Goggle mail is displaying as Plain Text. > >> Something clearly changed with Google. Perhaps there is some change I > >> need > >> to make with my script?? > >> > >> $message .= "Message:<**blockquote> ".$m.""; > >> > >> > > As far as I can see your main html tags are missing? > > > > $message = '' . $message . ''; > > > > > > -- > > Marco Behnke > > Dipl. Informatiker (FH), SAE Audio Engineer > > Zend Certified Engineer PHP 5.3 > > > > Tel.: 0174 / 9722336 > > e-Mail: ma...@behnke.biz > > > > Softwaretechnik Behnke > > Heinrich-Heine-Str. 7D > > 21218 Seevetal > > > > http://www.behnke.biz > > > > > > > > > -- > Gerardo Benitez > - > Programador Web Freelance > -- *Terry Ally* Twitter.com/terryally Facebook.com/terryally ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~ To print or not to print this email is the environmentally-searching question! Which has the highest ecological cost? A sheet of paper or constantly switching on your computer and connecting to the Internet to read your email?
Re: [PHP] PHP & Database Problems -- Code Snippets
At 06:47 PM 5/2/2012, Matijn Woudt wrote: On Wed, May 2, 2012 at 11:43 PM, Ethan Rosenberg wrote: > Dear list - > > Sorry for the attachment.  Here are code snippets --- Ethan, I don't want to sound rude, but it appears to me you don't have any understanding of what you're doing. It might help if you understand what the code is doing... Let me explain. > > GET THE DATA FROM INTAKE3: > >   function handle_data() >   { >    global $cxn; >    $query = "select * from Intake3 where  1"; > > > >    if(isset($_Request['Sex'])&& trim($_POST['Sex']) != '' ) $_Request does not exists, you're looking for $_REQUEST. And why are you mixing $_REQUEST and $_POST here? >    { >       if ($_REQUEST['Sex'] === "0") >       { >        $sex = 'Male'; >       } >       else >       { >        $sex = 'Female'; >       } >    } > >   } What is the point of the handle_data function above? It doesn't do anything. >   $allowed_fields = array >    (  'Site' =>$_POST['Site'], 'MedRec' => $_POST['MedRec'], 'Fname' => > $_POST['Fname'], 'Lname' => $_POST['Lname'] , >       'Phone' => $_POST['Phone'] , 'Sex' => $_POST['Sex']  , 'Height' > => $_POST['Height']  ); > >   if(empty($allowed_fields)) >   { >      echo "ouch"; >   } > >   $query = "select * from Intake3  where  1 "; > >   foreach ( $allowed_fields as $key => $val ) >   { >    if ( (($val != '')) ) > >   { >    $query .= " AND ($key  = '$val') "; >   } >    $result1 = mysqli_query($cxn, $query); >   } First, this will allow SQL injections, because you insert the values directly from the browser. Second, you should move the last line ($result1=...), outside of the foreach loop, now you're executing the query multiple times. Third, you should check if $result1 === FALSE, in case the query fails > >   $num = mysqli_num_rows($result1); >   if(($num = mysqli_num_rows($result1)) == 0) Doing the same thing twice? >   { > ?> >   />No Records > Retrieved #1 >   exit(); >   } > > DISPLAY THE INPUT3 DATA: > THIS SEEMS TO BE THE ROUTINE THAT IS FAILING <<< > >   Search Results > >   cellspacing="55"  rules="all" >  frame="box"> >   >   Site >   Medical Record >   First Name >   Last Name >   Phone >   Height >   Sex >   History >   > > >    while ($row1 = mysqli_fetch_array($result1, MYSQLI_BOTH)) >    { >       print_r($_POST); Doesn't really make sense to print $_POST here.. >        global $MDRcheck; >        $n1++; >        echo "n1 ";echo $n1; >       { >        if (($n1 > 2) && ($MDRcheck == $row1[1])) >        { >           echo ">2==  "; >           echo $MDRcheck; >           echo " $row1[0] \n"; >           echo " $row1[1] \n"; >           echo " $row1[2] \n"; >           echo " $row1[3] \n"; >           echo " $row1[4] \n"; >           echo " $row1[5] \n"; >           echo " $row1[6] \n"; >           echo " $row1[7] \n"; >           echo "\n"; >        } >        elseif (($n1 > 2) && ($MDRcheck != $row1[1])) >        { >           echo ">2!=  "; > >           echo $MDRcheck; > > >           continue; continue doesn't do anything here. >        } >        elseif ($n1 == 2) >        { > >           define( "MDR" ,  $row1[1]); >           echo "row1 ";echo $row1[1]; >           echo "\n"; > >           $_GLOBALS['mdr']= $row1[1]; >           $_POST['MedRec'] = $row1[1]; You're not supposed to set variables in $_POST... >           $MDRold = $_GLOBALS['mdr']; It appears you want the old value of mdr, if so, then you should do this before you set it again 2 lines above.. >           echo " $row1[0] \n"; >           echo " $row1[1] \n"; >           echo " $row1[2] \n"; >           echo " $row1[3] \n"; >           echo " $row1[4] \n"; >           echo " $row1[5] \n"; >           echo " $row1[6] \n"; >           echo " $row1[7] \n"; >           echo "\n"; >        } > >       } >    } > > ?> You say this routine is probably the one
[PHP] PDF Form Field
Hi, I've spent hours researching this with no luck. I have a PDF with a form field that I want to populate and output the PDF. Can someone point me in the right direction? Can FPDF do this natively, or I need something else? My host doesn't have PDFLib installed, so that's not an option. Thanks. -- -Dan Joseph http://www.danjoseph.me
Re: [PHP] PDF Form Field
On May 3, 2012 9:08 PM, "David OBrien" wrote: > > > On May 3, 2012 8:53 PM, "Dan Joseph" wrote: > > > > Hi, > > > > I've spent hours researching this with no luck. I have a PDF with a form > > field that I want to populate and output the PDF. Can someone point me in > > the right direction? Can FPDF do this natively, or I need something else? > > My host doesn't have PDFLib installed, so that's not an option. Thanks. > > > > -- > > -Dan Joseph > > > > http://www.danjoseph.me > > Yeah you can load the pdf and overlay the text on top of it with fpdf there should be an example of that on the fpdf site I just found fpdfi using Google. It looks like what you need
Re: [PHP] PDF Form Field
On May 3, 2012 8:53 PM, "Dan Joseph" wrote: > > Hi, > > I've spent hours researching this with no luck. I have a PDF with a form > field that I want to populate and output the PDF. Can someone point me in > the right direction? Can FPDF do this natively, or I need something else? > My host doesn't have PDFLib installed, so that's not an option. Thanks. > > -- > -Dan Joseph > > http://www.danjoseph.me Yeah you can load the pdf and overlay the text on top of it with fpdf there should be an example of that on the fpdf site
Re: [PHP] PDF Form Field
On Thu, May 3, 2012 at 9:13 PM, David OBrien wrote: > I just found fpdfi using Google. It looks like what you need > Wow, you said the key phrase in your last e-mail, 'text on top'. I didn't think of that. fpdi/fpdf does that like a charm, thanks! -- -Dan Joseph http://www.danjoseph.me
[PHP] function
I need to access a FUNCTION I programmed within a different FUNCTION. Are these able to be passed like a variable? Or are they able to become like a $_SESSION variable in nature? How am I able to do this? I am essentially programming: === function name( $flag1, $flag2 ) { # some PHP echo name_of_a_different_function( $flag1 , $flag2 ); } === The error I am receiving is “Call to undefined function name_of_a_different_function” Thanks, Ron Ron Piggott www.TheVerseOfTheDay.info
Re: [PHP] function
On Thu, May 3, 2012 at 10:12 PM, Ron Piggott wrote: > I need to access a FUNCTION I programmed within a different FUNCTION. Are > these able to be passed like a variable? Or are they able to become like a > $_SESSION variable in nature? How am I able to do this? > > I am essentially programming: > > === > function name( $flag1, $flag2 ) { > > # some PHP > > echo name_of_a_different_function( $flag1 , $flag2 ); > > } > === > > The error I am receiving is “Call to undefined function > name_of_a_different_function” > > Are these inside classes or anything? If they're just functions, they should work fine together, example of 2 working functions together: This results in "hi 1" being echoed to the screen. -- -Dan Joseph http://www.danjoseph.me
Re: [PHP] function
On Fri, May 4, 2012 at 4:29 AM, Dan Joseph wrote: > > Are these inside classes or anything? If they're just functions, they > should work fine together, example of 2 working functions together: > > > hellotwo(); > > function helloone() > { > echo "hi 1"; > } > > function hellotwo() > { > helloone(); > } > > ?> > > This results in "hi 1" being echoed to the screen. > > -- > -Dan Joseph > > http://www.danjoseph.me Hi, Ron Another hint: Maybe the other function (you want to call inside your first function) is not defined at that time but in a file that's included later on ... Bye Simon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php