Jump to content

Adam

Moderators
  • Posts

    5,717
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Adam

  1. ahh okay, testing at work with errors disabled, didn't think about that. Well to be hoenst wasn't really supposed to be anything more than a simple demonstration that you can still access $_GET and $_POST in the same way.. Adam
  2. You can just return them like normal, can't you? try this: test-class.php: <?php class Test { function printVars() { foreach ($_GET as $key => $val) { print 'GET: [' . $key . '] ' . $val . '<br />'; } foreach ($_POST as $key => $val) { print 'POST: [' . $key . '] ' . $val . '<br />'; } } } ?> test.php?some=vars&to=print: <?php include 'test-class.php'; $test = new Test(); $test->printVars(); ?>
  3. not too sure but try: $Picture = "\x0C0xFFD8FFE000104A46494600010101006000600000FFDB004300080606070605080707070909080A0C140D0C0B0B0C1912130F141D1A1F1E1D1A1C1C20242E2720222C231C1C2837292C30313434341F27393D38323C2E333432FFDB0043010909090C0B0C180D0D1832211C213232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232FFC00011080009000703012200021101031101FFC4001F0000010501010101010100000000000000000102030405060708090A0BFFC400B5100002010303020403050504040000017D01020300041105122131410613516107227114328191A1082342B1C11552D1F02433627282090A161718191A25262728292A3435363738393A434445464748494A535455565758595A636465666768696A737475767778797A838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE1E2E3E4E5E6E7E8E9EAF1F2F3F4F5F6F7F8F9FAFFC4001F0100030101010101010101010000000000000102030405060708090A0BFFC400B51100020102040403040705040400010277000102031104052131061241510761711322328108144291A1B1C109233352F0156272D10A162434E125F11718191A262728292A35363738393A434445464748494A535455565758595A636465666768696A737475767778797A82838485868788898A92939495969798999AA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3E4E5E6E7E8E9EAF2F3F4F5F6F7F8F9FAFFDA000C03010002110311003F00E2E8A28AF993F713FFD9"; Apparently "\x0C" is a special control sequence in PHP, like "\n" or "\r" that is specially for hexadecimal ASCII values.. ??? worth a bash Adam
  4. foreach($_POST as $job_id) { isn't the best way of looping through the jobs, with that $_POST['submit'] is also goin to be queried - with or without success. How are you sending the 'job_ids' to the script? Assuming there's a matching job id in each of the three tables it should work. It's either a problem with your logic or the inputs.. And I can't see enough code to say anything about the background colour problem.. Adam
  5. try changing "mysql_query($query);" to: "mysql_query($query) or die(mysql_error());" .. should tell you of any errors.. This may not be a great concern right now but you leave your script wide open to sql injections (google it for more information) .. Adam
  6. $this is a special variable in PHP used to access objects within a class.. the "->" operator is just used to access the child/parent of an object, say a function / method or a variable..
  7. Firstly you'll need to use the PHP extension on the file (unless you have configured your server to parse html files?) Then you'll need to pass a parameter through the URL, like so: <a href="second_page.php?link=1">Link 1</a> .. Doesn't have to be "link=1". Then on second_page.php you'll need to use some PHP to decide which option to select, quick and simple way of doing it.. <select name="link" id="link"> <option value="Link 1"<?php if ($_GET['link'] == 1) { echo ' selected'; } ?>>Link 1 was selected</option> <option value="Link 2"<?php if ($_GET['link'] == 2) { echo ' selected'; } ?>>Link 2 was selected</option> <option value="Link 3"<?php if ($_GET['link'] == 3) { echo ' selected'; } ?>>Link 3 was selected</option> </select> $_GET['..'] is used to return values sent in the URL, so $_GET['link'] holds the value of '1' if in the URL you had: 'link=1' .. Make sense? Adam
  8. You'll need to look into querying multiple tables: http://www.google.co.uk/search?q=mysql+query+multiple+tables
  9. PHP is parsed on the server before the web page loads **
  10. job_tb.cust_address = 'Cancel', blockbook.cust_address = 'Cancel', ... .. need commas!
  11. Also, disabling the checkbox will mean the value of the checkboxes aren't being sent..
  12. Try just printing out the value for each on your script, to check if it's a problem with the form or your PHP.. like (can't see form method): print $_GET['User'] . ' / ' . $_GET['Supplier'] . ' / ' . $_GET['Organizer'] . ' / ' . $_GET['Attractions'] . '<br /><br />'; Try just putting that at the top of your script and see what comes out. Also just a quick tip you don't use checked="checked" it's just checked, like: <input type="checkbox" name=".." value=".." checked /> Adam
  13. Have you tried googling it? 235,000 results ... http://www.google.co.uk/search?q=safari+javascript+debugger
  14. PHP is parsed before the server loads.. So calling functions on events like that is impossible without using JavaScript and AJAX to create a 'http request'. Google ajax for more info! Adam
  15. maxudaskin: while($row = mysql_fetch_array($query)) { // Do whatever } I'm trying to create a db handler class, using the standard functions would kind of defeat the point.. corbin: Ahh I wasn't aware the mysql_fetch_row function would return the next row every time it's called.. Cheers!
  16. Hah I've come to realise that mysql_result only returns one field from the row. But looking and I can't find another function that returns a whole row at a given row number? Like say: mysql_fetch_assoc($query, $rowNum); anybody know of one?? Cheers. Adam!
  17. I'm trying to setup my own db class, but have a problem with the "fetchRow" function. The query is being executed fine and this method does return part of the result but only the first field :S Been looking at this for a while and can't work it out... public function fetchRow() { if ($this->rowCount() == 0) return false; if (@$this->result = mysql_result($this->query, $this->row_id)) { $this->row_id++; return $this->result; } else { $this->row_id = 0; return false; } return true; } It's called in this way: while ($row = $db->fetchRow()) { print_r($row); } Can anybody spot the problem :S Cheers for any help! Adam[/code]
  18. I'd probably suggest using SMARTY, can integrate translation much easier using their template engine..
  19. May be wrong I'm certainly no expert with objects, but how can you put an object within another object?
  20. setCookie must be sent with the header, ie. before any HTML ..
  21. cheers guys. Got it sorted in end using array_multisort !
  22. cheers for the reply. Which of our ways is the quickest and/or best?
  23. found a soloution.. function sortBreadcrumbs($a, $b) { if ($a['title_order'] == $b['title_order']) { return 0; } elseif ($a['title_order'] < $b['title_order']) { return -1; } else { return 1; } } usort($breadcrumbs, "sortBreadcrumbs"); cheers anyway!
  24. Hi i've come across a problem in a PHP app I'm writing. I have a multidimensional array which looks like: $breadcrumbs[] = array( 'name' => 'Computers', 'title_order' => 3, ); There's about 6 or 7 $breadcrumbs similar to that. Basically I need to reorder breadcrumbs by 'title_order'. does anybody know how I could do that? Say something like: sort($breadcrumbs['title_order']); Anybody have any ideas? Cheers! Adam
  25. Adam

    help

    I think this is what you're looking for to select all the checkboxes(?): http://www.shiningstar.net/articles/articles/javascript/checkboxes.asp And to handle the data PHP side: http://www.w3schools.com/php/php_forms.asp .. is a good start. Adam
×
×
  • 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.