Jump to content

Catfish

Members
  • Posts

    354
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://www.beardeddonkey.com/

Profile Information

  • Gender
    Not Telling

Catfish's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi everyone reading this, I have used PHP before as a hobby programmer but recently my boss asked me to make a webpage to accept worker's hours and store them in a database. So I realize that in the last few years object oriented style has been added into PHP. I have learnt OOP (C++) about a decade ago and understand the fundamentals of it. If I am writing this website code, am I going to be better off spending the time to get familiar with the new OOP stuff in PHP and use that or would it be better to just use an old sequential style of programming? I know this may seem like apples and oranges and that it varies based on opinion, but maybe there can be reasons for me to use OOP over sequential. For instance, if I write this code to be flexible enough that I can do a basic "worker times" table first, then I might be able to add additional functionality later, like worker details and qualifications, all of which could be brought up with the click of a button. Will it generally be easier to add onto code using OOP?
  2. Hi forum visitors, I am wondering if anyone knows of some software that lets a user or computer analyze PDF files with the purpose of trying to find files that are laid out or LOOK (as in, when we as humans look at something and can tell it looks like something else) similar? I don't know the technical specification of PDFs, how they work exactly, or if this is even possible but is there anything like this? If there's not, is this even possible? I know there are new technologies like Google Goggles and TinEye.com that do this sort of thing with photos, so surely this would be possible with PDFs or other formats?
  3. what is the exact problem: 1. when you select "team 2" the page reloads and the player list for team 1 _disappears_ or 2. when you select "team 2" the page reloads and the _selections_ in the team 1 player list are unselected? if it is 1. i'd imagine you are not passing some data around correctly to maintain the output on the page, or your code is not using correct logic to keep the output on the page. if it is 2. (which i think will happen even if 1. isn't occuring) i'd say that remembering selections in forms over page refreshes is probably either a) client software dependant or b) require something like javascript to maintain the selections/inputs. I know for a fact I had to use some JS on one of my scripts to maintain text input values from submitting a form and then pressing "back" button, but i found this occured under Win32 and not under Linux platform - so it could also be client software controlling it sometimes.
  4. Rethinking what your pages are doing, I think what you said below may be a simpler way to get what you want done. from what i remember of your page, "classic" is the first value (X) and "content=who" is the second value (Y) isn't it? the value of content will be passed around in $_GET (as long as each link the user clicks has a ?content=value part) and the other value is always defined by the page name.
  5. from memory: session_start(); $_SESSION['x'] = "foo"; $_SESSION['y'] = "bar"; or you could just pass values around in $_GET or $_POST
  6. This LEFT JOIN is interesting stuff i've never seen before. From what I gather, what it is doing is pulling data from various (some arbitrary number) tables and creating a result set that shows unique rows based on ALL of the data from ALL of the tables. My question is, what would the result set look like if we just called: SELECT # Define all the fields you want to select. This has more benefits than just being faster. (Aliases) Users.id As userid # This "As userid" is called an Alias. It renames that field for only the query results. Users.name, # This is handy because we have 2 "id" fields in both tables. Users.email, Messages.id As messageid, Messages.subject, Messages.message FROM Users # This is Table 1, you "Start" from this table. without a LEFT JOIN ?
  7. i dont know exactly what 2 axis navigation is or does, but i would just pass two variable values around the place, maybe in a session value: $_SESSION['x'] and $_SESSION['y']. you can generate what page you need based off the value or those two values? or no?
  8. Thanks Ken! Your code worked a treat. I didn't know how to describe what I wanted to do and summarize it in some keywords so I could look for it online. I still don't really!
  9. Hi there, I want to know how I would be able to compare an array filled with data against another array that holds the key names that are expected to be in the first array. The first array may contain more or less data than is expected but the end result must be the data array with the key names from the second array. Example: $array1 = array ('key1' => 'value1', 'key2' => 'value2', 'key4' => 'value4', 'key5' => 'value5'); $array2 = array('key1', 'key2', 'key3'); I want to use the values in $array2 to say, "these are the field names that must be in the resulting array. nothing more and nothing less." therefore, I need to know the code to turn $array1 into this: $array1 = array ('key1 => 'value1', $key2 => 'value2', $key3 => ''); Note that the value of 'key3' will be empty because the original $array1 did not have a key3 key name or value. Is there an existing function that does this? What would I google for to get the best results for a function like this?
  10. <br> in the output will create line breaks. edit the <br> formatting to suit your needs.
  11. Just add the link details (<a href></a>) into the output strings: echo "<p><a href=\"http://url.to.file/"><img alt=\"Image\" width=\"$maxWidth\" src=\"$photo\" />"; echo "Title:".$id."</a> Price:".$price."<br/";
  12. http://snipplr.com/view/1027/generate-random-string/ see comments on page for any limitations of the function.
  13. preg_match will do what you want. http://au.php.net/manual/en/function.preg-match.php
  14. $sqlQuery = 'YOUR sql QUERY'; if ($recordResults = mysql_query($sqlQuery)) while ($recordData = mysql_fetch_assoc($recordResults)) { if ($recordData['zip'] == 1 || $recordData['zip'] == 2 || $recordData['zip'] == 3) $emailList123[] = $recordData; else if ($recordData['zip'] == 4 || $recordData['zip'] == 5 || $recordData['zip'] == 6) $emailList456[] = $recordData; } else print('Could not fetch results. Query sent was: '.$sqlQuery.'<br/>'."\n"); This code will sort the data with desired zip codes into two arrays $emailList123 and $emailList456 in a format like: $emailList123[fieldname] so to access a fieldname for example, "Name" in the sixth entry you would use: $sixthName = $emailList123[5]['Name'];
  15. when outputting a record's data in the table, include a line to output the HTML to create the checkbox. while ($rowData = mysql_fetch_assoc($result)) { foreach($rowData as $fieldName => $value) { print($value); // etc outputting your record data } print('<input type="checkbox" name="'.$rowData['idNum'].'"/><br/>'); // $rowData['idNum'] is an example of the record's primary key value }
×
×
  • 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.