Jump to content

fishbaitfood

Members
  • Posts

    97
  • Joined

  • Last visited

    Never

Everything posted by fishbaitfood

  1. Oh yeah, linking my tables with foreign keys isn't necessary for this. I need to dig in some more where using foreign keys is handy. Thanks for the JOIN query! Saved me severel rows of code!
  2. Hmm, yeah, I know, but I'm having trouble linking my two tables in MySQL. It's causing me a lot of errors.
  3. ManiacDan, ofcourse! Totally forgot about it, because I already have a loop for displaying the results. Sorry for starting this topic! Thanks again.
  4. Hi there, I have this query, which outputs the records properly in PhpMyAdmin. But when using this query inside my PHP code, the result is incomplete. Instead of retrieving the expected 15 results, I only get the first one twice. Also, I don't get any errors. <?php $get_files = "SELECT `id` FROM `files` WHERE `category` = 'W';"; include_once('connection.inc.php'); $con = mysql_connect(MYSQL_SERVER, MYSQL_USERNAME, MYSQL_PASSWORD) or die ("Connection failed: " . mysql_error()); $dbname = "myDB"; $select_db = mysql_select_db($dbname, $con) or die ("Can't open database: " . mysql_error()); $result_files = mysql_query($get_files) or die ("Query failed: " . mysql_error()); $files = mysql_fetch_array($result_files); $W_files = "'".implode("', '", $files)."'"; // echo $W_files; outputs the first number twice, instead of the expected 15 different ones $get_checklist = "SELECT * FROM `checklist` WHERE `id` IN ($W_files) ORDER BY `id` ASC;"; $result_checklist = mysql_query($get_checklist) or die ("Query failed: " . mysql_error()); // .... code for displaying ?>
  5. Thanks Adam, I can't believe I couldn't think of that myself! So obvious. Thanks for hinting that out.
  6. Hello there, I have two arrays with an equal amount of values. array fileList: names of files array file_numList: numbers of files I want those values to match their respective other, with a loop. Output would look something like this: for (var i = 0; i < fileList.length ; i++) { $("div.box").append("<input type=\"radio\" value=\""+file_numList[i]+"\" />"+fileList[i]); } This won't work however. And with an .each() loop, I can't seem to get an i counter? How would I do this?
  7. Indeed, forgot to apply the while loop. It works like a charm now! With jQeury $.each(data.files), I'm now able to generate my file radio button options. Thanks again, requinix!
  8. Thanks, requinix, that did the trick! BUT, I can only receive ONE file, even when there are two, three, ... I did some debugging, and when I execute the query in MySQL itself, I'm able to receive multiple filenames, as expected to work. But when using the same query with PHP and using print_r, there's only ONE (the first) file in the array. $select_files = "SELECT file FROM files WHERE customer = '$customer';"; How's this possible?
  9. Hmm, that would work, yes. My output would be something like this: output = array('customer' => $customer, 'address' => $address, '0' => file1, '1' => file2, '2' => file3, ...); My goal is, with jQuery, to loop through the FILES ONLY, and make them radio button options. Is this possible with the above output? Appreciate your help, many thanks!
  10. Thanks for your fast answer requinix! How would I dynamically fetch those values with jQuery? Maybe I could count the array in jQuery, then subtract the amount of other (standard) values, to get the amount of dynamic values? Or is this much more easier to solve? Because I need to be able to put those values where I want them on my webpage. EDIT: with the above code, I get a syntax error, unexpected T_INC, expecting '}' on the line $output["fileName{$i++}"] = $files["fileName"];
  11. Hello all, I have yet again trouble finding a logical solution to my problem. I'm fetching an array which can hold 1 or more values. The problem is, I want these values to ouput in my json_encode function, but this also needs to happen dynamically depending on the amount of values. I can't explain it further, so here's the code so far: $files = mysql_fetch_array($get_files); $a = count($files); $i = 1; while ($files) { $variablename = 'fileName' . $i; $$variablename = $files['fileName']; $i++; } $output = array( OTHER VALUES , 'fileName1' => $fileName1, 'fileName2' => $fileName2, 'fileName3' => $fileName3, ............); // How do I add the fileNames dynamically depending on how many there are? This got me thinking, I also need to dynamically GET the values with jQuery. How would I do that, when the above eventually works? Thank you.
  12. Problem solved. The CSS checked and unchecked background-position rules were neglected by .checklist label {}, which has the upperhand ofcourse.
  13. Hmm, although your code seems to be the right thing, it won't work. When toggling, no changes are made with the background-positions. And there are no errors in the console log.
  14. Aahh, it's so much more obvious when I see it in code! I'll test it out later this evening. Many thanks already!
  15. Thanks for your help, but that only works for two button states as far as I know. The problem is, I have 4 button states. So I need to put 2 class names in each toggle function, which won't work (overrides?). Or am I missing something? The button states are: - unchecked - unchecked, highlighted (mousedown) - checked - checked, highlighted (mousedown)
  16. Is there a way to get my 4 button states, according to mouseDown and Up, in each toggle function, to work in a .live('click') function instead? With toggle it's easy to have two functions, so I can have my 4 button states in it. But with a click function, I only have one function. How could I implement the toggle functionality with 4 button states in one click function? The toggle function in my first post works, but my button states only appear after the first click.
  17. Wow, another great, useful function I did not know about! Thanks! And damnit! It isn't available on my domain. So I guess I shall contact my domain's hosting service...
  18. echo $output["address"]; Echoing out the different data works fine. It's just so weird I don't get an output when echoing json_encode($output);
  19. Exactly.. that's why I'm here. It works perfectly on localhost. But somehow, on my domain, json_encode removes my data or something.
  20. PHP version: 5.1.2 MySQL Character set: UTF-8 Unicode (utf8) And my database collation is also set to 'utf8_general_ci'.
  21. With Firebug I get about the same error. Posting the customer to "get-customer-data.php" is OK. But with $.ajax success function, my $(".input-address").val(data.address); seems to be null. Firebug states: Data is null. $(".input-address").val(data.address); So from what I understand.. The array is present, so there IS data, but when json_encode comes in, $.ajax won't receive the data.
  22. The data is present, but json_encode won't work. Adding the header information won't help either. This is what I get when I var_dump $output: array(3) { ["address"]=> string( "Broadway" ["city"]=> string( "New York" ["country"]=> string(13) "United States" } On localhost json_encode outputs {"address":"Broadway", "city":"New York", "country":"United States"}. But on my domain I just get a blank page when testing this.
×
×
  • 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.