Re: [PHP] Re: Query stopping after 2 records?
When you say die, does it just stop, or do you get an error message? Depending on how long it's taking to perform the action, the script will stop just because it's taking a while. (by default, I think it's 30 seconds.) If so, use: ini_set(max_execution_time, time in seconds); On Mon, May 4, 2009 at 3:43 PM, Martin Zvarík mzva...@gmail.com wrote: Miller, Terion napsal(a): I need help/advice figuring out why my query dies after 2 records. Here is the query: // Build your INSERT statement here $query = INSERT into `warrants` (wid, name, age, warrant, bond, wnumber, crime) VALUES (; $query .= '$wid', '$name', '$age', '$warrant', '$bond', '$wnumber', '$crime' ); $wid = mysql_insert_id(); // run query mysql_query($query) or die (GRRR); echo $query; It inserts two records and dies half way thru the 3rd? Thanks in advance for clues to fix this. T.Miller Should be: -- $sql = ... $query = mysql_query($sql) or die(... while ($r = mysql_fetch_array($query)) { -- Notice that you need to assign the mysql_query to a $query variable! If you understand this, then there's most probably a mistake in your SQL statement. Martin -- 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] Dynamically Rename Images
Thanks, but I solved the problem another way. http://codepad.org/6juIkECZ. On Sun, May 3, 2009 at 3:02 PM, Michael A. Peters mpet...@mac.com wrote: Andrew Hucks wrote: Got this error: Fatal error: Cannot instantiate non-existent class: finfo in place on line 6 You need the pecl-FileInfo module. You can just comment that out that line and the line after it and (assuming all your images are png) change $mime_type = $fi-buffer(file_get_contents($impath)); to $mime_type = 'image/png'; On Sun, May 3, 2009 at 12:58 AM, Michael A. Peters mpet...@mac.com wrote: Andrew Hucks wrote: Is it possible to rename images dynamically? Say that I had something like image1.png, and I don't want to rename it on the server. I'm working on an image rotater for a forum that doesn't allow anything but image files as signatures. Here's my code so far: ?php //LolRotator //add images. not too hard. $images = array(image1.png, image2.png, image3.png); //which one do we gets? $show = rand(0, (count($images)-1)); //i r got u picture. echo 'img src='.$images[$show].'/'; ? I used mod_rewrite, which makes it from image.php to image.png. But, because the files aren't named image.png, it doesn't work. I need to figure out somethign between lines 8 and 10 to change the file name to image.png. Use mod_rewrite so that request for image.png is handled by a script, image.php image.php then randomly picks a image file from list, sends the appropriate image header, and reads the file sending the content to the browser. IE - function sendimage($impath) { // requires fedora rpm : php-pecl-Fileinfo $fi = new finfo(FILEINFO_MIME); $mime_type = $fi-buffer(file_get_contents($impath)); $imageOutput = ; if ($fp = fopen( $impath , 'rb' )) { while ($l = fgets($fp)) { $imageOutput .= $l; } $outputLen = strlen($imageOutput); header(Content-Length: $outputLen); header(Content-type: $mime_type); print $imageOutput; } else { // for whatever reason we failed die(); } } Is there a way to do this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dynamically Rename Images
Is it possible to rename images dynamically? Say that I had something like image1.png, and I don't want to rename it on the server. I'm working on an image rotater for a forum that doesn't allow anything but image files as signatures. Here's my code so far: ?php //LolRotator //add images. not too hard. $images = array(image1.png, image2.png, image3.png); //which one do we gets? $show = rand(0, (count($images)-1)); //i r got u picture. echo 'img src='.$images[$show].'/'; ? I used mod_rewrite, which makes it from image.php to image.png. But, because the files aren't named image.png, it doesn't work. I need to figure out somethign between lines 8 and 10 to change the file name to image.png. Is there a way to do this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] graphical integrated development environment recommendations?
http://notepad-plus.sourceforge.net/uk/site.htm Try out N++. It's very good, supports a whole bunch of languages by default, has folding, and you can tweak the syntax highlight if you want. (You don't need to though.) Takes two minutes to install, and 45 seconds to uninstall it if you don't like it. It's worth a try. On Fri, May 1, 2009 at 12:08 PM, Adam Williams awill...@mdah.state.ms.us wrote: With the wide range of users on the list, I'm sure there are plenty of opinions on what are good graphical IDE's and which ones to avoid. I'd like to get away from using notepad.exe to code with due to its limitations. Something that supports syntax/code highlighting and has browser previews would be nice features. I'm looking at Aptana (www.aptana.com) but it seems like it is more complicated to use then it should be. Either Linux or Windows IDE (i run both OSes) recommendations would be fine. -- 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] utf-8 ?
It'd be a hassle to just remove a function from a language, I suppose... On Thu, Apr 30, 2009 at 6:15 PM, Reese howel...@inkworkswell.com wrote: Tom Worster wrote: why use SGML character entity references in a utf-8 file or stream? can't you just put the character in the file? Because, I thought, HTML files were basically just text files with different file extensions, and that those other characters would not store or display properly if saved in .txt format. Was I mistaken? http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt That is supposed to be a UTF-8 encoded text file, between 1/3 and 1/2 of the characters do not display correctly on my screen. Either way, this next link suggests that Turkish characters with no equivalent in the English language should be encoded for Web display: http://webdesign.about.com/od/localization/l/blhtmlcodes-tr.htm And because that is off-topic, I'll throw this in: The consensus seems to be that the proposed ifset() and ifempty() functions are more effort than they are worth. What I'd like to know is, why empty() still exists when every time I turn around, the mentors I turn to locally tell me not to use it, to use isset() instead. Because empty() doesn't work with zero. Anyone care to take a stab at that? Reese -- 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
[PHP] Project Euler [Oh, this isn't spam mail...]
This isn't a question. :-D. Anyways, there's a website that I came across which has kept me up past bedtime the past few nights. Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems. http://projecteuler.net/index.php?section=problems Take a look. A fun thing to do when you're bored. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_session/$_cookie trouble
Take the values out of single quotes, else it sets them as strings, and not as the variable value. Also, are you meaning to set the cookie's expiration to time()-3600? Try time()+3600. On Tue, Apr 28, 2009 at 4:49 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Tue, 2009-04-28 at 16:38 -0400, Gary wrote: Thanks again, dont see any DOM As I mentioned I am no longer getting error message, but not sure it is working. I have this at the begining of the first file. ?php session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); if (isset($_COOKIE['sale_cookie']) isset($_COOKIE['assess_cookie'])) { $_SESSION['sale_value'] = $_COOKIE['sale_cookie']; $_SESSION['assess_value'] = $_COOKIE['assess_cookie']; } ? I have tried this echo $sale_value; echo $_SESSION['assess_value']; echo $_COOKIE['sale_cookie']; I have also removed all of the if() and still not had success None of which are producing results... Anyone see where I am going wrong... I have spent all day online, in the books, in the manual... Thanks again gary Igor Escobar titiolin...@gmail.com wrote in message news:1f5251d50904281318ie275b06w219fb6e014775...@mail.gmail.com... Make sure your file isn't a UTF-8 with DOM. Regards, Igor Escobar Systems Analyst Interface Designer -- Personal Blog ~ blog.igorescobar.com Online Portifolio ~ www.igorescobar.com Twitter ~ @igorescobar On Tue, Apr 28, 2009 at 5:13 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Tue, 2009-04-28 at 15:34 -0400, Gary wrote: Ashley There are 3 include files, the first is all html, but it has a form, so I put the session_start above the DTD and I no longer get the error messages. I had the session_start at the beginning of the second file, the php processing file, but that produced the error. It seemed to be calling to itself (if that does not sound too naive). As I mentioned in a post above, I am no longer getting the error message, but have been unable to get either the $_SESSION or the cookie to produce results... Thanks for your help. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240947209.3494.65.ca...@localhost.localdomain... On Tue, 2009-04-28 at 15:24 -0400, Gary wrote: Ashley Thanks for your reply, but no, that is not it. There was no other code prior. Gary Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1240945179.3494.61.ca...@localhost.localdomain... On Tue, 2009-04-28 at 10:48 -0400, Gary wrote: I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary I would have thought it was obvious, the file assessresult.inc.php is being called before
Re: [PHP] Re: $_session/$_cookie trouble
$sale_value would have worked if it hadn't been in single quotes, I believe. (Assuming it was populated.). When you put it in quotes, you were making the cookie's value a string instead of a variable. So, the value would actually have literally been $sale_value, rather than the value for that variable. It is working with $_POST['sale'] because there are no single quotes. :-p. On Tue, Apr 28, 2009 at 6:46 PM, Gary gwp...@ptd.net wrote: Many thanks to all for persevering my ignorance! I had read that setting a cookie into the past would destroy the cookie once the browser session was over, so that is why I had set it that way. I did two things to solve the problem, and I frankly dont know which one (or both) it was. First I reset the expiration into the future Next I changed setcookie('sale_cookie','$sale_value' time()-3600); to setcookie('sale_cookie',$_POST['sale'] time()+3600); So I was pulling the information from the post instead of the variable. $sale_value=$_POST['sale']; So again, thanks for all your help. Gary Gary gwp...@ptd.net wrote in message news:eb.4e.29799.53717...@pb1.pair.com... I am trying to set a cookie and a session, but seem to be running into a wall. I have tried different variations, and keep getting the same error message If I have this ?php session_start(); I get this: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 If I have this: session_start(); setcookie('sale_cookie','$sale_value', time()-3600); setcookie('assess_cookie','$assess_value', time()-3600); I get this Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\weiss\assessresult.inc.php:2) in C:\xampp\htdocs\weiss\assessresult.inc.php on line 7 If I delete and start over, I stll get the headers already sent... I have tried numerous other variations, but all with the same error. What am I missing here? Thanks Gary -- 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] I need ideas for things to code - webbytedd examples
The watermark worked in FF3...(for me, at least.) On Mon, Apr 27, 2009 at 6:16 PM, Daevid Vincent dae...@daevid.com wrote: This is tripping me out! i feel so duped! :) http://webbytedd.com/b1/photo-retouch/ this didn't work, maybe due to some JS errors. tried in FF3 and IE6. http://webbytedd.com/b/watermark/ I like your arrow captch idea: http://webbytedd.com/aa/assorted-captcha/ also the date and clock are nice: http://webbytedd.com/b/kewl-date/ http://webbytedd.com/b/binary-clock/ the transparent bg is green in FF3/XP and IE6/XP http://webbytedd.com/ccc/dragdrop/ http://webbytedd.com/b/color-rows/ you know you can do this too: tr class=?= (($r = !$r) ? 'row0' : 'row1' ) ? How come you don't have a way to see/download the source code for all these examples? cheers, http://daevid.com Some people, when confronted with a problem, think 'I know, I'll use XML.' Now they have two problems. -Original Message- From: Charles Harvey [mailto:linux...@gmail.com] Sent: Saturday, April 25, 2009 11:56 AM To: php-general@lists.php.net Subject: Re: [PHP] I need ideas for things to code This was a surprisingly good idea that works for me, as I haven't coded in about 3 years and need to get my hand back in. Trying to make use of one idea led to several others. Thanks, tedd! Charles On Sat, Apr 25, 2009 at 4:54 AM, tedd tedd.sperl...@gmail.com wrote: At 7:00 PM -0400 4/24/09, Andrew Hucks wrote: I've been coding PHP for about a year, and I'm running out of things to code that force me to learn new things. If you have any suggestions, I'd greatly appreciate it. Andrew: Here's an idea. Go through the php manuals and make small examples of everything you find. That way not only do you learn, but you have examples to fall back on when the need rises. Here's a small (believe me) portion of the demo's I've written over the years: http://webbytedd.com/a.php These cover different languages, but it will give you the idea. Just make a inventory of examples and post them with code. Not only will it help you, but might help others when you answer questions on this list showing the solution. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Change color of anything in double/single quotes
If I have something like $string = 'hello there'; (the word hello is in double quotes, if you can't see it), how would I output it as something like font color=colorhello/font there. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] I need ideas for things to code
I've been coding PHP for about a year, and I'm running out of things to code that force me to learn new things. If you have any suggestions, I'd greatly appreciate it.