mr_scooby 0 Junior Poster in Training

Sweet cheers for the pointers,I will take th UI stuff out and out in in the main thread.

I will also take the presentation stuff out and put that separate.

Could you show me how to do this delegate stuff, I don't understand the examples I have read.

I am not a dev and this is a home project to organise my Movies, TV Shows, Music Videos and Rugby game collections that are spread across 2 or 3 locations into 1 central source.

mr_scooby 0 Junior Poster in Training

I have an app that I want to run the updating of each datagridview in the background on load concurrently instead of running sequentially on load. The code that gets loaded on app load is.

//##############################Movies

                   //update the list of filepaths
                   movieFilePaths_ = manageFilePathsFile.ReadFilePathsTextFile("Movie", filename);
                   //populate the list box
                   manageFilePathsFile.PopulateListBoxWithFilePaths(listBoxMoviePaths, movieFilePaths_);
                   if (movieFilePaths_.Count > 0)
                   {
                       movieList_ = onAppInitialLoad.GetMovieFilesFromActivePaths(movieFilePaths_, movieList_);
                   }

                   movieList_ = movieList_.OrderBy(x => x.FileName).ToList();
                   dataGridView1.DataSource = movieList_;

                   //##############################MusicVidoes

                   //update the list of filepaths
                   musicVideoFilePaths_ = manageFilePathsFile.ReadFilePathsTextFile("MusicVideo", filename);
                   //populate the list box
                   manageFilePathsFile.PopulateListBoxWithFilePaths(listBoxMusicVideoPaths, musicVideoFilePaths_);
                   if (musicVideoFilePaths_.Count > 0)
                   {
                       musicVideoList_ = onAppInitialLoad.GetMusicVideoFilesFromActivePaths(musicVideoFilePaths_, musicVideoList_);
                   }
                   musicVideoList_ = musicVideoList_.OrderBy(x => x.BandName).ThenBy(x => x.FileName).ToList();

                   dataGridViewMusicVideo.DataSource = musicVideoList_;


                   //##############################Rugby

                   ////update the list of filepaths
                   rugbyGameFilePaths_ = manageFilePathsFile.ReadFilePathsTextFile("Rugby", filename);
                   //populate the list box
                   manageFilePathsFile.PopulateListBoxWithFilePaths(listBoxRugbyFilePaths, rugbyGameFilePaths_);
                   if (rugbyGameFilePaths_.Count > 0)
                   {
                       rugbyGameList_ = onAppInitialLoad.GetRugbyGamesFilesFromActicePaths(rugbyGameFilePaths_, rugbyGameList_);
                   }

                   dataGridViewRugby.DataSource = rugbyGameList_;

                   interfaceOutputs.PopulateInterfaceOutputs(dataGridViewRugby, labelDataGridRugby);

Essentially each block beginning with //######################{name} would be run currently with the block above. I have implemented the backgroundworker on button presses to add and remove paths and running a single instance is easy.

I am stumped though on the best way to implement mutliple threads with out duplicating the current way I have of doing it, which is the code in full each time.

This is what I do to update a path and get the files from the background while the UI is still functioning.

Should I look at implementing backgroundworker as a class or method and calling that with parameters which would be each block of code? although I …

mr_scooby 0 Junior Poster in Training

Awesome thanks, between this and other google help I found eveything I need. Works mint.

mr_scooby 0 Junior Poster in Training

Hi guys, I am trying to connect to AD and want to be able to enter a group name and return all the members of that group.

I have no idea what I am doing or where to start.

I imagine that its not a lot of code I am looking for, am trying to build a tool for my service desk to use.

Any pointers in the right direction would be awesome.

mr_scooby 0 Junior Poster in Training

I use mediaportal as my mediacenter, with this I use the plugin mvcentral for my music videos.

This generates .db3 file, what I want to do is create a .net interface to view this file, with the intention of making it into an exe to have a portal database of my music videos.

I have no idea how to get the db3 file into my c# app and open, I have sqlexpress installed and can make db connections to this.

If someone could tell me how to import a db3 file into my project and then open it that would be awesome.

Thanks in advance

mr_scooby 0 Junior Poster in Training

I have this form that has a textarea that is compulsory, it has a checkbox that allows it to be ticked to show a hidden textarea using css/jquery.

What I would like is to know how to do the jquery to force input into the unhidden textarea only when the checkbox is ticked

heres the css onload to hide it

div.textarea {
    display: none;
}

