midasxl's Profile
Reputation: 1
Apprentice
- Group:
- Active Members
- Active Posts:
- 181 (0.11 per day)
- Joined:
- 03-December 08
- Profile Views:
- 5,038
- Last Active:
Jan 25 2013 09:34 AM- Currently:
- Offline
Previous Fields
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: Display data from two tables - one to many relationship
Posted 24 Jan 2013
Thanks for the suggestions, I have put them to use and have come up with the following. I changed/added a couple of column names and re-named the table names. Hope that doesn't confuse viewers in relation to the earlier posts.
$sql = "SELECT x.eventid, title, discipline, body, eventlocation, date, imagepath, eventdate, starttime, endtime FROM cae_events_info as x INNER JOIN cae_event_dates as y on x.eventid=y.eventid ORDER BY x.eventid"; $result = mysql_query($sql); if($result) { $currGroup = -1; while($row = mysql_fetch_array($result)) { if($row['eventid'] != $currGroup) { echo '<hr>'; $currGroup = $row['eventid']; $day = 1; echo 'Event ID: ' . $row['eventid'] . "</br>"; echo 'Event Title: ' . $row['title'] . "</br>"; echo 'Discipline: ' . $row['discipline'] . "</br>"; echo 'Event Description: ' . $row['body'] . "</br>"; echo 'Event Location: ' . $row['eventlocation'] . "</br>"; echo 'Date Added: ' . $row['date'] . "</br>"; echo 'Image Path: ' . $row['imagepath'] . "</br>"; echo 'Dates: </br>'; } echo 'Date ' . $day . ': ' . $row['eventdate'] . "</br>"; echo 'Start Time: ' . $row['starttime'] . "</br>"; echo 'End Time: ' . $row['endtime'] . "</br>"; $day++; } }
With the two test events currently in the database, the above produces the following:
Event ID: 18354
Event Title: x
Discipline: x
Event Description: x
Event Location: x
Date Added: 2013-01-25
Image Path: event_images/exampleGIF.gif
Dates:
Date 1: 2013-01-06
Start Time: 02:00:00
End Time: 02:30:00
Date 2: 2013-01-05
Start Time: 01:00:00
End Time: 01:30:00
Date 3: 2013-01-04
Start Time: 12:00:00
End Time: 12:30:00
Event ID: 22185
Event Title: t
Discipline: t
Event Description: t
Event Location: t
Date Added: 2013-01-25
Image Path: event_images/exampleGIF.gif
Dates:
Date 1: 2013-01-26
Start Time: 01:00:00
End Time: 02:00:00
This is great! A very promising start. I now have to work on formatting for display in the browser. Within the multi-date event I would like to order the dates properly. Right now they're listed in reverse order.
If anyone sees room for improvement, I will welcome more suggestions.
Thank you all!
Cheers! -
In Topic: REGEX check for correct order of alpha characters
Posted 21 May 2012
Correct. It must only be smil.mil. I found and am messing around with the following:
var filter = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.(?:[A-Z]{2}|com|org|net|gov|edu)$/;
This accepts any two letter country code, and specific domains. Not exactly what I'm looking to do, but it seems to be in the right direction. Not sure how to adapt it to my needs.
Thanks! -
In Topic: Targeting a cloned element
Posted 30 Nov 2011
No takers huh? Must be too elementary. I'll figure it out. -
In Topic: keyup function targeting too many classes
Posted 21 Nov 2011
Sorry it took me awhile to resolve this one. Here is my solution:
var pocNum = $('.pocSection > div').length;//appears early in the logic newPoc.find('.LastName').bind("keyup", function(e){ var lnameLen = $(this).val().length; if(lnameLen > 2){ if($('#poc' + (pocNum) + ' .lname').hasClass('error')){ $('#poc' + (pocNum) + ' .lname').removeClass('error').addClass('check'); ); if($('#poc' + (pocNum) + ' .lname').hasClass('showError')){ $('#poc' + (pocNum) + ' .lname').removeClass('showError').addClass('check'); ); } });
I'm using the cascade and the unique id's to target the desired element. Possibly a more elegant solution, but it seems to work for now. Thanks! -
In Topic: keyup function targeting too many classes
Posted 3 Nov 2011
Sorry, I should have been a tad more thorough with my explanation. I was attempting to scale down the example for simplicity and I think I left out some vital information. Let's try again.
<form> <div id="poc1"> <span class="lname error"><input type="text" name="Last_Name" class="Last_Name"></span> <span class="fname error"><input type="text" name="First_Name" class="First_Name"></span> <span class="mi error"><input type="text" name="Middle_Initial" class="Middle_Inital"></span> </div><!-- close poc1 --> </form>
Then after a clone (with a div id renaming):
<form> <div id="poc1"> <span class="lname error"><input type="text" name="Last_Name" class="Last_Name"></span> <span class="fname error"><input type="text" name="First_Name" class="First_Name"></span> <span class="mi error"><input type="text" name="Middle_Initial" class="Middle_Inital"></span> </div><!-- close poc1 --> <div id="poc2"> <span class="lname error"><input type="text" name="Last_Name" class="Last_Name"></span> <span class="fname error"><input type="text" name="First_Name" class="First_Name"></span> <span class="mi error"><input type="text" name="Middle_Initial" class="Middle_Inital"></span> </div><!-- close poc2 --> </form>
The jquery:
$('.Last_Name').keyup(function(){ var lnameLen = $(this).val().length; if(lnameLen > 2){ if($('.lname').hasClass('error'){ $('.lname').removeClass('error').addClass('check'); } } });
Hope this makes the explanation a bit more clear. As you can see, the keyup tracks the length of the input on each keyup, and when it passes the threshold of '2', it targets the span element (class="lname") and changes its 'error' class to a 'check' class.
And the problem is: When I am entering information into the Last Name input of EITHER div, and trigger the class change, it affects the 'lname' span tag in BOTH divs. I will mess around with $(this) as you suggested; see what I can come up with.
Cheers!
My Information
- Member Title:
- D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
Contact Information
- E-mail:
- Private
Friends
midasxl hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given
|
Comments
midasxl has no profile comments yet. Why not say hello?