jerald717
Members-
Posts
12 -
Joined
-
Last visited
Everything posted by jerald717
-
Hi, I am relatively new to Javascript and PHP. I have managed to figure out how to implement lightbox in displaying an image upon the click of an <a href> link but what I really want to do is to embed the lightbox display in my website's index.php and have it auto-load when I access the url of my main page. I have searched the web for this and have not found any tutorial / solution. Would anyone be able to help in this area? Many thanks.
-
Hi, I've been messing around with a script downloaded off the net and have been running it on my localhost. However, I've encountered an error of this sort, when the script runs this particular query: "SELECT t2.field_label AS FLABEL, t1.* AS ID, t2.field_comment AS FCOMMENT FROM form_fields AS t1, form_field_translations AS t2 WHERE t1.field_id=t2.field_id AND lang='".$_SESSION['MDS_LANG']."' AND section='$section' AND form_id='$form_id' $where_sql order by field_sort "; the error is: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS ID, t2.field_comment AS FCOMMENT FROM form_fields AS t1, form_field_translati' at line 1 Problem is, I've found nothing on google on FCOMMENT, and I'm wondering if anyone has any clue what error this is. Thanks!
-
here's the EXPLAIN output for the abovementioned query, if it helps. id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE tols ALL NULL NULL NULL NULL 49990 Using where 1 SIMPLE tp ALL NULL NULL NULL NULL 16
-
LEFT JOIN gave an empty set still. I think it's got to do with WHERE (tols.subject_level_id = 1) AND (tols.subject_level_id = 2) which returns the null set? The problem is for each subject_level_id , it's stored in a different row. So there could be 2 entries for tutor A in tols. tutor A - subject 1 , tutor A - subject 2.
-
Hmm I dont think the JOIN will work as well as I'd want it to work though. I tried: and this returns an empty set. doesnt work the way intersect is supposed to work. I have 2 tables, tutor_overall_level_subject AS tols and tutor_profile AS tp, with tutor_id as key. in tols, one tutor_id can have many different subject_level_ids. I want to be able to query SQL such that I pull out tutors that have selected say subject levels 1 AND 2 (tutors who have selected only subject levels 1 or subject level 2 will not show up). anyone has ideas?
-
ah, the JOIN command? alright i'll check it out. thanks. basically, i'm trying to obtain an intersection of those 2 select queries, so that i wont have any "repeated" tutor_ids.
-
So apparently this doesn't work: tried looking and googling all over but can't seem to find anything wrong with it. Help?
-
Hi, I have a question. I performed an INNER JOIN on 2 tables, with tutor_id as key. the tutor_overall_level_subject table records tutor_ids with subject_level_ids, and it is a one-to-many relationship (i.e. 1 tutor could have 'chosen' many subjects). SELECT * FROM `tutor_overall_level_subject` INNER JOIN `tutor_profile` AS tp WHERE `subject_level_id` LIKE 1 OR `subject_level_id` LIKE 2 Part 1: The above-mentioned query returns rows with repeated information (i.e. tutor A could have chosen subjects 1 and 2--in which case tutor A's information is displayed twice). Is there any way for me to re-write this query to pull out tutor information only once? Part 2: I also want to modify the query to display the exact choices that the tutor makes (i.e. if tutor A had chosen subjects 1, 2 and 3 , this query wouldn't pull his information out. If he had chosen subjects 1 AND 2, this query should pull his information out. if tutor A had only chosen subject 1, his information wouldn't show). Thanks for all the help.
-
Alright, thanks man. for anyone else who could help, the js script i'm using to enable/disable my checkboxes is put below. I have set the default for the checkboxes as disabled, but somehow the js doesnt seem to be enabling them. Alternatively, if anyone could refer me to a tutorial/thread which has got to do with a similar problem, let me know thanks! <script type="text/javascript"> $(document).ready(function() { //Level_1 and subject_a $('label.subject_1').toggleClass('inactive'); $('#level_1').click(function() { $('label.subject_1').toggleClass('active'); $('.subject_a').each(function() { $(this).attr('disabled', !$(this).attr('disabled')); $(this).attr('checked', false); }) });// end click() </script>
-
I see. Yea I'm using a javascript to enable or disable the checkbox. Won't the value be changed through js? The reason I'm using javascript to do that is because I want to enable/disable a group of checkboxes using one checkbox. I'll see if I can post that script up after lunch. It could help if anyone could refer me to a thread or tutorial that does this? Will need to use the Id values of the checkbox to build search queries.
-
I actually meant $_POST['subject_level'] , apologies. That isn't working either. is there an issue accessing the checkbox values because of the echo?
-
Hi, so i have a problem. I'm using a script to enable and disable checkboxes, and i'm id-ing them fetching values from a database: while($data = mysqli_fetch_array($sql)) { if ($count % 5 == 0) { echo '</tr><tr>'; $count = 0; } echo '<td><input name="subject_level[]" class="subject_a" disabled="disabled" type="checkbox" id="subject_level_'.$data['subject_level_id'].'" value="'.$data['subject_level_id'].'"/>'; echo '<label for="subject_level_'.$data['subject_level_id'].'" class="subject_1">'.$data['subject_name'].'</label></td>'; $count++; //Increment the count } The names of the checkboxes come out fine, just that, is there any way to retrieve the values of the checkboxes into an array of some sort so that i could build a search query later? if($_POST(subject_level)) or if($_POST(subject_level[])) doesn't return true. does it make sense? im new to php so please forgive my ignorance. Help appreciated. Thanks!