heres my current jquery, top one displays the textarea if the checkobx is ticked, bottom one is the validation rules.

Needs to have some sort of if checkbox checked moreData required true, but i ahve no idea how to do this.

$(document).ready(function() {
    var visible = false;
    $('input[name="moreData"]').click(function() {
        var divs = $('div.textarea'); 
        if (visible) {
            divs.each(function() {
                this.style.display = 'none';
            });
            visible = false;
        }
        else {
            divs.each(function() {
                this.style.display = 'block';
            });
            visible = true;
        }
    });
 });   

$(document).ready(function() {
	// validate the comment form when it is submitted
	$("#test").validate({
	rules:
  {
			usernames:
      {
         required: true
      },
      moreData:
      {
         required: false 
      },
      
	},
	messages:
	{
    usernames: "<font color=\"red\" >User name required</font>"  
  }
  });
});

here is the html

<input type="checkbox" id="moreData" name="moreData" >More job description data required</b><br>

<div class="textarea">
        <textarea rows="40" Cols="90"></textarea>
</div>
</form>

Any help much appreciated.

mr_scooby 0 Junior Poster in Training

According to php.net http://www.php.net/manual/en/function.imap-body.php

the return of imap_body is: Returns the body of the specified message, as a string.

Anyway I just implemented it using string functions, bit more code but it works and means I can now continue on the PHP mail stuff, it works and the DB returns the right email address based on the serial number extracted.

Guess this stays as one of those annoying little things that you find workarounds for that does exactly the same job.

Cheers for all your help.

mr_scooby 0 Junior Poster in Training

The whole process is, we get an email from our printer maintenance company, I have written a script that goes to folders in the inbox and checks for unread emails, it takes the headers and body out and sends it via PHP to our job logging system. It logs a job, marks the email as read and then it needs the serial number to find the match in the DB and uses that match to get the email address of the person to forward the email to.

I have it working in that it gets the emails, logs the job and then marks it as read, I have the DB built and data entered. Now I just need a way of getting the serial number out of the email, it doesn't need to store the number, just needs it for that loop, as each loop represents an unread email that goes through the whole process, no more unread emails no more loops.

I have the code to send it to the DB and and do the check, , I have the serial number extraction working using the string functions suggested in post 2, but it takes about 3 inbuilt php functions to get the number, eg I find a starting point in the string, explode the string on white spaces, get the array position of the value I want and then trim the string.

Seems like a lot of work for a simple task, hence I thought …

mr_scooby 0 Junior Poster in Training

Thanks for that, although it was exactly what I had, which means that the problem is how I get the data into my variable. Which is done via the imap functions

$imap = imap_open("{my server address:143}inbox/folder", "mailbox name", "password") or die ('No server for you: '.imap_last_error());
$i = 1;
$body = imap_body($imap,$i,FT_PEEK);  // this sets the string to check
$test = preg_match('%Model\s+:\s+(\w{2,10})\s+(\w{5,20})%', $body, $matches);
print_r($matches);
    echo 'Model 1: ' . $matches[1] . '<br/>';
    echo 'Model 2: ' . $matches[2] . '<br/>';
    if($test)
    {
      echo 'Match Found';
    }
    else
    {
      echo 'Next Time';
    }

this returns nothing and echos Next Time, If I add a [ ] to preg_match pattern it returns a; 'D' and Match Found.

If I put the text on the script page and assign it to variable then use the above code it works fine, so that problem must be in the fact i am using imap to read an emails body and then try process it.

Any ideas?

mr_scooby 0 Junior Poster in Training
Model\s+:\s+(\w{2,10})\s+(\w{5,20})

\s allows whitespace
+ one or more
\w is a word character (letters, digit and underscore)
{2,10} between two and ten of the previous \w
() is a group that is returned separately

This is perfect, I got it working using the string functions post above yours but this is much more efficient, although I am struggling to work out how to get the last past

(\w{5,20})

to be returned as an array value, found a few examples that work on the net but unable to reverse this to get the same result, as it is the value in that last set of brackets I need to return.

Any pointers much appreciated.

mr_scooby 0 Junior Poster in Training

Hey guys, I need to be able to get a certain value out of the following.

Job#    :   442254 

Contact :   TO BE ADVISED

Model   :   BZ500  50GN02630

Purchase Order/Your Reference : 

Contract Type:  C3  CopyPlan - Contract Minimum   
Job Type:  H  Audit, Admin, Housekeeping

Fault/Problem(s) reported: 
CHECK SENTINEL EMAIL/HTTPS

