Jump to content

GingerRobot

Staff Alumni
  • Posts

    4,082
  • Joined

  • Last visited

Everything posted by GingerRobot

  1. Because they are defined. They are just empty. Try: if(!empty($var)){ //echo the data } Also, next time, use tags(without the spaces) around your php code. Makes it a bit easier to read.
  2. Its highly unlikely that all or your 20,000 users would vote on all of your 20,000 articles. I don't think storing each individual vote is an issue at all. And i don't think there is any other way either.
  3. It uses the short open tags. Full tags are <?php ?>, whilst short tags are <? ?>. Not all servers are set up to allow the use of short tags. I was quite surprised to see their continued support in php 6
  4. I would think you will either need to open the file and split the file into individual queries, or use the mysqli extension. The ordinary mysql extention does not support multiple queries.
  5. Well that rather depends on how you are doing things at present. There are many ways to achieve a consistant look to your page so its rather difficult to guess how you're doing things. If, as i would guess, you are including various files in each of your pages, you could defined a $title variable before you include the header, echoing this variable in your header page. If this isn't how you are doin things, then perhaps you could post a sample page.
  6. 'its not working' is quite vague. What actually happens? Does everything appear to work but the row not get deleted? First off, you dont need the parenthesis around your string defined in $sql. Second, perhaps $id is not defined. Are you sure your field was called hiddenField? (perhaps it was hiddenfield?) Try this to debug: <?php include "dog.php"; $id=$_POST['hiddenField']; mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); mysql_select_db("$database") or die(mysql_error()) ; $sql = "DELETE FROM items WHERE id = '$id'"; $result = mysql_query($sql) or die(mysql_error()); echo 'The query was: '.$sql.'<br />'; echo "Deletion success<br /> <a href='arteditor.php'>Click here</a> to return to the admin home."; ?>
  7. Perhaps an IQ test before anyone's allowed to register?
  8. Well, if you are transferring with this header: header("Location: http://localhost/xampp/mypic/pictures.php?user=$_POST[name] "); Then they are not both defined. $id would not be defined, so the if statement would evaluate to false. You would need to do somthing like: header("Location: http://localhost/xampp/mypic/pictures.php?user=$_POST[name]&id=somevalue");
  9. Actually, if you are trying to retrieve rows in a random order, then you can indeed 'order by rand()': mysql_query("SELECT * FROM promotions WHERE used='n' ORDER BY rand()") or die(mysql_error()); But im a little confused. Are you trying to return your rows in a random order, are you trying to sort by a random column?
  10. I would explode by the slashes, and then use the relevant element of the array: <?php $str = 'http://www.sitename.com/articles/2007/10/article-title-name/2'; $bits = explode('/',$str); echo $bits[6];//the article name ?>
  11. Well for starters, you will probably be getting an error because of this line: $result = mysql_query($sql, $conn) or die ("Can't Process Query".mysql_query()); It should be: $result = mysql_query($sql, $conn) or die ("Can't Process Query".mysql_error()); And im a little confused by your question. Are both $id and $name defined when you attempt this query? Im unsure as to what the drop down box has to do with this all.
  12. If the variables are being sent with the POST method, you'll need to get the variables from the $_POST array, unless you have register_globals turned on. For example: <?php $name = $_POST['name']; ?>
  13. Sasa, i think that will miss out some rows of data. You wont get the first result from your database, or the 5th etc. You use the mysql_fecth_array() function twice in the loop, causing some results to be missed. Personally, i'd use the example from the FAQ here: http://www.phpfreaks.com/forums/index.php/topic,95426.0.html
  14. Yeah, use the htmlentities() on the text after grabbing it from the database. Will convert relevant symbols such as quotes to their relevant html character codes.
  15. Well, what are you actually trying to do? I can't see why you'd need to do something php onmouseover. Whats the goal?
  16. Well im no expert with these things, but i dont think this has much to do with the memory limit. Unless i've misunderstood the error message(which is possible) then you already have a memory limit of 512mb - a very high limit( im sure the default is less than that) - and if my maths is right, then you're trying to use something over 4 gigabytes of memory. Like i say, i could be wrong, but i think the problem might lie elsewhere.
  17. It certainly sounds like a session issue to me. If it ok when you first load the forum, and only have problems after visiting certain other pages, then a session problem seems the most likely.
  18. im sure its a simple way of turning the name "chex" into an array before it is echo'd i mean if i go ahead and just make chex an array once its pulled from the database then that means i have to re-write all the javascript code You miss the point. Unless chex is an array, then you will only ever recieve the last value from your $_POST array. A string can only hold one value - you need to pass lots of related values, for which an array is best.
  19. I agree. Modify the javascript to work with the array. It is the best way of passing all of the values of the IDs. If its really not an option, you'd have to employ some more javascript to do something like populate a hidden field with a list of IDs, separated by commas, which you could then separate out in php. Better method is to modify the javascript though.
  20. Its all done with the GD library which you can use to create images: www.php.net/gd I'm sure there are some tutorials out there if you google, or take a look at this class put together by one of the moderators of the site, Barand: http://members.aol.com/barryaandrew/baaChart/baachartguide.html
  21. I'd not really considered that; good point. You should get something like Napster or Rhapsody! I know there's the issue of the DRM - but i personally dont mind paying a relatively small monthly fee to basically rent as much music as i like.
  22. Of course. I think most people, like me, appreciate the effort that people go to to speak english when it is not their native language - for most people, they are not really capable of speaking another language particularly fluently either, so can understand the difficultly that others have. The annoyance comes when people who are english, but still cannot type! Usually it comes across as being deliberately annoying - if someone cannot be bothered to take the time to make their post coherent, why should we bother to spend the time responding to it? I think it's usually quite easy to tell the difference between a native speaker who can't type/write and a non native speaker who's making some effort. Back on subject: Yes i agress, the maths based programming forum is a welcome addition.
  23. Indeed. Whilst it's always very nice to help people(well, those who try to help themselves get help anyway!), i think you learn an awful lot by helping other's with their problems; if you can teach something, its probably fair to say you understand it.
  24. It was certainly quite a brave move to allow people to choose what to pay for their album. However, im not sure that i can see it working in general - apart from anything else, i suspect one the reaons why radiohead did this successfully is that, being the first to attempt this kind of thing, it had a lot of publicity.
×
×
  • 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.