Jump to content

Malkavbug

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Malkavbug's Achievements

Member

Member (2/5)

0

Reputation

  1. Oka think i got it, renamed some variables to make it read better Please tell me what you think and if the code is good or could be better. (removed, seeing if it will let me post, getting an error) Well, I think I have a solution but it will not let me post code for some reason.....
  2. Not sure if this will post, but trying to post to the newbie forums suddenly give me "Forbidden" to access the forums/index.php file. URL is automatically going to index.php
  3. :) Here is what I am trying to do, but I cannot find a tutorial on how to do it since I am dealing with a CSV file with multiple rows but only one column When a user visits the page I want php to grab [a href=\"http://finance.yahoo.com/d/quotes.csv?s=SOFO+LNUX&f=l1\" target=\"_blank\"]http://finance.yahoo.com/d/quotes.csv?s=SOFO+LNUX&f=l1[/a] Which contains SOFO_Current_Price LNUX_Current_Price This is expandable (i can add more symbols to the URL) so what I am trying to do is make a script that will fetch that file, grab each line assigning it a variable in sequence to later print, ie $stock1 $stock2 etc so later on in my table where I want to print the information I only have to add [code]<?php echo "$stock1" ?>[/code] to get it to display the data, in this case to simple print out SOFO_Current_Price If anyone knows a good way to do this I would appreciate it. Current Price is all I need and I am trying to write this with as little code as possible, which should be possible, I just don't know how to interact with CSV rows assigning a variable for each row of data.
  4. I was poking around looking for a PHP/MySQL script for pagecounting multiple pages, but it needs to be able to do it on the fly. Basically when I add a page that I want to be counted I want the script to see if the page is already written to the table, if not to write it in one column and start the count in the other. If the page already exists just +1 the count and return the result. Anyone already have a simple solution to this, or could you give me some pointers on getting this start and special considerations. This will be my first real PHP/MySQL script I am writing, all my previous ones have just dealt with PHP includes.
  5. Hey if anyone needs a walkthrough I just got it working adding my sites header, leftbar, and footer to the boards. I am still working on skinning and setting all the values on the forums but you can see the layout at [a href=\"http://www.youstockit.com/forums\" target=\"_blank\"]http://www.youstockit.com/forums[/a] If anyone wants a quick walkthrough email me at bug@doombugmedia.com Basically involved two included in the index.php file for the forums and then having to modify the footer file for the board, think I cheated on that one.
  6. I am considering using invision forums on my website but I would need to set it up embedded into the page and working alongside other features such as articles, tutorials, etc, and have a left sidebar running my own stuff. PHPfreaks pulled this off rather well, and I was wondering how difficult this setup was and what tricks are required before I purchase invision forums.
  7. Okay, going to try and draw this out as best I can. Here is the issue, I am trying to make a message board for financial stuff, including the stock market. The board will be threaded conversation on several boards which need to be displayed by market, symbol, or industry, so individual threads need the ability to be flagged as pretaining to one, or several stocks, which in turn will flag them as industry or market threads based on the stock, or they need the option to be flagged as just a general industry or a general market. I am trying to do this right and normalize my tables to avoid tons of redundant data, so here is where I am at. I hope I am describing this okay. In general I will need a Users Table (U), with just basic account information for the user, which will have a one to many relationship with T and P For the General Stock stuff I will need a Market Table (M) , which will have a one to many relationship with I and S Industry Table (I) , which will have a one to many relationship with M and S Stock_Symbol Table (S) , which will have a one to one relationship with M and I Then for the message boards I will need A Threads Table (T) , with a one to many relationship with (P) A Posts Table, with a many to one relationship with (T) For the Joins I will need (this is where I am getting a headache) A join table to bring MIST together, so table will have the information on the Market, Industry, Symbol, and Thread it applies to. A join table which will bring PUT together, so a thread can generate and show the message posts If anyone can point out flaws in this basic sketch or give recommendation on how to go from here I would appreciate it. I want to try and do this right the first time, but I have no experience dealing with table normalization.
  8. Tehehe actually ran into this today trying to work that same problem backwards Try $var1 = $_SERVER['PHP_SELF']; $var2 = $_SERVER['SCRIPT_NAME']; $var3 = $_SERVER['REQUEST_URI']; Errr one of those three should do it, URI I believe Side note $var3 = $_SERVER['REQUEST_URI']; Should be what you are looking for Then if you need to strip off the extra what I used was ereg() though I am not sure if that is the best solution
  9. this is from one of my pages The Drop Down Box <td align="right" valign="bottom" class="jumpto"> <select style="font-size:9;" name="choice" onChange="jump(this.form)"> <option>Go to...</option> <option value="private.php">Private Messages</option> <option value="private.php?do=send">Send PM</option> </select> </td> Header javascript <script LANGUAGE="JavaScript" type="text/javascript"> <!-- function jump(menu) { ref=menu.choice.options[menu.choice.selectedIndex].value; splitc=ref.lastIndexOf("*"); target=""; if (splitc!=-1) {loc=ref.substring(0,splitc); target=ref.substring(splitc+1,1000);} else {loc=ref; target="_self";}; if (ref != "") {land(loc,target);} } //--> </SCRIPT> Now, this will allow you to enable a navigation based on it, and if you use $_GET in urls as the variables then you can just have things print to the URL, like I have in the above example "private.php?do=send" That maybe what you were going for? If you had subcategories you could chain this system together to lower sub levels.
  10. ahhh okay, so it would be like if $_SERVER['PHP_SELF'] == [a href=\"http://www.site.com/php.php\" target=\"_blank\"]http://www.site.com/php.php[/a] Hmmmm Ahhh okay, what I was looking for was $_SERVER['REQUEST_URI']; since that only returns the base file name In this case /about.php?view=vitals or /about.php for the base page. About to test it out and see how it flys. I might have some questions involving wildcards in a bit since I will need to get /about.php?view=vitals and /about.php results to act the same.
  11. Here is the issue in a nutshell. I know how to use $_GET to pull variables (&var=1) in URLs, but I was wondering about using it, or an alternative, to pull the actual URL. Here is the breakdown. I have a leftbar that is being pulled as an include, and I want the contents to change based on the page they are on in my site. So the value is different at page1.php and page2.php rather than ?page=1 Can $_GET do this? Is there another command that can?
  12. I was wondering if any of you could perhaps point me to some generic "database dumps" used to fill begining databases. I am wondering about good locations for this in general. Specifically though I am looking for stock market data, nothing like current price, I just need like a csv dump of symbol,market,industry,(description if it is not asking too much) Like I said, any data dump site for this in general is appreciated. Trying to save myself hours or days of hand jamming stuff in.
  13. (editing for code clean up, sorry) After the prior one that I figured out myself last minute it does, however, bring up an entirely different issue. Here is the code (clipped down) then I will explain more [code] switch (@$forum)       /*Open of forum switch*/ {    case "1":    /*Should be ?forum=general */      {         switch (@$view)   /*Open of view switch*/            {                case "topics":/*Should be ?forum=1&view=topics*/                   {                   echo "viewtopics 1 ";                   break; /* ends ?= caseblock */                   }                case "posts":  /*Should be ?forum=1&view=posts*/                   {                   echo "viewposts 1 ";                     break; /* ends ?= caseblock */                   }                   break; /* ends ?= caseblock */                   default: echo "1 Default ";             }/*End of view switch*/        } /*End of Case 1*/   case "2": /*Should be ?forum=2 */       {           switch (@$view)  /*Open of view switch*/              {                 case "topics":  /*Should be ?forum=2&view=topics*/                   {                    echo "viewtopics 2 ";                    break; /* ends ?= caseblock */                    }                    case "posts":/*Should be ?forum=2&view=posts*/                    {                    echo "viewposts 2 ";                    break; /* ends ?= caseblock */                    }                    break; /* ends ?= caseblock */                    default: echo "2 Default ";              }         /*End of view switch*/     }                /*End of Case 2*/ break; /* ends ?= caseblock */ /*By default show the main form page*/ default: include("forumbody.php");     } /*End of forum switch*/ [/code] What is working forumstest.php = forumbody.php included, nothing else Not working forumstest.php?forum=1 responds with "1 Default 2 Default" forumstest.php?forum=1&view=topics responds with "viewtopics 1 viewtopics 2" So initially I thought it was some "case" collision problem. However all forumstest.php?forum=2 requests do not include the forum=1 information. In other words they are working fine. So what can I look at/do to prevent the second case from throwing stuff in if the first case is met? Why is the second case even doing anything when case "2": /*Should be ?forum=2 */ is not met? Adding in a die() statement at the end of the case 1 stuff is not an option as there are things further down this script that I need to execute. I know I could call it with an include and add a die statement, but I would rather see if there is an actual way to properly do this, and figure out why it is even acting this way to begin with. Any help is greatly appreciated. I apologize for the oddly spaced code. I tried fixing it with an edit but it seems like the code box options on the message board are throwing in tabs spaces
  14. You know I am probably taking the wrong approach to this to begin with but here we go You can see what I am trying to do in the code (stripped down with comments) [code]   switch (@$forum)     /*Open of forum switch*/     {       case "general": /*Should be ?forum=general */                        switch (@$view)                               /*Open of view switch*/                               {                                 case "topics":                                 /*Should be ?forum=general&view=topics*/                                     {                                        echo "viewtopics General wheeee ";                                      /*Temp to see if it is working*/                                      break;  /* ends ?= caseblock */                                     }                                 case "posts":                                 /*Should be ?forum=general&view=posts*/                                     {                                        echo "viewposts General wheeee yippie!! ";                                      /*Temp to see if it is working*/                                      break; /* ends ?= caseblock */                                     }                               }                               /*End of view switch*/                        default: echo "Gen Default ";                        break; /* ends ?= caseblock */    }[/code] The problem is..... Actually, now that I look at it the problem is that I am an idiot. Default is executing because I never broke the switch prior to it hitting that line default: echo "Gen Default "; break; /* ends ?= caseblock */ changed to break; /* ends ?= caseblock */ default: echo "Gen Default "; Works just fine. So I will just post this for other newbies like myself to reference and learn from my initial mistake. Love you guys here :P
×
×
  • 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.