Solution: 
Install KRDS 6 via IP Kit

Job Notes:  
machine seems to be out of storage now but not on 
sentinel. 
please setup sentinel via email concentrator

The template is always the same in certain areas and the line I am interested in is

Model   :   BZ500  50GN02630

This 'Model :' is always consistent it's the 2 values after that change and it is the last value that I am after.

So will need a preg_match that finds the words Model : and looks for another that contains letters and numbers and can be between 2-10 chars and then looks for the last
value on the line and returns that value, the last value is letters and chars and can be 5-20 chars.

Cheers

mr_scooby 0 Junior Poster in Training

Further looking tells me it might be a multi-part message, what I need it to do is tell me if it is multi-part and if so and possible just extract the text from the body and ignore the rest.

mr_scooby 0 Junior Poster in Training

Hey guys, have written a script that goes to an exchange mailbox and searches for unread emails and takes the headers and body data I require and add to an array.

What I want to do is check if the body of the email contains images/text or only text, is this possible?

mr_scooby 0 Junior Poster in Training

Hi, have this function below that gets the name of the pc, the local part works however the part that goes to the htpc fails, permission denied is the message.

I have set the same username/password as admin on both machines.

there must be some code I can use to send the credentials also?

any ideas greatly welcome.

function get_compter_name()
{
 alert('hi');
  //local pc
  var ax = new ActiveXObject("WScript.Network");
  document.write(ax.UserName + '<br />');
  document.write(ax.ComputerName + '<br />');
  //var object = new ActiveXObject("WScript.Shell");
  //object.Run("ipconfig.exe");
  // htpc
  try
  {
    var wmi = "winmgmts:\\\\192.168.1.10\\root\\cimv2";
    var query = ax.ComputerName;
    var processes = GetObject(wmi).ExecQuery(query);
    document.write(processes);
   }
   catch(e)
   {
      document.write('fail');       
   }

}
mr_scooby 0 Junior Poster in Training

Have the Javascript function below which takes the name of an input on the form passed as a variable so that 1 function can check many inputs as I have up to 3 fields per form that can accept this data range.

function contact_number_check(formObj,field)
{
  var obj = document.forms[formObj];
  var regExp = /^([0-9 ])+$/; 
  alert(field);
  //var check = obj.Extension.value;
  var check = obj.field.value;

	if (regExp.test(check) == false)
	{
		alert("Invalid Contact Number entered only 0-9 and Spaces allowed in input field");
		return false;
	}
	else
	{
	 return true;
	} 
}

it is called like this

var ext_check = contact_number_check(formObj,'Extension');

the problem is when I use the top line below it works if I name the field as it is called on the form, the field input box is named Extension in this instance. It does not work when I use the 2nd way of doing which is setting the value in the function parameter field and then passing it as a variable like I have in the 2nd line below

var check = obj.Extension.value;
var check = obj.field.value;

I know that field contains the value of Extension as when I alert(field); the out is the word: Extension.

Can I not use a variable this way in JS?

mr_scooby 0 Junior Poster in Training

Hey guys, what I want to do is have a page that only displays if javascript is enabled(or similar) in the sense that it tells users that js is not enabled and how to enable, what were doing is creating web forms and would only like them viewable if js is enabled so that we can validate client side and reduce server load.

Main reason is validation client side, cause if the initial form works well we will expand it to include forms for every type of job we can.

No idea to where to start as js is not a strong point.

Cheers

mr_scooby 0 Junior Poster in Training

sweet as dude that fixed it mint, have only tried it on my home wamp server and found it works ok with linking to files in the same folder. Tried to link to a couple of websites eg google and gaming forum and it didn't work.

Will take it to work and try it on our server there.

mr_scooby 0 Junior Poster in Training

Don't quite understand the above sorry dude, literally just need to display a web page with the following url: http://172.xxx.xxx.xxx./live/single.asp

<table><tr><td>
           <img goes here>
          </td>
          <td>
          /*
          video camera feed from http://172.xxx.xxx.xxx./live/single.asp
           needs code to keep rest of page static and have a 800x800 display box here
            */
</td></tr></table>
mr_scooby 0 Junior Poster in Training

I have this php based website, that displays a photo and draws data from a db to display on the page. Currently has a link to a live camera(viewed by internet browser) that opens in a separate page.

I have heard/read that using jquery you can create a iframe within your php page that you can link to another url(the camera for example) and display on the same page.

