Jump to content

fishbaitfood

Members
  • Posts

    97
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

fishbaitfood's Achievements

Member

Member (2/5)

0

Reputation

  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.
×
×
  • 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.