Jump to content

M4verick

Members
  • Posts

    27
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling
  • Location
    USA

M4verick's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Pretty much. I can't say the actual purpose of what I'm working on, but SNMP trapping is the closest anology. Each structure might contain a source, timestamp, and then a bunch of variables detailing what happened. Because they are situational you need all the info to put together what happened and if there's a problem, you'll want to know all the info so you know how to go about resolving it.
  2. Double posting only because I can't modify my last post and I figured out the original problem. Using the original pseudo code, all I had to do was fix a syntax error on the global array deal. function SeekAndAppend ($vars, $being, $passed) { global $$whatever; // Trying to define it here global $array; // Calling predefined $array $array[] = $whatever; // This used to be - $array[] = "$$whatever"; } foreach($array as $item){ echo $$item; } I appreciate your input regardless guys and if I can find a method to redo it to make it more efficient, I absolutely will jump on it. But like I said, unfortunately it's kind of just the nature of the beast for this situation and it makes it less than ideal. Thanks again everyone.
  3. Yeah pretty much. There's a source and a date. For whatever date range, I need all available info for the given source in whatever structures it may be apart of. You're the second person to say a class, I've been slammed and haven't had time to try it out yet. Appreciate input again guys, thanks everyone.
  4. Think like SNMP Traps. I have a network source that hands me data which is collectively unique every single time. The only information that will be the same on every transaction is the relay it came from -- of which, I don't care about that, the rest of the information I do care about. There'd be basically a source tied to each transaction, which is the only thing that transactions could have in common otherwise. Each transaction is independent of any other transaction. The data that comes in may be structured in a variety of potential ways -- we are able to decipher the kind of incoming data based on this structure, of which, gets input into a table for that type of structure. So when I need a date range for a source, I need to find that date range, for that source, based on that structure, and all other information that structure can provide so that I know what is happening.
  5. Sorry about terminology. The pseudo code was trying to give an example. I'm not actually going to be querying day by day where it can be avoided -- it will shoot for the whole month where applicable. The database isn't fun, but probably as good as it gets because all the information in it is unique and doesn't actually relate to each other unfortunately, which is why there are so many different tables. But it's kind of the nature of the beast. Any record in one table will not have anything in common with a record in another table other than potentially a date range -- which is by coincidence even then. It's essentially doing a 'select * from table' based on date and other parameters, and it does have to be a 'select *' unfortunately. But that's starting to get a bit off topic... I like your example, but I don't think it will work in my situation. I know you guys are doing your best to help me out with limited info, I really do appreciate it.
  6. The pseudo code is really simplified. It's not like I'm querying one table, there could be literally hundreds, it'd be really difficult to write one all encompassing query. It actually scales fairly well. Would take me about 2-3 minutes to add in a new category altogether if I needed a new topic queried. However, the only thing holding me back is just the output. If I have to just pre-define a bunch of variables before calling the function then I guess I'll do what I have to do, it just seems so inelegant. I really appreciate the input either way.
  7. Ok, I'll try to clear it up a bit and hopefully there will be a consensus to a degree. (I'm just now getting time to dive back into the project, so I haven't tried anything else yet.) Let's say I'm trying to query for objects A, B, and C for two months of whatever year. I had been trying to take that info and use it as the basis to store info of that category. Here's some pseudo code to try and give you the general idea. // Main $array = array(); // Algorithm determines dates to grab query($day, $1, $vars); // ... query($day, $31, $vars); foreach($array as &$item){ // Now I can return data nice and grouped logically by year.month } function query ($vars, $being, $passed){ // Pretend there's a bunch of stuff determining properties and data to query that would be here but isn't because it's unrelated to the question $data = mysql_query($statementA); if ($data){ global ${$A.$year.$month}; // This if statement checks to see if our variable has data in it, if not, then it must be new and should be added to the array for later iteration if (is_null(${$A.$year.$month})){ global $array; $array[] = ${$A.$year.$month}; } ${$A.$year.$month} .= $data; } $data = mysql_query($statementB); if ($data){ global ${$B.$year.$month}; if (is_null(${$B.$year.$month})){ global $array; $array[] = ${$B.$year.$month}; } ${$B.$year.$month} .= $data; } $data = mysql_query($statementC); if ($data){ global ${$C.$year.$month}; if (is_null(${$C.$year.$month})){ global $array; $array[] = ${$C.$year.$month}; } ${$C.$year.$month} .= $data; } } However, for each month, I might have to query for every single day, so ideally I could just append the data to those global variables I would have created if data had been there. That way it's easy for me to iterate through them in the array when I go to grab the data in the variables and just spew it out. Hopefully this helps.
  8. Sorry, the eyes were not intended to sound condescending or create hostility. I had read that document but it I could have sworn somewhere that it stated that you can't use that with variable variables. Thanks for the input and I'll change the smiley because if you made that assumption, chances are others will too. EDIT: Nm, can't change the post after something else is posted it appears. @Psycho -- I'll read up on classes, I'm not familiar with them. Thanks for input.
  9. I just want to know how to create a global variable from within a function. The reason I want to do this is I'm making mysql queries that may or may not have data in a function, if the data does indeed exist, I want to declare variables at that point. My queries are grouped logically by year/month, and as a result I'm going to be appending data to existing variables if they exist so it makes more sense to just append it to what would be the global variable anyways instead of just passing large strings out of the function to just be appended anyways -- plus it prevents me from creating a bunch of pointless variables. I intend additionally take the variables created inside the function and then store them in an encompassing global array (pre-defined outside of function) and at the end of the script do a foreach through it so I can iterate through the variables to grab my data knowing that there won't be pointless crap in there. I'm trying to create global variables by using variable variables ($$whichever). The code giving me issues inside the function is just like this: function SeekAndAppend ($vars, $being, $passed) { global $$whatever; // Trying to define it here global $array; // Calling predefined $array $array[] = "$$whatever"; // Passing just created global to the array for iteration later } When I iterate through the array the expected name of what would be the global variable name is there, but the global variable itself does not exist -- just at the function level. If someone has a recommendation on a better way to do it, I'll listen, but please don't turn it into a lecture. EDIT: Grammar & Clarity
  10. Well to my knowledge the difference between the two is that if the value isn't specified, then it defaults to what is between the 'option' tags. So on the French side you're actually sending the car manufacturer, but on the English side you're sending numbers. You should be able to just rewrite the part of it that is parsing for numbers to instead compare string values for the manufacturers you're looking for.
  11. English Side: <select name='manufacturer_reel' onchange="reload(this.form)"><option value=''>Please Choose an Option</option><option value='0'></option><option value='0'> MclAREN </option><option value='23'>alfa romeo</option><option value='14'>audi</option><option value='2'>bmw</option><option value='0'>CHEVY</option><option value='26'>citroen</option><option value='31'>daihatsu</option><option value='9'>datsun</option><option value='19'>ferrari</option><option value='27'>fiat</option><option value='10'>ford</option><option value='12'>honda</option><option value='29'>isuzu</option><option value='20'>jaguar</option><option value='22'>jeep</option><option value='4'>Lamborghini</option><option value='3'>lancia</option><option value='16'>lotus</option><option value='7'>mazda</option><option value='13'>mercedes</option><option value='15'>mini</option><option value='21'>mitsubishi</option><option value='28'>morgan</option><option value='11'>nissan</option><option value='24'>opel</option><option value='17'>peugeot</option><option value='1'>porsche</option><option value='8'>renault</option><option value='18'>subaru</option><option value='5'>toyota</option><option value='6'>volkswagen</option><option value='25'>volvo</option><option value='30'>yamaha</option></select> French Side: <select name="manufacturer_reel"><option value="reel manufacturer">Please Choose an Option</option><option></option><option> MclAREN </option><option>alfa romeo</option><option>audi</option><option>bmw</option><option>CHEVY</option><option>citroen</option><option>daihatsu</option><option>datsun</option><option>ferrari</option><option>fiat</option><option>ford</option><option>honda</option><option>isuzu</option><option>jaguar</option><option>jeep</option><option>Lamborghini</option><option>lancia</option><option>lotus</option><option>mazda</option><option>mercedes</option><option>mini</option><option>mitsubishi</option><option>morgan</option><option>nissan</option><option>opel</option><option>peugeot</option><option>porsche</option><option>renault</option><option>subaru</option><option>toyota</option><option>volkswagen</option><option>volvo</option><option>yamaha</option></select The French side is lacking the numerical values in the options. Which is why I wanted you to run that query against the machine itself.
  12. Doh! Epic fail on my part. Didn't see it on my browser at the bottom. I clicked on the big blue shiny button that said 'télécharger", which after revisting the English side, I assume translates to download. I like the blue button better. But my point still remains valid. You're missing the values under options on the french side, on the English side you have them numerical. Do you have a different database for each? If it's the same database then that will more than likely be your problem...
  13. Well if anyone knows anything, I would greatly appreciate it if they would share the information. The more I'm reading into it, it actually may be an issue with the shell_exec() function and apache, which are beyond my control. I'll keep looking into it and if I find the answer, I'll share it with everyone.
  14. Actually, the french side didn't work for me at all. Looks like it tries to open up an xls document but can't find it altogether. Looking at your source, your options don't even have values on the French side...There's no way it's working (or at least the way you'd want it to). Unless you want it to redirect to something invalid, then it's working fine.
  15. Yeah, I couldn't get any of the manufacturers I tried to actually pull anything by themselves. Make sure the values associated to the drop down match up with the values you're looking for in the database. After looking at your source it looks like they're going numerically, is does the database show the manufacturer_reel field as having numerical values? If so, try this query on the machine alone - select * from kit where manufacturer_reel = '1'; That should bring up the Porsche if I'm not mistaken. You might want to clean up some of the HTML in there too, on the result file.
×
×
  • 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.