So in essence I could have my php page called displayPage load up and then inside that page I could section a 800x800 jquery frame that displays the live video feed with in.

Is this possible, I am restricted to using php as its the web server we run and it only needs to run in IE as we also use windows scripting on the page which relies on IE.

Looking at someone thing like this as eventually some of the data in the db will be taken from one location and stored by another team and the displayPage will not have access to the db just the web page that views it so would like to see if it will work with that also.

Is this possible?

mr_scooby 0 Junior Poster in Training

solved once I stopped and thought, form element needs to be inside the loop, creating new form each loop.

mr_scooby 0 Junior Poster in Training

Just wondering if someone can give me some insight to understand how the hidden type works on a form.

This form has 3 types of controls for storing the value of $id a radio button, check box and a hidden input(which has a button for each loop also). When it loops through the correct value is stored and returned in the radio button and the checkbox.

However when I click on the button that comes after the hidden $id it is always the number of the last record whether it is the 1st or last button pressed. I always assumed that the value of the button would be the hidden value.

I have googled but noting really super comes back, anyone know of any good articles that go indepth into the hidden value when looping through database searches or can shed some light on it.

function dispayRoomsForDelete()
{
	global $link;
	global $select;
	global $page;
	$sql = "SELECT id, room_num FROM main
			ORDER BY room_num";
	$result = mysql_query($sql, $link);
	echo "<strong><u>Select room to delete</u> </strong>";
	echo "<form action=\"",$page,"\" method=\"post\" >";
	echo '<table border="1" cellspacing="0" cellpadding="0" width="150px"><br />';
			while($row = mysql_fetch_assoc($result))
			{
				echo '<tr><td align="center" width="60px">';
					$id = $row['id'];
					echo "<input type=\"radio\" name=\"deleteRoomRadio\" value=\"" ,$id, "\" />";
					echo "r " ,$id," ";
				echo '</td>';
				echo '<td align="center" width="60px">';
					echo $row['room_num'];
				echo '</td>';
				echo '<td width="30px">';	
					echo "c " ,$id,"";
					echo "<input type=\"checkbox\" name=\"check\" value=\"",$id,"\"/>";
				echo '</td>';
				echo '<td width="30px">';	
					echo "<input type=\"hidden\" name=\"deleteRoomButton\" value=\"" ,$id, "\" />";
					echo "b …
mr_scooby 0 Junior Poster in Training

Did it like this,

echo '<input type="button" value="Delete Master List" onclick="deleteMasterList()"/>';

which calls this java function

function deleteMasterList()
{
    var yes = confirm("Delete Master List ??");
    if(yes)
    {
        window.location="delete.php";
    }
}

which if yes is clicked takes you to this page which simply deletes the data then returns you to main page

<?php
include('commonDirFunctions.php');
removeFromMasterList();
header("Location: index.php");
?>
mr_scooby 0 Junior Poster in Training

try this

<a href="http://localhost/AA_Directory_Reader/delete.php" onClick="return confirm('Are you sure you want to delete this Entry?')">Delete</a>

this works, but it is a link, which if given the choice I would prefer to do it by buttons.

mr_scooby 0 Junior Poster in Training

Hello all,

I have a php function that deletes the contents of a database table that relies on a javascript confirm box to tell it what to do as follows

javascript function as follows

function deleteMasterList()
{
	var outcome = confirm("Delete Master List, you will have to re-enter all band genres");
	
	if(outcome)
	{
		alert(outcome);
		<?php removeFromMasterList ?>		
	}
}

I now know this won't work as it will execute the php no matter what so I did this

function deleteMasterList()
{
	var outcome = confirm("Delete Master List, you will have to re-enter all band genres");
	
	if(outcome)
	{
		alert(outcome);
		window.location = "http://localhost/AA_Directory_Reader/delete.php" ;
			
	}
}

which is going to take me to a page that deletes the data from the database base then redirects back to the main page

except it does not take me there or to any other working web url I enter

this is the form i call it with

echo '<form action="index.php" method="post"  onSubmit="return(deleteMasterList())">';
echo '<input type="submit" name="delete_master_list" value="Delete Master List" /><br / >';
echo '</form>';

ideally I would like it to be one button press to get the confirm box to appear and then another to confirm or cancel, most examples I can find online use <a href> to link and do it via link to call there page not javascript

any ideas ?

cheers

mr_scooby 0 Junior Poster in Training

Try attempt 4 the following:

<label>Username</label><br />
<input name="name" type="text"  value="<?php if(isset($_POST['name'])) echo $_POST['name'] ?>"/>
<?php echo (!empty($arrErrors['name']))? '<span class="errortext">'.$arrErrors['name'].'</span>':''; ?>
<br />

works how I want except it doesn't validate

value="<?php if(isset($_POST['name'])) echo $_POST['name'] ?>

this line is the problem and in particular the " after value=, it throws the same 3 errors that attempt 1 did.

mr_scooby 0 Junior Poster in Training

Can ignore other post not sure why i closed it, not solved lol, not enough coffee too much looking at php anyway.

I have this form I'm working on and found something interesting

attempt1
this way works exactly how I want, which is nothing in the input boxes and no error messages on loading the registration form, once submit button is pressed the empty fields have a message appear next to them, the only problem is it does not validate on the w3 website

<label>Username</label><br />
<input name="name" type="text"  value="<?php if(isset($_POST['name'])) echo $_POST['name'] ?>"/>
<?php if (!empty($arrErrors['name'])) echo '<span class="errortext">'.$arrErrors['name'].'</span>';?>
<br />

error message is, all errors underline the " after the word value

#  Error  Line 78, Column 47: XML Parsing Error: Unescaped '<' not allowed in attributes values

…nput name="name" type="text"  value="<?php if(isset($_POST['name'])) echo $_P

✉
# Error Line 78, Column 47: XML Parsing Error: attributes construct error

…nput name="name" type="text"  value="<?php if(isset($_POST['name'])) echo $_P

✉
# Error Line 78, Column 47: XML Parsing Error: Couldn't find end of Start Tag input line 78

…nput name="name" type="text"  value="<?php if(isset($_POST['name'])) echo $_P

attempt 2
this code validates

<label>Username</label><br />
<input name="name" type="text"  value="&lt;?php if(isset($_POST['name'])) echo $_POST['name'] ?&gt;"/>
 <?php if (!empty($arrErrors['name'])) echo '<span class="errortext">'.$arrErrors['name'].'</span>';?>
<br />

however on loading the form this code appears in the text area which makes it look very ugly, it does this because of the < being changed to &lt; and > to &gt; and simply treats it as input

<?php …
mr_scooby 0 Junior Poster in Training

all good, had it right the 1st time

mr_scooby 0 Junior Poster in Training

I have this form I'm working on and found something interesting

attempt1
this way works exactly how I want, which is nothing in the input boxes and no error messages on loading the registration form, once submit is entered the empty fields have a message appear next to them, the only problem is it does not validate on the w3 website

<label>Username</label><br />
<input name="name" type="text"  value="<?php if(isset($_POST['name'])) echo $_POST['name'] ?>"/>
<?php if (!empty($arrErrors['name'])) echo '<span class="errortext">'.$arrErrors['name'].'</span>';?>
<br />

error message is, all errors underline the " after the word value

#  Error  Line 78, Column 47: XML Parsing Error: Unescaped '<' not allowed in attributes values

…nput name="name" type="text"  value="<?php if(isset($_POST['name'])) echo $_P

✉
# Error Line 78, Column 47: XML Parsing Error: attributes construct error

…nput name="name" type="text"  value="<?php if(isset($_POST['name'])) echo $_P

✉
# Error Line 78, Column 47: XML Parsing Error: Couldn't find end of Start Tag input line 78

…nput name="name" type="text"  value="<?php if(isset($_POST['name'])) echo $_P

attempt 2
this code validates

<label>Username</label><br />
<input name="name" type="text"  value="&lt;?php if(isset($_POST['name'])) echo $_POST['name'] ?&gt;"/>
 <?php if (!empty($arrErrors['name'])) echo '<span class="errortext">'.$arrErrors['name'].'</span>';?>
<br />

however on loading the form this code appears in the text area which makes it look very ugly, it does this because of the < being changed to &lt; and > to &gt;

<?php if(isset($_POST['name'])) echo $_POST['name'] ?>

attempt 3
which validates

<label>Username</label><br />
<?php echo "<input name=\"name\" type=\"text\"  value=\"" if(isset($_POST['name'])) echo $_POST['name'], "\" />";
 if (!empty($arrErrors['name'])) echo '<span class="errortext">'.$arrErrors['name'].'</span>';
echo "<br />"; …
mr_scooby 0 Junior Poster in Training

awesome thanks for your help, has given me a heaps better understanding of forms with javascript

cheers

mr_scooby 0 Junior Poster in Training
<script>

	1.var obj = document.forms[formObj];

</script>
<form action="login.php" method="post" name="postingForm" id="postingForm" >


<input type="button" name="submitbtn" value="Submit" onclick="checkAll('postingForm')" />

the only javascript bit i'm not too sure of is 1
1 = get all the ids or names of the form?

just curious as to why both the name and ID are required?, I 'm assuming the name could and ID could be anything so long as they are the same.

You the name the input type "button" and use onclick to call the function and it only goes to login.php if the line

document.forms[formObj].submit();

is reached

mr_scooby 0 Junior Poster in Training
function checkAll(formObj)
{
	alert("formObj here");
	var obj = [];
	obj[0] = document.getElementById("name");
	obj[1] = document.getElementById("psw");

	alert("formObj here1");
	for (i=0; i<obj.length; i++)
	{
			alert("inside formObj here");
		  
		  if (obj[i].value == "")
		  {
			alert("inside formObj here111");
			
			alert("Input item on Row #"+(i+1)+" has been left empty. Please make sure you input something into this field.");
			return false;
		  }
	}
}

this seems to work, its not quite how I pictured it working, but once you pointed out that ID is unique it became much easier

cheers

mr_scooby 0 Junior Poster in Training

As far as I know there is no such thing as getElementsbyId there is only getElementById .

The id's have to be unique, see also w3schools

given then that each id is unique, how would I go about creating an array to loop through each one to check for input, like I said doing it by name is easy but then I need the unique name to use for php $_POST

I tried

name = document.getElementByID('name');
	psw = document.getElementByID('psw');
	check_obj = new array(name,psw);

excuse the heaps of questions but anything outside of basic-intermediate php/html for web is still new to me.

mr_scooby 0 Junior Poster in Training

this is weird, when I do it by name it works

unction checkAll(formObj)
{
	alert("formObj here");
	
	check_obj = document.getElementsByName("input[]");
	alert("formObj here1");

	for (i=0; i<check_obj.length; i++)
	{
		alert("inside formObj here");

	  if (check_obj[i].value == "")
	  {
	alert("Input item on Row #"+(i+1)+" has been left empty. Please make sure you input something into this field.");
		return false;
	  }
}

if I change it to by ID, it doesn't work

function checkAll(formObj)
{
	alert("formObj here");
	
	alert("formObj here");
	check_obj = document.getElementsById("input[]");
	alert("formObj here1");

	for (i=0; i<check_obj.length; i++)
	{
		alert("inside formObj here");

	  if (check_obj[i].value == "")
	  {

		alert("Input item on Row #"+(i+1)+" has been left empty. Please make sure you input something into this field.");
		return false;
	  }
}

why would it work on name buy not id? does ID not support arrays? I need to have unique names so that I can post it to php, hence the need to use Id's I believe

mr_scooby 0 Junior Poster in Training

using the same id so that I can use

document.getElementsByID

incase I add more fields then I can just include them in the check, I don't want to do it by name as I use the unique name for the php validation

mr_scooby 0 Junior Poster in Training

hello, I have this form which has 4 fields that must not be empty on submit, I been trying to make an array that checks them.

<form action="login.php" method="post" onsubmit="return(checkAll(this))">
						<label>Username<br /><input id="input[]" type="text" name="username" /></label><br />

						<label>Email<br /><input id="input[]" type="text" name="email" /></label><br />

						<label>Password<br /><input id="input[]" type="password" name="pswd1" /></label><br />

						<label>Password Again<br /><input id="input[] "type="password" name="pswd2" /></label><br />

						<input type="submit" name="submit" value="Submit" />

						<input type="reset" value="Reset" />

						</form>

so far i have

function checkAll(this)
{
     document.getElementById("input[]")
     //for loop will go here
}

to be honest not sure were to start, at this stage I need to check whether there empty and the the username/password only has a-z0-9 and the email passes a regExp test.

I know how to write individual functions to check fields/regExp but have now idea how to loop it thru an array to do both.

any help much appreciated

mr_scooby 0 Junior Poster in Training

kk looks like i need to use a trigger to check before inserting a record, so far I have come up with this

CREATE TRIGGER cdNumberCheck BEFORE INSERT ON `cdCreation`
FOR EACH ROW
IF cd_Number >= 5 THEN
	/* need code to go here if above*/
END IF

this seems to be along the right lines, just I can't seem to find anything that will work as to throw a message that tells me limit reached.

mr_scooby 0 Junior Poster in Training

kk I never realized that by default it would do it, each time you add a new record by simply adding AUTO_INCREMENT to the cd number, would I be safe in assuming this happened because i used both columns as primary keys?

So just the matter of been able to cap the number of dvd's made.

mr_scooby 0 Junior Poster in Training

I have a table that holds a users id and a cd number, what I would like is to be able to only increment the cd number based the users id not just incrementing it every time a new cd is created

table

CREATE TABLE IF NOT EXISTS `cdcreation` (
  `user_Id` int(3) NOT NULL,
  `cd_Number` int(2) NOT NULL,
  PRIMARY KEY (`user_Id`,`cd_Number`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

user id's start at 100, so if an id is present but no cd user 100 will get cd 1, if user 101 has no cd they get cd 1 as well, when user 100 makes next cd they get cd 2 and when user 102 gets 1st cd they get cd 1, so it increments based on user number and cd number.

Both cd number and user id will form the primary key, I would also like to be able to max the number of cd's able to be created to 5(this is not critical but a preference) I use AUTO_INCREMENT in other parts of my db but not sure how to implement it this way based on a user id.

any help much appreciated

mr_scooby 0 Junior Poster in Training

Have found out a way to do the user input and the static site data, just going to start work on the sql database data.

All working, trial and error is mint.

mr_scooby 0 Junior Poster in Training

hi guys, I would like to be able to take all the output of a order form and the database output of the selected items and return it to a xml document.

I tried the
file_get_contents and that just took the actual code from the php page.

My website is all php pages and the checkout page displays the final purchase details, eg title, volume and cost and the user details eg, name, number and address.

some output comes from a function

paymentDetails();  // displays bank details contains 3 lines txt
contactUs();          // displays our address contains 4 lines txt

and then some comes from variables/post

$name = $_POST['name'];
$email = $_POST['email'];
$number = $_POST['number'];
$bAddress = $_POST['billingAddress'];
$sAddress = $_POST['shippingAddress'];

and then the items ordered and the cost/total cost from a sql database

showCostsCheckout();

I just want to be able to write everything that is displayed on screen once the order is confirmed to a xml document.

I'm assuming that its fwrite() or something similar, just can't find anything that captures it.

cheers

mr_scooby 0 Junior Poster in Training

that is awesome thanks dude.

mr_scooby 0 Junior Poster in Training

hi guys, I have 2 tables, one called neworders which stores the part_id and num or parts and a 2nd table called parts which has all the part details including cost.
tables are as follows

neworder 
part_id(primary key)
number_of_parts

parts
part_id(primary key)
7-8 more columns, eg size, desc, sup id
cost

what i need to do is get the sum of the costs based on the quantity of the parts ordered

so if table is as follows

table new order
part_id number_of_parts
pt12     2
pt255   4

I need to use the part_id of the neworder table to get the costs of the parts and then add them up with sum based on number of parts ordered.

I have no idea how to do this, any help would be awesome

mr_scooby 0 Junior Poster in Training

awesome, did the job exactly thank you.

mr_scooby 0 Junior Poster in Training

Hello, I have 2 php forms, the first that takes the input and sends it to the second form which checks to see if the fields are empty.

What I have to do is if both fields are not entered is return to the main page and highlight the field/s that is not fill with an asterix, If one of the fields was entered I need to return that value to the textbox on the first page and then link back to the first page to enter in the missing field.

here is the first page input.php

$asterixFirst = "";
$asterixLast = "";
// check for asterix value
if ($checkFirst == false)
{
	$asterixFirst = "* required";
}
else
{
	$asterixFirst = "";
}
if ($checkLast == false)
{
	$asterixLast = "* required";
}
else
{
	$asterixLast = "";
}


echo "<form action=\"inputcheck1.php\" method=\"post\">";
echo "<p>Enter first name: <input type=\"text\" name=\"first\" />", $asterixFirst, "</p>";
echo "<p>Enter last name: <input type=\"text\" name=\"last\"/>", $asterixLast, "</p>";
echo "<input type=\"submit\" value=\"Process\"/>";

echo "</form>";
?>
</body>
</html>

here is the 2nd page

<?php
if ((checkFirst() == false) && (checkLast() == true))
{
	echo "First name needed";
}
elseif ((checkFirst() == true) && (checkLast() == false))
{
	echo "Last name needed";	
}
elseif ((checkFirst() == false) && (checkLast() == false))
{
	echo "Both fields need filing";
}
else
{
	echo "First Name: ", $_POST['first'];
	echo "<p>Last Name: ", $_POST['last'], "</p>";
	echo "<a href=\"emptyinput1.php\">return to main page</a>";
}
?>

<?php
function checkFirst()
{	
	$_POST['first'] = …
mr_scooby 0 Junior Poster in Training

sql and access, solved the problem. cheers

mr_scooby 0 Junior Poster in Training

Hi, I have 2 tables that I have made using sql create table which seem to work ok until I try to insert data into the 2nd table then it throws a: didn't add 1 record due to key violations.

When I use the design wizard and do exactly the same thing but without using sql it works fine.

table 1 sql- user table

CREATE TABLE User (
userEmailAddress varChar(255) not null PRIMARY KEY, 
userFirstName varChar(100) not null,
userLastName varChar(100),
userStatus varChar(1) not null,
userNickName varChar(40),
userMifrenzPassword varChar(10) not null,
UserEmailPassword varChar(10) not null,
userDOB date
)

table 2 sql - email options table

CREATE TABLE Email_Options (
emailNumber number not null PRIMARY KEY,
userEmailAddress varChar(255) not null, 
emailProvider varChar(255) not null,
popServerAddress  varChar(255) not null,
smtpServerAddress  varChar(255) not null,
popServerPort varChar(6) not null, 
smtpServerPort varChar(6) not null,
FOREIGN KEY(userEmailAddress) references user(userEmailAddress)
)

have spent ages trying to find a solution and just don't know enough

Like I said everything works ok when I do it using the design wizard and creating the relationships manually, however when I use sql I get exactly the same physical layout and view in the view and relationship view, except I get the cannot add record due to key violation.

I get the message when updating the email options table, updating the user table works fine.

Any ideas?? I'm lost :(

mr_scooby 0 Junior Poster in Training

hi guys, done heaps of googling and everything leads me to two outcomes.

1. You can't do it

2. You can do it this way

INSERT INTO User(userEmailAddress, userFirstName,userLastName,userStatus,userNickName,userMifrenzPassword,userEmailPassword,userDOB)

SELECT 'overthehill@gmail.com','Ben','Hill','U','benny','milk','soccer','20-10-2000'
UNION ALL

SELECT 'smithy@gmail.com','Tony','Smith','A','smithy','bread','rugby','20-11-1976'
UNION ALL

SELECT 'hotpants@gmail.com','Sarah','Jane','U','hotty','toast','netball','15-1-2000'
UNION ALL

SELECT 'traci@gmail.com','Traci','Hill','U','raisins','coffee','hockey','20-10-2000'
UNION ALL

SELECT 'lol@gmail.com','Ben','Johns','U','stubby','jam','rowing','10-2-2001'
UNION ALL

SELECT 'ss@gmail.com','Sarah','Smith','U','shorty','ham','running','5-5-2000'
UNION ALL

SELECT 'bob@gmail.com','Bob','Cawte','A','bob','eggs','bobsled','29-3-1980'

except it throws a

Syntax error(misisng operator) in query expression "20-10-2000"
UNION ALL

SELECT 'smithy@gmail.com".

worst comes to worst I can use individual INSERT commands to demonstrate my database in class, but I have 40+ records for 2 tables so was trying to find a quicker way of doing it in two statements instead of 80.

Anyone know if you can do this?

cheers

mr_scooby 0 Junior Poster in Training

yeah did some further reading and couldn't find anything, so installed an app that reads the tables and exports the sql and you have to do it via ALTER TABLE

mr_scooby 0 Junior Poster in Training

Was just wondering if anyone here is an Access master

have this code that I want too add a CHECK too but keeps on throwing a syntax error

CREATE TABLE Email (
userEmailAddress memo not null, 
timeDate datetime not null,
contactEmailAddress memo not null,
emailBoxType text(6) not null,
readStatus binary(1) not null,
subject text(255),
message memo, 
primary key(userEmailAddress, timeDate),
)

and this is the check

CHECK (readStatus 'Y' 'N')

have tried all sorts of combination's but just can't get it to work, have googled and copied exactly how they use it but still just throws a syntax error.

Any help greatly appreciated.

mr_scooby 0 Junior Poster in Training

found the problem, I cut the entire folder with all the docs in and pasted somewhere else, then ran it from there and everything was ok.

Really weird, I had done the cntl f5 trick, restarted the browser, even tried restarting the pc and yet it didn't fix it, the project folder was on my desktop at the time and is now in one of my drives.

anyway problem fixed.


Traevel thanks for your answers will have a good look at your suggestions, thanks heaps :)