GingerRobot
Staff Alumni-
Posts
4,082 -
Joined
-
Last visited
Everything posted by GingerRobot
-
Well you'll just need to keep track of the number of themes you've shown and if it's divisible by 4, close off the current table and create a new one.
-
Oh good. It wasn't just me then.
-
I still think it's largely pointless. It's not particularly difficult to circumnavigate.
-
You should never store numbers with a thousands separator. The comma is merely an aid for humans (or, more accurately, some humans - others use the full stop(period) and possibly other symbols) so that they can read it more easily - it is meaningless to a computer. You should place commas when the number is being outputted for a human to read.
-
Evidently the string \|\| doesn't occur in the first line of that file at all. Should it?
-
Can you post the code you're actually using?
-
Well it's just simple maths, right? If 0 is the top of the canvas, x is the bottom of it and we need the top of the image to be drawn with height h, it's just x-h.
-
Require Immediate Advice on PHP forum Nesting!!!
GingerRobot replied to rEhSi_123's topic in PHP Coding Help
Immediate advice eh? Best go pay someone then. With all due respect, people help here free of change, in their spare time. It's pretty rude to demand some help. -
Whenever you have problem with queries, you should add some debugging. Try modifying the query to this: $sql = "SELECT $tableRows FROM $tableName $tableWhere_What $tableOrderByASC"; $result = mysql_query($sql) or trigger_error(mysql_error().'<br />Query was'.$sql); That should give you some output that will indicate the problem. P.s. Welcome to the forums
-
I wrote a tutorial on this kind of thing: http://www.phpfreaks.com/tutorial/working-with-checkboxes-and-a-database AdRock - it's pretty inefficient to perform a query for each individual item to be deleted. If you implode the ids you can then use an IN clause (see the tutorial)
-
1.) Please use tags around your code 2.) This forum is for maths-related problems. 3.) I'm pretty sure a blank string is an invalid name for a database 4.) Welcome to the forums
-
That's really not a particularly good way to go about managing your pages, but never mind. In answer to the question, you need to be a little bit careful. Though it might be tempting to keep track of the numbers at the end from page-to-page, what happens if you make a mistake with your naming? How are you going to work out the highest number to go to? I think what i'd attempt to do is read the directory and look for all files that are in the form index*.php. You can then work out where in the array the current page is and whether or not to show next/previous links. The only caveat with this is that it's only going to work if you've named all your files using two characters for the number. Otherwise they wont sort in a natural order. If you haven't then you'll need to use the natsort function to get a natural ordering. And even in this case, you'll need to be a little careful - it'll sort index02 before index1 so you'll need to rid yourself of the preceding zeros. <?php //create an array of all index pages $pages = array(); foreach(glob('index*.php') as $page){ $pages[] = $page; } //get the current page, but we only want the file name without any slashes $currpage = $_SERVER['SCRIPT_NAME']; $parts = explode('/',$currpage); $currpage = $parts[count($parts)-1]; //find the index of the page $index = array_search($currpage,$pages); if($index > 0){//previous exists $prevpage = $pages[$index-1]; //show previous link echo "Previous page:".$prevpage; } if($index < count($pages) -2){//next exists $nextpage = $pages[$index+1]; //show next link echo "Next page:".$nextpage; } ?>
-
Can you please re-explain what you're trying to do? Do you have a load of separate files that are named something like page0, page1, page2 etc? Or are you passing an ID to a page so you can select information from a database?
-
The error is in your format. 'm' is a numeric representation of the month. So, being march, you're getting 03. You should be using 'd'.
-
How can I get rid of the last comma after the last array value?
GingerRobot replied to Jackosn5's topic in PHP Coding Help
Couple of different approaches: 1.) Get a count of the records in the result set with mysql_num_rows. In the loop check to see if you are on the last row. Only echo the comma if you're not. 2.) Instead of echoing directly in the loop, either concatenate onto a string and then, outside the loop, extract everything except the last comma with substr or put everything into an array and use implode with a comma as the 'glue'. -
At the moment i'm working on something which requires linked lists of various types. It occurs to me that i can make a generic list type with structures and unions. So i might have a structure for an integer list, one for a char list, one for a list of my own type etc and i'll then have a union of them inside another structure along with some flag (probably an enum) to tell me what the list type is. That's all fine and dandy, but i'm not sure what the best way to work with it is. For example, i'll need functions to add to the end of the list but i'd really rather not have to write separate functions for inserting with each type (e.g. i don't want to have add_to_int_list(), add_to_char_list() etc). So to the question: is there anyway to avoid this? Can i somehow pass whatever type i like into a function? On the one hand it seems unlikely, but then what about functions such as printf() which take a variable number of arguments of variable type? Thanks in advance for any input
-
The staff here. Well, mostly Daniel.
-
Visual Basic Studio 2008: Opening a file as HEX
GingerRobot replied to HaLo2FrEeEk's topic in Other Programming Languages
My point was that you can quite easily open and read from a file in VB. The matter of extracting the information you need is perhaps somewhat more difficult but obviously possible. -
Visual Basic Studio 2008: Opening a file as HEX
GingerRobot replied to HaLo2FrEeEk's topic in Other Programming Languages
Well that's this then? : http://www.martin2k.co.uk/vb6/posts/vb6post89.php http://visualbasic.ittoolbox.com/documents/reading-a-file-in-visual-basic-11885 http://www.daniweb.com/forums/thread36982.html -
Automating the creation and naming of webpages
GingerRobot replied to stubarny's topic in PHP Coding Help
Assuming you are using an apache server, you should take a look at rewriting your URLs with mod_rewrite -
Thanks for the pointer. Seems i was right that it was basically a case of an easy change from the code for the existing doubly-linked list. If you're interested, my question: And the response: It still seems slightly odd that one would bother to implement data structures without really optimizing them. Sure they're more efficient than arrays anyway, but if efficiency isn't the goal then why bother implement them at all. Oh well. p.s. Apologies for hijacking the thread.
-
Interesting. Still, it seems like an odd choice. I mean, a doubly-linked list inherently has twice the memory overhead as as linear one (twice the number of pointers) and the next pointer of the list seems completely redundant in a stack. It looks almost like a lazy implementation - "well, we've got a doubly-linked list - let's just stick a couple restrictions on access and use and we'll have a stack". Of course, i've probably got the wrong end of stick/missed something completely.
-
Hmm, i'd never seen that there were some data structures already implemented in PHP. Perhaps i'm being naive here - why would you implement a stack with a doubly-linked list? Being FILO store, why would you want the ability to iterate over the list? I would have thought you'd implement a stack with a linear linked list and pointer to the top of the stack.
-
Visual Basic Studio 2008: Opening a file as HEX
GingerRobot replied to HaLo2FrEeEk's topic in Other Programming Languages
I'm sorry but...on the one hand in shouldn't be too difficult, but on the other you're complaining that someone hasn't spoon-fed you the correct solution? Corbin freely admitted that he had no experience with the language you were looking to use but suggested an approach which was language-independent and then gave an example from a language he knew. Perhaps now you might be able to investigate the equivalent functions in VB to do what you need.