Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. implode If it does return an array use implode to but it into one single line =)
  2. The key to the left of the (1) that has ` and ~ on it.
  3. Yes, read above you are using ' (single quotes) to surround the column names. You need to use ` (back ticks) to surround column names, single quotes is for data only.
  4. <?php $string = <<<XML <a xmlns:b> <foo name="one" game="lonely">1</foo> </a> XML; $xml = simplexml_load_string($string); foreach($xml->foo[0]->attributes() as $a => $b) { echo $a,'="',$b,"\"\n"; } ?> From http://us2.php.net/manual/en/function.simplexml-element-attributes.php
  5. Basically show the page where the email is actually sent/show more code. The mail function is what sends the actual email. Most like it is on that same page (given that PHP_SELF links to that page). Show more code and your problem can easily be solved.
  6. $query3 = "DELETE FROM `images` WHERE `picid` = '" . $row['picid'] . "' AND `creatorid` = '" . $row['creatorid'] . "' AND `title` = '" . $row['title'] . "' AND `sumo` = '" . $row['sumo'] . "' AND `sumiototal` = '" . $row['sumiototal'] . "' AND `type` = '" . $row['type'] . "' LIMIT 1"; That is alot of conditions for a delete, but to each there own. Your main problem was using ' instead of ` around table/column names. The above should work with less confusion.
  7. *Bows* (Please mark the thread as solved bottom left hand corner) *claps* "premiso, you're so smart!" *blushes* I did not expect a standing ovation!!!
  8. Speed difference is hardly noticeable if at all. Yea, but there is a difference in speed, however small it is. The main feature is, look how much simpler that is to write than having to go run a query, pull that column assign it to a value then re-use that value in another query to increment it =) Much more efficient and quicker to at least write it.
  9. *Bows* (Please mark the thread as solved bottom left hand corner)
  10. You do realize the position of the header tag in your code makes no sense? Everything below it will not update and it will potentially throw you into an infinite loop. I would re look at your logic on that.
  11. Both work =) mysql_numrows
  12. In My Opinion.
  13. You are not selecting a database...mysql_select_db after the connections is opened.
  14. Well good, cause if you did I was just gonna direct you to the freelance section. If it were my script, I would do it 3-5 at a time. To avoid a script timeout and memory issues. If 3-5 you find is too much then limit it to 2-3. This depends on server connection to the site and how much data is being retrieved each call. PHP has a timeout of 30 seconds, most browsers about 2-5 minutes without data being sent to the page. For PHP's timeout set_time_limit should do the trick. If you want to keep the browser alive then look into ob_flush and flush functions to do that.
  15. echo $_POST['id'] out and see if that contains a value I doubt it does cause of this: ID :<input type=text value=\"$data[id]\"> Should be ID :<input type=text name=id value=\"$data[id]\"> That should do the update.
  16. Eh we all have our times, but you were not far off. readfile is what he was referring to, which might be a better solution, I am not sure. PS Remember to marked as "Solved" (bottom left hand corner).
  17. Remember to marked as solved. (Bottom left hand corner.) A quicker way to do this: <?php $sql = mysql_query("UPDATE km_users SET posts = (`posts` + 1) WHERE playername = '$player'"); ?> One statement is a heck of a lot quicker and slicker =)
  18. So are you wanting someone to write this for you? Do you have code started? If you want to do this I would suggest cURL if cURL is not available file_get_contents or file will also work. To parse it either preg_match OR split, strstr, list will all be functions you would want to use. Good luck!
  19. They usually intertwine with each other. Object Oriented (which PHP is working to be more centered towards). Uses classes to house objects and functions to manipulate those objects. www.php.net/oop should go more in depth on PHP OOP. From what I know about procedural, is that is just writing the code for to just run, this is how most scripts are done and works great in PHP. If you are using PHP 4, I would stick to procedural over OOP, if 5+ I would go more towards the OOP. I could be wrong on my thinking of procedural, its been a while since I was in a class with the definitions but to answer your question, yes you can relate the two, PHP works just fine intermingling.
  20. http://us2.php.net/manual/en/language.basic-syntax.php#80098 It is valid syntax for PHP. Just different and probably easier for users who come from Visual Basic. Not for me though, I like the other way, it is way more efficient imo =) Edit: Solution To limit it without going deep into the files this would work: <?php if ( $topics ) : $i=0; foreach ( $topics as $topic ) : ?> <tr<?php if ($i == 5) : break; endif; $i++; topic_class(); ?>> <td><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></td> <td class="num"><?php topic_posts(); ?></td> <td class="num"><?php topic_last_poster(); ?></td> <td class="num"><small><?php topic_time(); ?></small></td> </tr> <?php endforeach; endif; ?> I am unsure if that will work with the syntax, if not this will work. <?php if ( $topics ) { $i=0; foreach ( $topics as $topic ) { ?> <tr<?php if ($i == 5) { break; } $i++; topic_class(); ?>> <td><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></td> <td class="num"><?php topic_posts(); ?></td> <td class="num"><?php topic_last_poster(); ?></td> <td class="num"><small><?php topic_time(); ?></small></td> </tr> <?php } // end foreach } // end if ?> That should work if the first one does not.
  21. Newbie mistake. At least he learned his lesson now =)
  22. Not solving the problem just making this more efficient: $sql = mysql_query("UPDATE km_users SET posts = (`posts`+1) WHERE playername = '$player'"); I believe that is all you would need to add 1 to posts, saves you from having to select each time. As for your real issue, make sure you are not entering the same playername each time and that it is being changed properly.
  23. mysql_close is not needed. Just an fyi. Your issue: mysql_query(" UPDATE table SET firstname = '{$_POST['firstname']}', lastname = '{$_POST['lastname']}' WHERE id = '{$_POST['id']}'"); With SQL Injection issues I would highly advise escaping the post data before inserting into a database. But that should solve your problem. If you would have done this: mysql_query(" UPDATE table SET firstname = '{$_POST['firstname']}', lastname = '{$_POST['lastname']}' WHERE id = '{$_POST['id']}'") or die(mysql_error()); The error would have showed up to you.
  24. I think you mean file_get_contents file returns an array, which is not needed.
  25. http://us3.php.net/manual/en/dom.setup.php Chances are on Wamp, if you left click on the icon on your task bar goto PHP -> PHP Extensions -> php_domxml Should enable it. You will probably have to restart the apache service for this to take effect.
×
×
  • 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.