Jump to content

phpzone

Members
  • Posts

    135
  • Joined

  • Last visited

    Never

Everything posted by phpzone

  1. I assume they want to specify the order uniquely for a each item rather than just saying DESCending or ASCending, if you just want to do ascending/descending ordering, then the previous posts explain. But to sequence in a custom manner.. we usually place a 'displayseq' field in the same table. Then modify the displayseq for the items based on user action (move up / move down), this requires renumbering the items in the category each time. To do this we start the first items displayseq at 4, then each item goes up by 2 in sequence ITEM 1 = display_seq = 4 ITEM 2 = display_seq = 6 ITEM 3 = display_seq = 8 If you want to move ITEM 1 down, you add 3 to it's display_seq, giving: ITEM 2 = display_seq = 6 ITEM 1 = display_seq = 7 ITEM 3 = display_seq = 8 Then you call a routine to select them by order of display_seq ASC and update from 4 incrementing in steps of 2 again, so you are back to: ITEM 2 = display_seq = 4 ITEM 1 = display_seq = 6 ITEM 3 = display_seq = 8 If anyone knows a better way, I'd really like to hear it because there probably is a better way :-)
  2. Well you link to the a product is like http://www.loveyoudivine.com/index.php?main_page=document_product_info&cPath=22_4&products_id=90 So you need to have the cPath and product id on your advert link, check for the presence of paramseters on the loading page and create your 'Enter' link with the correct parameters
  3. OR <?php $array = range("a","z"); for ( $i = 0; $i < count($array); ++$i ) { print ($i + 1) % 4 == 0 ? "$i -- Matched Fourth!!!<br />" : ''; } ?> I use ($i + 1) because array is zero based.
  4. Not sure, I've not tried sending so many emails in PHP, but what I would say is, don't add them all as 'To' if you do, you should add them as BCC and have the initial To email address be one for your site, for privacy sake. That way the To would be something like maillist@example.com and everyone will just see that address and not everyone elses on the mailing list.
  5. It's the modern day CSV file with with structured way of presenting data in text format. whereas a CSV would contain: "name","age","street" "Ned","9","10 My Street" XML would be: <people> <person> <name>Ned</name> <age>9</age> <street>10 My Street</street> </person> </people>
  6. So easy to miss Take a look at HEREDOC, I swear by it
  7. anthony@darkstar:~$ php -l temp2.php PHP Parse error: syntax error, unexpected T_VARIABLE in temp2.php on line 254 Errors parsing temp2.php You have an error. Probably a missing quote or something.
  8. What does sqlQuotes function do, does it also escape carriage return/linefeeds? Just thinking you might be escaping twice and so not getting your \n parsed as a carriage return somewhere in your PHP.
  9. I've only ever used command line utility pdf2text from PHP, but you could try this: http://pdftohtml.sourceforge.net/
  10. You need to use mysql_real_escape_string with your $data variables to escape the apostrophes eg. mysql_real_escape_string( $data[0] )
  11. Not that I'm aware, perhaps you'll have to create a tempfile, download the ini and write into the tmp, process and remove. Or, place a helper on the remote side that does the ini work and send it parameters.
  12. What does your CSS for the div contain? Set a width (33%) on your div and float: left and you should get three columns (depending on widths of the content within).
  13. If proper use of mysql_real_escape_string (or equivalent for db in use), htmlspecialchars/htmlentities is adhered to, any characters are fine, if your paranoid only allow letters/numbers.
  14. I prefer either the HEREDOC syntax, usually if I know the script are only for my editing, if its a commercial client project and the client needs access to templates I use Smarty Templates. Heredoc syntax is great, and underused by many, you just need to be careful with the closing Heredoc marker, sometime editors add space after the marker and it causes no end of havoc $message = 'Goodbye'; print <<<_SIGNOFF <h1>{$message}</h1> _SIGNOFF:
  15. Dont forget your .jpg/.gif etc. eg. echo sprintf("<img src=\"%s.jpg\" />", $$image);
  16. it's turning on page compression if the end browser supports it and the server supports it.
  17. I don't use Iframes much, but can you set a target on your form action eg. <form target=ifrm failing that, take a trip to ajax land ;-)
  18. What values for width/height have you got before you try using the first imagereate function? use var_dump to write them out and check, make sure your not ending up with a negative or some other invalid result.
  19. Can you post a code snippet please. What is in $bag? You are passing $bag's content at the key to $r, is that what you intended to do? Code snippet, explanation would help
  20. Your error is on this line: $path_mini = "images/mini missing the closing quote and semi-colon.
  21. You need to obtain the value in qbuild.php by checking the $_POST variable and storing the result for the parameter you want: $opt = $_POST['opt']; if ( !empty( $opt ) ) { // do something } else { // do something else } I take it you complete new to PHP, I recommend the HUZILLA PHP Guide at http://www.hudzilla.org/ as its a great source for learning.
  22. If you output something after the loop does the output appear? Just to test you're not hitting an error that's not being displayed. When developing, if you have access to the server, I always find it useful to have an SSH terminal open and tail the apache error log as sometimes your errors end up in the log if they are parsing errors but not on screen.
  23. No probs, you could have written either ot the following, but also you need security on this $query = "SELECT * FROM wwjitems WHERE item = '" . $_POST["0"] . "'"; or $query = "SELECT * FROM wwjitems WHERE item = '{$_POST["0"]}'"; If your variable in $_POST["0"] (better to use a descriptive name in there btw) should always be an integer do this: $post0 = (int)$_POST["0"]; This will force the value to be an integer and help mitigate hacking attempts. You should also always escape any text when querying eg: $name = $_POST['name']; // should be connected to mysql before the following: $db_name = mysql_real_escape_string( $name ); $sql = "SELECT * FROM people WHERE name = '" . $db_name . "'"; If you don't escape queries, you will fall into the beginners trap of leaving your database queries wide open for hackers.
  24. Personally, I'd leave the error checking on if your developing. You could turn error checking off and the errors would disappear, or you could prefix the check with '@' eg. if ( @!$color ) But this isn't good code, and you should be aiming to see and eliminate _all_ errors and notices if you want to do a good job :-)
  25. I think I read ereg will be taken out of PHP 6 core and only available as a compiled option. I'm using preg for all future projects, never know when my code might end up on a PHP 6 server with no ereg available
×
×
  • 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.