
madcrazy1
Members-
Posts
48 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
madcrazy1's Achievements

Member (2/5)
0
Reputation
-
need to throw validate flag only if no fields are filled
madcrazy1 posted a topic in Javascript Help
I need code to throw validate flag only if no fields are filled Current code below throws validate flag if any field is empty. Many thanks! (a flag has a background of error.png no flag has a background of checked.png) validates errors on all the fieldsets records if the Form has errors in $('#formElem').data() */ function validateSteps(){ var FormErrors = false; for(var i = 1; i < fieldsetCount; ++i){ var error = validateStep(i); if(error == -1) FormErrors = true; } $('#formElem').data('errors',FormErrors); } /* validates one fieldset and returns -1 if errors found, or 1 if not */ function validateStep(step){ if(step == fieldsetCount) return; var error = 1; var hasError = false; $('#formElem').children(':nth-child('+ parseInt(step) +')').find(':input:not(button)').each(function(){ var $this = $(this); var valueLength = jQuery.trim($this.val()).length; if(valueLength == ''){ hasError = true; $this.css('background-color','#FFEDEF'); } else $this.css('background-color','#FFFFFF'); }); var $link = $('#navigation li:nth-child(' + parseInt(step) + ') a'); $link.parent().find('.error,.checked').remove(); var valclass = 'checked'; if(hasError){ error = 1; valclass = 'error'; } $('<span class="'+valclass+'"></span>').insertAfter($link); return error; } /* }); -
<?php $var=$_POST["fname"]; $xmlDoc = new DOMDocument(); $xmlDoc->loadXML($var); $root = $xmlDoc->documentElement; $elms = $root->getElementsByTagName("*"); foreach ($elms as $item) { // gets the name and the value of each $item $tag = $item->nodeName; $value = $item->nodeValue; // outputs the $tag and $value echo $tag. ' = '. $value . ''; I want to use the code above to get all the xml files parent and child names and values and get them into the database. is this going to work? thanks in advance
-
Thanks, I read it but I could'nt see where it fit my situation, I am a complete idiot when it comes to real xml especially with multiple parents. I actually need someone to write it out for me
-
I'm open to that
-
this is what i have so far: $var=$_POST["fname"]; $xmlDoc = new DOMDocument(); $xmlDoc->loadXML($var); I would like to use something similar to this included in it before sql insert: for($c = 0; $c<$node->length; $c++) { 1 root, 4 parents and varying childs I believe? <node> <building>Number 65</building> <workers><label>executive</label><names>john</names><label>cook</label><names>terry</names><label>waitress</label><names>jill</names><label>buser</label><names>4564646</names><label>Main</label><number>45564646</number><label>home fax</label><number>45964646</number></workers> <food><label>breakfast</label><meal>eggs</meal><label>lunch</label><meal>turkey</meal><label>dinner</label><meal>steak</meal></food> <addresses><label>Home</label><Country>usa</Country><Street>123 mulberry ln </Street><ZIP>57888</ZIP><City>teledo</City><State>Ohio</State><label>location</label><Street>turnpike east 23</Street><City>danbury</City><State>Connecticut</State><Country>USA</Country></addresses> <building>Number 66</building> etc... </node> Thank you!
-
I am familiar with sort order on querying a database but am not familiar with how to store it in a particlar order.
-
I have a table with a row for name and a row for number. Specific number belongs to specific name (eg.. telephone number) I have table set for utf8_general_ci I have a primary key auto_increment=1 I define two rows as UNIQUE name,number data is inserted FROM XML node The trouble is that after insert, I see all names and numbers inserted except that the numbers were inserted sequentially (values low to high) with respect to the primary key's values (low to high) erroneously mixing the name, number pairs. Any ideas? I need the data inserted in "document form" (order as they are reported/sent to query) Thank you.
-
Thank you. It worked nicely!
-
Sorry: PHP Version 5.2.2
-
what is the correct sql query to: drop all tables where row count=0 Thank you
-
using insert ignore now with unique undex but cant get rand to work. have a nice day
-
I would like it to work this way if possible. All ive been getting is blank db entries, ive eliminated the rand til i can get this to work, is this possible? i had a hard time trying to integrate/format into existing code the $tryingName example you gave before. $l1="larry"; $RunThisQuery = "SELECT namx FROM mytable WHERE namx='$l1'"; $result = $connector->query($RunThisQuery); $bbb=$row['memn']; if($bbb==$l1){ $name = "fromdb"; }else{ $name = $l1; }
-
well i just saw your post, thanks for the quick reply but i was trying to get this to work, if not i will try your way: $p7=$userinput; $ID = mysql_query("SELECT pid FROM ".$users6." WHERE row_namex = '$p7' "); if ($ID){ $name = $p7.rand(0,9); }else{ $name = $p7; } everything seems to be working except when i try to add the same name twice, it doesnt put the random number next to($p7) it, is that strange?
-
Sorry, actually, i do like the first answer very much, it took a couple looks at it to decifer it but i will like to add the random function that answer 2 has instead of arbitrary "suffix" good work! Will now try to implement and report back with result
-
Sorry, I don't like the first answer, it is too abstract for me. Thwswcond answeris a bit closer to what i'm looking for but i am not sure what is meant by "unique index" if anything I want the code executed on non-uniqueness all in all thanks for the help but other solutions or additions to existing are welcome