Jump to content

Torrie

Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by Torrie

  1. ...Sigh... MacGyver, I wish I was smart enough to read your post and go "Oh I wish I thought of that," and then open up my code and type in a few lines and do what you just suggested. Unfortunately, I look at what you just said, and I'm thinking that is an Excellent idea.... but I don't know how to do what you just said. Would you be so kind as to post a couple lines of code? I know that I want my sales Invoice Number to start with the month and the date (e.g. I know that an Invoice Number that looks like "7108473" would go to an order created on July 10th, etc.). And my table is already autoincremented. Since I built the current code, I have 34 sales, so a "select max(id) as id from sales_orders" would give me "34" and not a number like "710****." If you could bang out 2 or 3 lines of code to push me in the right direction, I will absolutely PROMISE to hold a door open for an elderly lady this coming weekend.
  2. Quick question: how come you did it that way -- with the header: location next page, instead of the classic way of "<form action="nextpage.php"> I was always taught to use <form action="thepage_I_want.php">. Is this a newer, better way of doing things?
  3. Thank you, your answer gives me a lot to think about. In answer to the rand() question, $invoice_number.rand(1111,9999) just gives me the random number. Like you said, date("njis") gives a 6 - 8 character number, and the errors are easy to spot in my mySQL column: 7223564 7223669 7234452 11121 7234498 7238566 Here's my exact code: if (strlen($invoice_number) < 4) { $invoice_number = date("njis"); } ### INCREMENT invoice_number BY "1" IF the invoice_number ALREADY has been used before. $p1 = "select exists(select invoice_number from sales_orders where invoice_number regexp '".$invoice_number."' and name is NOT NULL and name NOT regexp '".$name."' )"; if (@mysql_result(@mysql_query($p1),0,0) == 1) { $orderarray = array(); $savedSQL = 'select invoice_number from sales_orders'; $savedQuery = mysql_query($savedSQL); while($savedResult=mysql_fetch_array($savedQuery)) { if(preg_match("/\d{4}/",$savedResult[0])) { $orderarray[] = preg_replace('/\D/','',$savedResult[0]); } } $invoice_number = (max($orderarray) + 1); } I cannot for the life of me think of what I can do to improve this code. Yes, it's newbie-stupid, and still uses deprecated mySQL, but I can't think of what else to do. The code (above) is in red, because my face is red/embarassed for the dumb question :-)
  4. 10-year intermittent problem: Invoices displayed on my website are assigned a unique 7-digit order number generated by PHP's date function $invoice_number = date("njis"); // creates, for example, invoice number "7223060" Roughly 10% of the time, no order number is displayed! That means, for whatever reason, from time to time, php's date function decides NOT to create a date. Over the past 10 years, I have been on different servers, at different hosts, with, obviously, different PHP versions. Is this one of those things, like, a "well-known-issue" about PHP's date function? Or what? I have even had to code built-in "backup-plan fail-safes" like: $invoice_number = date("njis"); if (strlen($invoice_number) < 4) { $invoice_number = date("njis").rand(11111,99999); // mail(webmaster notice); } What are your thoughts? Thank you!!
  5. That would only work for one individual string at a time echo str_replace(''',"'",$string); I want a php function that decodes all html characters. For some reason, nothing decodes the apostrophe ' Try it in your bash/terminal/putty and you'll see it don't work at all. Anyone?
  6. That was the first thing I tried -- I tried that, and it did not work: I tried both: echo html_entity_decode('''); echo htmlspecialchars_decode('''); I still get '
  7. Nobody has answered, so I think I will jump in and try to help. In your CSS code, you have: font-family: "Avant Garde",Avantgarde,"Century Gothic",CenturyGothic,AppleGothic,sans-serif; Simply switch "Avantgarde" with "CenturyGothic" like this: font-family: "Avant Garde",CenturyGothic,"Century Gothic",Avantgarde,AppleGothic,sans-serif; Then your code should work.
  8. Hello friends! Miss me? :-) I can't get html characters to decode properly. Please help me at least get this to work: The "html character" for an apostrophe is this: ' How do I turn this: ' into this: ' Here is "pseudo-code" to help clarify the type of answer I want: Hi Christy, here is your answer: <?php $character = '''; $decoded = magic_decoder_function($character); echo $decoded; ?> Thank you, Hugs and kisses, -Torrie
  9. Aww, isn't that cute! How you found a little yellow man banging his head against the wall. Like, that is 'you' and, that's how you feel some times. I just want to cuddle you and rub you behind the ears. Okay, dumbass dip-dorks, first of all, hey JACKASS CRONIX did you even READ My post? NO CSS! Jerk. And, now, This "Barand" person. What RUDE LAND are you from? Were you born a rude worm? Or did TWO UGLY PIMPLE-FACED PERL NEWSGROUP GEEKS FROM THE 90'S go bump uglies in your grandma's toilet-closet and create you? I'll go with that one (it matches the picture I have of you in my head). SECOND OF ALL, you have "HEADER" in your damn code. That means I can NOT HAVE IT IN THE MIDDLE of my html like I am ASKING FOR.... got it?!? Or are you too busy categorizing your "LET'S FIND EMOJIS TO PUT DOWN NEWBIE PHP PEOPLE." GOD DAMN! You must be the webmaster, anybody with any sense would have banned a rude jackass as yourself. YOUR CODE DON'T WORK! Why does it not work? Because you did NOT read my post. You don't know what I want, and, after seeing your replies to OTHER PEOPLE, I notice you have a .... shall we say "pattern" of being rude to just about everybody that asks questions. Please for the LOVE OF GOD BAN ME. MY php questions are so far and few between that I actually FORGET that this is the ASSHOLE forum, and I end up stupidly posting here. Give your butt-ugly wife a kiss for me. BYE
  10. That's one thing I have trouble with -- the "header" thingy. The code to display the image is half way down my page, header is an html page. <html> <body> Hello, welcome. Here is the image of the wonderful shipping label. Print this page, and then carefully cut around the border and then stick this label on your box. Here is the label for you to trim: <?php echo '<img src="data:image/png;base64,' . $label_image . '">'; ?> Okay and allrighty then, have a great day. </body> </html> ....okay, so in the code above, is it even possible to have PHP rotate that image?
  11. Already spent a week with the imagerotate, couldn't get it to work. Please suggest some code.
  12. Hi, this is one of those questions where I would welcome responses like, "why are you doing it THIS way.... this way is better." The software code from a big shipping company sends my server a label image that looks like this: echo '<img src="data:image/png;base64,' . $label_image . '">'; I needed 2 things done: 1.) The image saved 2.) The image displayed rotated. So I thought I'd save it in my label directory, first, with these 2 lines of code: $rawData=base64_decode($label_image); file_put_contents('labels/'. $unique_id . '.png', $rawData); Am I doing at least that part right? It seems to work. I can't get it to rotate, though. And, I don't know if I should rotate it first, before saving.... or, save it as is, and then rotate the displayed image. I could get the image to rotate using CSS.... that's no problem. But it feels like 'cheating' somehow. What's the "real mans way" of rotating?
  13. cyberRobot, I disagree; some people NEED to be called out, and called names. Especially those who seethe with resentment, so much so that their answers are tainted. Consider this: let's say that instead of all of us being "on this page here in the forum," we were all sitting around a table in a cafeteria. Nobody but nobody would *ever* respond to me the way all of 'you' responded. Gizmola wouldn't have gone on and on redundantly re-referencing my ...erm... "claim" (as he called it) to using PHP for 10 years (not to mention using the phrase "actually read" the manual page). Treating me like an accused perpetrator on a stand. weird weird weird. Or, pasting a condescending link "here let me google that for you." Here, allow me to wipe the sweat from your brow... Nope no no no. Jerks need to be called jerks. Banning me is a joke. Go ahead and ban me. The next time I ever need this forum, I'll have forgotten the fake username/password anyway, I'll just log in under a different name. How about "Trisha19?" All you fat ugly pimply-faced geeks will jump in and help because they think some hot female is asking the question. And, in conclusion, I'm "claiming" to go now. Bye.
  14. No, you pompous dipshits. I need ALL the records to appear on one page. I thought your stupid mysql pagination suggestion was some way to do some loop (i.e. look up a few records at a time and output to browser in segments), but none of you fagt geeks read my question. I want ALL the records to appear on the same page. Anyway, forget it. Oh, and don't give me this "old timer" crap -- most of you aren't even in college, except for one or two of you that I know to be worms from the old Perl usenet forum.
  15. Barand, you are a beautiful spirit. I'll give mySQL pagination a try! p.s. (how on earth do people KNOW stuff like this?!? I've been doing php/mysql 10+ years, never heard of it!)
  16. You've got the first part correct. The next part should be the result. Here's your code, with the missing stuff put into it: <?php $link = mysqli_connect("xxxx", "xxxx", "xxxx", "xxxx"); $sql = "SELECT customer FROM jobs WHERE id=6487"; #the missing stuff: $result = $mysqli->query($sql) or die(); if($result->num_rows > 0) { while($row = $result->fetch_assoc()) { echo stripslashes($row['customer']); } } mysqli_close($link); ?>
  17. My web-page loops through and echoes all 50,000 entries from a several-column mySQL database (part number, price, description, etc.). It is tedious for me, because It takes about a full minute for my browser to completely load it. I had an idea: Use "ob_start" at the beginning of the script, and insert an "ob_end_flush()" assertion in my "while" loop to get executed every 50 loops, like this: <?php ob_start(); ## access big mySQL database and output it to browser $i=0; while ( $a_row = mysql_fetch_assoc($result) ) { # echo output to browser if($i %50 == 0) { ob_end_flush(); } } ?> That cut the time down from 60 seconds down to about a second and a half. The problem is, the results are goofy (several mySQL rows missing, didn't get output to browser). Is there a better way? Or, am I on the right track? And, if I'm on the right track, what can I do to fix this? Thank you.
  18. Hi everyone, I'm your newest forum member. I promise to behave, and I promise not to mooch, and I promise that if I ask for help with coding, I'll gratefully accept your answer with a "thank you," and not just leave and never come back. Just now, I did this for fun: <?php $i = 3; $oo = 'u'; $luck = "$i bears"; ${'3 bears'} = 'canada'; print $${l.$oo.ck}; ?> What that prints, is where I'm from.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.