Jump to content

woop

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Everything posted by woop

  1. woop

    array help

    No probs - you were a huge help Keith.
  2. woop

    array help

    Thanks Ken - That did it. And thank you everyone else on the thread for your time and code - I have learnt a lot and you have saved me a lot of time and hair-pulling today. Really appreciate it.
  3. woop

    array help

    Thanks AC everyone's been so helpful getting me up to the point that the array is working along with the rest of the script. Just a minor thing to deal with now that the rest of the script is missing the first date off in the stuff it does. It seems that I need to explicitly put a zero at the start of the array: example: $events = array(0,1,7,8,17,18,23); Just not sure how.
  4. woop

    array help

    Thanks Keith but for some reason unless i explicitly include a zero, the rest of the script is missing off the first entry in the array!? Any ideas?
  5. woop

    array help

    Thanks mgallforever and kickstart - those seem to do the job. One last question, if I need the array to start with "0," is there an easy way to do this?
  6. woop

    array help

    Thanks for your help kickstart - i get query errors using your code though. Definitely understand that I don't want to just arrange the pieces of an array, but need the final array to provide be a line of php like: $events = array(1,7,8,17,18,23); Because the rest of my code works when i replace my query with this line (simply telling the script the numbers/dates that events exist) I'll keep playing around an if you have any ideas please share.
  7. A bit more help needed... I have a table with a column called date. Dates in this column are in the format MonthDay, examples: Jan31, Feb2, Apr9, Jul27. I need to query the table for all dates in a month to get an array that looks like this: $events = array(1,7,8,17,18,23); So far I have: $month='Feb'; (or whatever month is given to the variable) $query = "SELECT date FROM table WHERE date LIKE '$month%'"; $events = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo substr($row['date'], 3) . ','; } } This echos the results with a comma, but there is a trailing comma which is not needed, and also I am trying to force this into an array, but I think there must be a more natural way of retrieving this array. Basically the rest of my script works well if it is given an array like this: $events = array(1,7,8,17,18,23); Any help appreciated.
  8. Thanks Sinista, I've been playing around with something similar - will test a few variations of your code. I don't think it's fully possible with php (having the circle drawn and sized to fit a variable number of differently sized <div>s. Thanks again.
  9. At the moment i can retrieve information from a DB and display it nicely in a vertical line of boxes (some boxes with extra information as needed). I basically need a version of this with exactly the same information, but instead of a top-down list of divs (boxes), I need them to be displayed going around a circle (starting top centre, going clockwise). Does anyone know if this is possible? And how easy would it be? Any scripts? It's already taken me ages to get the list pulling the appropriate info and displaying in a straight line. Thanks for any help/direction. Added: The number of divs displayed will be variable depending on what's in the DB. So I can't count on their being a certain number. Therefore the 'circle' would need to re-size in some way?!
  10. Thank you both - now working. @wildteen88 Appreciate you trying to help. I'd been working along a similar line as your answer and for some reason the duplicates were left in there. Thanks for your help. @AbraCadaver That did it! You have just saved me a lot of time, effort and headaches. Many thanks.
  11. Need a bit of help with some php and a few kind members helped me in the past. My code is: $query = "SELECT names FROM table WHERE type='$type'"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)) { foreach(unserialize($row['names']) as $key => $value){ echo $value . '<br />'; } } Basically, a field on my table is called names. The information in this field is serialized (so many names are together in a single field, for a single row). I want to be able to search the whole table (where type='$type' - so many rows) for all names and then show unique names only. My code above unserializes the names from each field and then lists them, but doesn't deal with any duplicates (which I need removing). I have looked at functions like "unique_array()", and have tried using it in different places but it isn't doing the job. Any help appreciated.
  12. Thanks ozestretch. @redarrow - I'll try to remember to come back and post it when I finally get it finished. There are other components for me to fix first, but then I'll put it out there.
  13. Guys - my bad. I thought that it was ok that I did a db connection and query outside a function, and then the while statement for the result inside a function that was called. Now that I put everything together inside the function it works thanks to your help. I'm sorry that I messed you guys around, but I really appreciate your help -it is now working thanks to your comments here. I'm a math teacher developing a portal for me to upload lessons and homework for my middle school students, and you help has now made my site work (though I have a lot of other stuff to do). Thanks again - and my students will be more than happy that they have no excuse (now that they can view their homework automatically online now!) I can't say thank you enough.
  14. Thanks ozestretch but I still get the same error. Mike I already have the "echo mysql_error()" in the query bit. Not sure if there's somewhere else I need to add it. I'm not sure if I described this properly initially, but the variable $days needs to contain all of the quoted text below: ...which is pulled ffrom the while loop. Sometimes there will be zero lines, other times up to 30 lines. Each line has an array in it (as in the above example) so far when I echo the value of $stringy from the code below: ... I get the correct contents: ... but then I'd need to get this 'text' (which includes array statements) inside an array: With the suggestions so far do they create a list of arrays inside an array? I am really stumped with this. Have been working on it for days
  15. nope. Only the value of $classy which doesn't make a difference. Any other suggestions?
  16. Hi David, I just tried that but i get errors: This is a tough cookie to crack. Thanks for your help and ideas.
  17. This is roughly the code. And hen I echo $stringy it echos the text I need in the array... Thanks for any help
  18. I have some code which works: but I need all the stuff in the middle of the array to come from a database query. So I set up a query and while statement to grab this from the db and store as a variable ($stringy). I checked that the variable has the array content by echoing which gives: With being fairly new to php I thought that I could use the following code: But it isn't working Does anyone know how I can achieve a similar effect - to grab the contents of the array statement from pieces inside a db then use a variable inside an array to start it like above? Many thanks.
  19. Sean thanks for your help. It looks simple now but would have taken me hours if not days. Many thanks.
  20. Can anyone help? I have a mysql table with the following information: I have some php loop code which echos the rows in the following format: What I would like to do is to get the Chapter Name above the lines with the same chapter. But not above every line. See below: Do you know how I could edit my loop below:
×
×
  • 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.