hielo 65 Veteran Poster
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>
<HEAD>
<TITLE>eSales Center - Customer Links</TITLE>
<META HTTP-EQUIV="Cache-Control" CONTENT="No-Cache">
<META HTTP-EQUIV="Pragma" CONTENT="No-Cache">
<META HTTP-EQUIV="Expires" CONTENT="0">


<SCRIPT LANGUAGE="SpeedScript">

{shared/esalesvars.i}
{shared/validate-session.i}
{shared/pp-global.i}

assign cLogin = if trim(cLogin) = "" then get-value("operinit") else cLogin.

</SCRIPT>
</HEAD>
<BODY>
<SCRIPT type="text/javascript">

switch (cLogin)
{
	case "12102":
		document.write('<a href="/WI_testweb/12102.xls"><b><font size="3">Matrix</font></b></a><br />');
		break;

	case "134965":
		document.write('<a href="/WI_testweb/12102.xls"><b><font size="3">Matrix</font></b></a><br />');
		break;

	case "13953":
		document.write('<a href="/WI_testweb/12102.xls"><b><font size="3">Matrix</font></b></a><br />');
		break;

	case "13716":
		document.write('<a href="/WI_testweb/13716.xls"><b><font size="3">Matrix</font></b></a><br />');
		break;

	case "111667":
		document.write('<a href="/WI_testweb/111677.xls"><b><font size="3">Matrix</font></b></a><br />');
		break;

	default:
		window.alert("This account does not have a custom matrix");
}
</SCRIPT>
</BODY>
</HTML>
hielo 65 Veteran Poster

try:

header("refresh: 1; url=" . $_SERVER['PHP_SELF']);
echo substr(time(),-2,2);

http://www.desilva.biz/php/phprefresh.html

hielo 65 Veteran Poster

make sure your FORM tag is as shown below and get rid of the name attribute in the option tags

<form id="form1" action="" method="post">
<p>Gender: <br>
    <select name="gender">
      <option selected="selected" value="">Choose....</option>
      <option value="male">Male</option>
      <option value="female">Female</option>
    </select>

<% 
if request.form ("gender") = "male" then
%>
<input type="submit" value="Submit" name="btnSubmit" onClick="document.form1.action='send_it.asp';return true;">
<%
else
%>
<input type="submit" value="Submit" name="btnSubmit" onClick="document.form1.action='send_it_female.asp';return true;">
<%
end if
%>
</form>
hielo 65 Veteran Poster

Curl is used for http requests. Based on the sample port you posted, you are probably wanting to connect to an FTP server (Port 21). If so, refer to the FTP functions in php:
http://www.php.net/manual/en/function.ftp-connect.php

IF you are in fact running an HTTP server, then on the following link:
http://blog.unitedheroes.net/curl/

the third example under the "What to do" section shows you how to use curl.

An alternative to curl would be:
file_get_contents();
http://us.php.net/manual/en/function.file-get-contents.php

So if you know the image url, try:

$opts = array(
  'http'=>array(
    'method'=>"GET",
    'header'=>"Accept-language: en\r\n" .
              "Cookie: foo=bar\r\n"
  )
);

$context = stream_context_create($opts);

file_put_contents( $_SERVER['DOCUMENT_ROOT'].'/theRemoteImage.gif', file_get_contents('http://remotesite.com/image.gif'), 0, $context);
hielo 65 Veteran Poster

instead of: var request = new Ajax.Request('basket.php', ... try: var request = new Ajax.Request('basket.php?cb='+ (new Date()).valueOf(), ...

hielo 65 Veteran Poster

if you are referring to the alignment, try:

document.getElementById('basketerror').innerHTML = "<div>That item is already in your basket.</div>";
hielo 65 Veteran Poster
function idade(object, birthDay){
	var now = new Date();
	bD = birthDay.value.split('/');
	if(bD.length==3){
		var born = new Date(bD[2], bD[1]*1-1, bD[0]);
		var age=now.getFullYear() - born.getFullYear();
		var yearBD = new Date(now.getFullYear(), bD[1]*1-1, bD[0]);
		if( now.valueOf() < yearBD.valueOf()  )
			--age;
		document.getElementById("computedAge").value = age;
	}
}
hielo 65 Veteran Poster

You are welcome. Please be sure to mark the thread as solved.

Regards,
Hielo

hielo 65 Veteran Poster

My apologies for the oversight. In my original code, I forgot to add ".value" at the end of the statements that retrieve the Month, Day, and Year. It should have been:

var Day=document.getElementById('daysOfMonth').value;
var Month=document.getElementById('monthOfYear').value;
var Year=document.getElementById('year').value;
hielo 65 Veteran Poster

Do you have url to your page? Most likely the issue is in basket.php

hielo 65 Veteran Poster

it should be: var submit = document.getElementsByName("submit")[0]; getElementsByName() returns a collection/array, NOT a single element. My suggestion would be to give your button an id="submitButton" and then use this instead:

var submit = document.getElementById("submitButton");

since IDs are supposed to be unique throughout the page, then you don't need that suffix [X] because document.getElementById returns a single element, not a collection/array.

hielo 65 Veteran Poster
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>teste</title>
<script>
function idade(object, birthDay){
	var now = new Date();
	bD = birthDay.value.split('/');
	if(bD.length==3){
		var born = new Date(bD[2], bD[1]*1-1, bD[0]);
		document.getElementById("computedAge").value = ( now.getFullYear() - born.getFullYear() )
	}
}
</script>
</head>


<body>
<form action="" method="post" name="form">
	<table summary="" style="width:10%">
		<tbody>
			<tr>
				<td>
					<input name="datanascimento" type="text" style="display:block;width:100%" onchange="idade(this.form, this);"/>
					<input id="computedAge" name="AGE" type="text" style="display:block;width:100%" readonly="readonly">
				</td>
			</tr>
		</tbody>
	</table>
</form>
</body>
</html>
hielo 65 Veteran Poster

You need to make sub-arrays:
'OldValidFrom'=> array("25/08/2010","26/08/2010","27/08/2010"),

'OldValidTo'=> array("26/08/2110","26/08/2110","27/08/2110"),

hielo 65 Veteran Poster

Try making the following changes:

...
var Day=document.getElementById('daysOfMonth');
var Month=document.getElementById('monthOfYear');
var Year=document.getElementById('year');

var str = Month + " " + Day + " " + Year;
alert(str);
var selectedDate= new Date(str);
...

I was expecting str to be SIMILAR to:
August 28 2010

What does the code above alert() for you?

hielo 65 Veteran Poster

OK, I read your follow-up problems again and I believe I have a clear understanding of your problem. Try:

<?php
error_reporting (E_ERROR);
$query="	SELECT	`Pos`
				,`Last`
				,`First`
				,`CFHL_A` AS `CFHL`
				, `Team`
				,`BDay`
				,`GP0910`
				,`PTS0910` 
			FROM `playerdb` 
			WHERE `CFHL_A`='FREE' 
				AND `Pos`='D' 
	UNION ALL 
		SELECT	`Pos`
				,`Last`
				,`First`
				,`CFHL_B` AS `CFHL`
				, `Team`
				,`BDay`
				,`GP0910`
				,`PTS0910` 
			FROM `playerdb` 
			WHERE `CFHL_B`='FREE' 
				AND `Pos`='D' 
	ORDER BY `PTS0910` DESC, `GP0910` ASC, `Team` ASC";

$result = mysql_query($query) or die("<hr/>Problems executing:<br/>$query<br/>" . mysql_error() );  

echo "<table width='350' border='1' cellspacing='0' cellpadding='1' bgcolor='ffffff'>";
echo "<tr> 
<td width='15' bgcolor='000000' align='center'><font face='arial' size='1' color='ffffff'><b>#</b></td>
<td width='20' bgcolor='000000' align='center'><font face='arial' size='1' color='ffffff'><b>POS</b></td>
<td width='170' bgcolor='000000' align='center'><font face='arial' size='1' color='ffffff'><b>PLAYER</b></td>
<td width='10' bgcolor='000000' align='center'><font face='arial' size='1' color='000000'><b>.</b></td>
<td width='30' bgcolor='000000' align='center'><font face='arial' size='1' color='ffffff'><b>TEAM</b></td>
<td width='20' bgcolor='000000' align='center'><font face='arial' size='1' color='ffffff'><b>AGE</b></td>
<td width='20' bgcolor='000000' align='center'><font face='arial' size='1' color='ffffff'><b>GP</b></td>
<td width='20' bgcolor='000000' align='center'><font face='arial' size='1' color='ffffff'><b>PTS</b></td>
<td width='30' bgcolor='000000' align='center'><font face='arial' size='1' color='ffffff'><b>PPG</b></td>
</tr>";
// keeps getting the next row until there are no more to get

$n=1;
while($row = mysql_fetch_assoc( $result )) {

	// Print out the contents of each row into a table
	
	
	echo "<tr><td width='20' bgcolor='ffffff' align='center'><font face='arial' size='2' color='000000'>"; 
 	
 	echo "".$n++;
	echo "</td><td width='15' bgcolor='ffffff' align='center'><font face='arial' size='2' color='000000'>";
	echo $row['Pos'];
	echo "</td><td width='170' bgcolor='ffffff' align='left'><font face='arial' size='2' color='000000'>"; 
	echo $row['Last'];
	echo ", ";
	echo $row['First'];
	echo "</td><td width='10' bgcolor='ffffff' align='center'><font face='arial' size='1' color='000000'>";  

 	echo $row['CFHL'];

	echo "</td><td width='30' bgcolor='ffffff' align='center'><font face='arial' size='2' color='000000'>";  
	echo $row['Team'];
	echo "</td><td width='20' bgcolor='ffffff' align='center'><font face='arial' size='2' color='000000'>";   
	echo calculateAge($row['BDay']);
	echo "</td><td width='20' …
ceeandcee commented: Great help! thanks so much! +1
hielo 65 Veteran Poster

So with the first query you should see:
D John Smith A B
D Sally Jones A B
D Jack Brown A

hielo 65 Veteran Poster

In that case use the first query ( the one I left commented out ) and leave everything else the same.

hielo 65 Veteran Poster

What I am saying is that if your table looks as follows:

id...First...Last.....CFHL_A...CFHL_B..Pos
=========================================
1....John....Smith....FREE.....NULL....D
2....John....Smith....NULL.....FREE....D
3....Sally...Jones....FREE.....FREE....D
4....Jack....Brown....FREE.....NULL....D

You should see the records with id = 1, 2, and 4. (Ignore the dots above. I incorporated them just to force alignment of the columns)

hielo 65 Veteran Poster

Try the code below. Be sure to read comments in the code:

<?php
error_reporting (E_ERROR);

//this should give you all the records where either `CFHL_A`="FREE" or `CFHL_B`="FREE (including the case where BOTH = "FREE"
//$query="SELECT * FROM `playerdb` WHERE (UCASE(TRIM(`CFHL_A`)) = 'FREE' OR UCASE(TRIM(`CFHL_B`)) = 'FREE') AND `Pos`= 'D' ORDER BY `PTS0910` DESC, `GP0910` ASC, `TEAM` ASC";

//this should give you all the records where you only have CFHL_A=="FREE" or CFHL_B==FREE, but not both
$query="SELECT * FROM `playerdb` WHERE (UCASE(TRIM(`CFHL_A`)) = 'FREE' OR UCASE(TRIM(`CFHL_B`)) = 'FREE') AND (UCASE(TRIM(`CFHL_A`))!=UCASE(TRIM(`CFHL_B`))) AND `Pos`= 'D' ORDER BY `PTS0910` DESC, `GP0910` ASC, `TEAM` ASC";
$result = mysql_query($query) or die("<hr/>Problems executing:<br/>$query<br/>" . mysql_error() );  

echo '<table width="350" border="1" cellspacing="0" cellpadding="1" bgcolor="ffffff">
<tr> 
<td width="15" bgcolor="000000" align="center"><font face="arial" size="1" color="ffffff"><b>#</b></td>
<td width="20" bgcolor="000000" align="center"><font face="arial" size="1" color="ffffff"><b>POS</b></td>
<td width="170" bgcolor="000000" align="center"><font face="arial" size="1" color="ffffff"><b>PLAYER</b></td>
<td width="10" bgcolor="000000" align="center"><font face="arial" size="1" color="000000"><b>.</b></td>
<td width="30" bgcolor="000000" align="center"><font face="arial" size="1" color="ffffff"><b>TEAM</b></td>
<td width="20" bgcolor="000000" align="center"><font face="arial" size="1" color="ffffff"><b>AGE</b></td>
<td width="20" bgcolor="000000" align="center"><font face="arial" size="1" color="ffffff"><b>GP</b></td>
<td width="20" bgcolor="000000" align="center"><font face="arial" size="1" color="ffffff"><b>PTS</b></td>
<td width="30" bgcolor="000000" align="center"><font face="arial" size="1" color="ffffff"><b>PPG</b></td>
</tr>';
// keeps getting the next row until there are no more to get

$n=1;
while($row = mysql_fetch_assoc( $result )) {

	// Print out the contents of each row into a table
	
	
	echo '<tr><td width="20" bgcolor="ffffff" align="center"><font face="arial" size="2" color="000000">' . $n++ .'</td>'; 
	echo '<td width="15" bgcolor="ffffff" align="center"><font face="arial" size="2" color="000000">' . $row['Pos'] .'</td>';
	echo '<td width="170" bgcolor="ffffff" align="left"><font face="arial" size="2" color="000000">' . $row['Last'].', ' . $row['First'] . '</td>';
	echo "<td …
hielo 65 Veteran Poster

In javascript you cannot customize the buttons.
alert() displays: OK
confirm() and prompt() displays: OK , Cancel

Your option would be to use a javascript plugin:
http://trentrichardson.com/Impromptu/index.php

hielo 65 Veteran Poster

try:

<body>

<?php 

$date = time();

$day = date('d', $date); 
$month = date('m', $date); 
$year = date('Y', $date);

$days_in_month = cal_days_in_month(0, $month, $year);

$current_month = date('F');
//echo $current_month;


?>
<script type="text/javascript">

function isValidDate()
{
	var now = new Date();
	
	//advance one day
	now.setDate( now.getDate() + 1 );

	var Day=document.getElementById('daysOfMonth');
	var Month=document.getElementById('monthOfYear');
	var Year=document.getElementById('year');

	var selectedDate= new Date(Month + " " + Day + " " + Year);
	if(now < selectedDate)
	{
		alert("You may select only future dates");
	}
}
</script>

<form action="recive.php" method="post" name="CheckAvailability" target="_self" id="CheckAvailability">
    <table width="50%" border="0" cellpadding="6" align="center">
      <tr>
        <td><label for="daysOfMonth"></label>
          <div align="right">
            <select name="daysOfMonth" id="daysOfMonth" onchange="isValidDate()">
              <option><?php echo $day + 1; ?></option>
              <?php 
				for($i = 1; $i <= $days_in_month; $i++)
				{
					echo "<option value=".$i.">".$i."</option>";
				}
			?>
            </select>
          </div></td>
        <td><label for="monthOfYear"></label>
          <div align="center">
            <select name="monthOfYear" id="monthOfYear" onchange="isValidDate()">
              <option selected="selected"><?php echo $current_month; ?></option>
              <option value="January">January</option>
              <option value="February">February</option>
              <option value="March">March</option>
              <option value="April">April</option>
              <option value="May">May</option>
              <option value="June">June</option>
              <option value="July">July</option>
              <option value="August">August</option>
              <option value="September">September</option>
              <option value="October">October</option>
              <option value="November">November</option>
              <option value="December">December</option>
            </select>
          </div></td>
        <td><label for="year"></label>
          <select name="year" id="year" onchange="isValidDate()">
            <option selected="selected"><?php echo $year; ?></option>
            <option value="<?php echo $year + 1 ?>"><?php echo $year + 1 ?></option>
            <option value="<?php echo $year + 2 ?>"><?php echo $year + 2 ?></option>
          </select></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td><label for="nights">
          <div align="right">Number of nights:</div>
        </label></td>
        <td><select name="nights" id="nights">
          <option value="1" selected="selected">1</option>
          <option value="2">2</option>
          <option value="3">3</option>
          <option value="4">4</option>
          <option value="5">5</option>
          <option value="6">6</option>
          <option value="7">7</option>
          <option value="8">8</option>
          <option value="9">9</option>
          <option value="10">10</option>
          <option value="11">11</option>
          <option value="12">12</option>
          <option value="13">13</option>
          <option value="14">14</option>
          <option value="15">15</option>
          <option value="16">16</option>
          <option value="17">17</option>
          <option value="18">18</option>
          <option value="19">19</option>
          <option …
hielo 65 Veteran Poster

a more useful statement would be: $result = mysqli_query($dbc, $query) or die('<hr>Unable to execute query:<br> '. $query . '<br />' . mysqli_error($dbc) ); it would let you see what you actually tried to execute as well as a description of the error. If the problem persists, post the error reported.

hielo 65 Veteran Poster

since you are using " or die(...)", you cannot end line 8 with a semicolon. On line 8 of your ORIGINAL post you correctly left out the semicolon.

It may help you understand that statement if you put in a single line: $result = mysqli_query($dbc, $query) or die('Error querying database: ' . mysqli_error($dbc) );

hielo 65 Veteran Poster

you have back-to-back closing parentheses in the middle condition. Essentially you are closing the if prematurely. You need to move one of those parentheses to the end of the statement right BEFORE the echo.

hielo 65 Veteran Poster

Since the code that we use for validation is a highly standardized and system-wide class

I thought so, that's why I suggested that you STILL keep the current functionality that is accepting a number, but instead IMPROVE it (add more features to it).

Other than that, you have no choice but to iterate through the nodes as you are already doing in your original post. Since the sourceIndex is supported only by IE, then I suggest you modify your code so that it iterates ONLY when the browser is NOT IE:

function getIndex(element)
{
  if( typeof(element.sourceIndex)!="undefined" )
   return element.sourceIndex;

  for (var i=0; i<document.thisForm.elements.length; i++)
    if (element == document.thisForm.elements[i])
      return i;

  return -1;
}
hielo 65 Veteran Poster

instead of the keyword "and" try using "&&"

hielo 65 Veteran Poster

I need to find it because the JavaScript validation class has a function for validating a single form element, but it requires that the index number of the element in the form be passed in.

That is where I would concentrate my efforts instead. Since it is expecting a number, then I would modify it so that it can accept either a:
a) number - so it keeps working with whatever existing code you have
b) string - so you can pass an id to a specific element and using document.getElementById() you can obtain a reference to that element
c) an object - so that if you already have a node reference stored in some variable you just pass the reference directly.

hielo 65 Veteran Poster
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>hielo</title>
<style type="text/css">
.col{float:left;}
.lastCol{float:none}

#product_col1{width:30%;}
#product_col2{width:30%;}
#product_col3{width:30%;}
</style>

	</head>
	<body>
		<div id="product_col1" class="col">
     	<!--Contents of column 1-->a
		</div>

		<div id="product_col2" class="col">
     	<!--Contents of column 2-->b
		</div>

		<div id="product_col3" class="col lastCol">
     	<!--Contents of column 3-->c
		</div>
	</body>
</html>
hielo 65 Veteran Poster

do I need to replace total with
this?

On your original post, you posted one Javascript code and two php code block. On your SECOND php code block replace line 2 with what I posted earlier. That line of code is basically removing anything that is neither a number nor a period.

Also, feedback such as "it still doesn't work" is not helpful. Have you verified that it is even attempting to execute the query?

Does it execute the die() statement? If so, try changing the die() statement to: ... or die('Error querying database: ' . mysqli_error($dbc) ); so you can get a description of the error.

hielo 65 Veteran Poster

line 5 of the javascript block is NOT the same as what you actually have on your live page. This is what you actually have: document.getElementById("amt1").value = "$" + total.toFixed(2); This means that on your php page, your $total variable should have a STRING that begins with a dollar symbol. If your DB field (price) is expecting a decimal, then get rid of the leading dollar sign symbol: $total = preg_replace('#[^0-9\.]#','',$_POST['amt1']);

hielo 65 Veteran Poster

...stripslashes($_POST); did you even bother to read the manual?
a. stripslashes expects a string NOT an array. $_POST is an array
b. it does NOT expect a reference. In other words, I had the following string in a variable $name="O\'malley"; then simply calling stripslashes($name); would not change the value of $name. You have to "receive" the value returned by stripslashes() and reassign it to $name: $name=stripslashes($name); On another note, what you are trying to do is already given at:
http://www.php.net/manual/en/function.get-magic-quotes-gpc.php#82524

hielo 65 Veteran Poster

But I don't have a fixed value, instate of that I have a variable, and I would like to pass that as a value.

Of course you don't. I did not post PHP. I posted a sample html code/result of what YOUR PHP code should generate. In other words, after your page loads up, that is what you should see if you look at your browser's source code. I was expecting you to realize that:
a. each row of

<tr>...</tr>is generated from within a while construct - that is when you are iterating over the records of your db query result

b. Instead of
... value="3"... you would actually need to put the variable you are using for extracting the relevant value from your db query.

...
$result=mysql_query("SELECT id, email FROM Person") or die( mysql_error() );
if( mysql_num_rows($result) ==0 )
{
  echo 'No Records found';
}
else
{
 echo '<table>';
  while( $row = mysql_fetch_assoc($result))
  {
    echo sprintf('<tr><td>%s</td><td><form method="post" action="yourEditPage.php"><input type="hidden" name="pid" value="%s"/><input type="submit" name="editRow" value="Edit"/></form></td></tr>', $row['email'], $row['id']);
  }
 echo '</table>';
}
hielo 65 Veteran Poster

Now I would like to show the details of a particular record, by clicking on a row, and the details will be shown in a new page

Assuming that each record has a unique id, all you need to do is:
for every row add a table cell that includes a <form> . It should include a hidden field with the product id for the row in question, it should "point" to the page where you will get the product details, and it should have its own Edit button.

Ultimately, your table should be similar to the following (where pid is the product id for the row in question):

<tr><td>row 1 cell 1</td><td>row 1 cell 2</td><td>...</td><td><form method="post" action="yourEditPage.php"><input type="hidden" name="pid" value="3"/><input type="submit" name="editRow" value="Edit"/></form></td></tr>
<tr><td>row 2 cell 1</td><td>row 2 cell 2</td><td>...</td><td><form method="post" action="yourEditPage.php"><input type="hidden" name="pid" value="31"/><input type="submit" name="editRow" value="Edit"/></form></td></tr>
hielo 65 Veteran Poster

document is an object that exists (is defined) when you are running your javascript from a BROWSER window.

I opened the JavaScript with 'Microsoft Windows Based Script Host'

There you have it - you are NOT using a browser. instead of document.write try Wscript.Echo

hielo 65 Veteran Poster

To answer your question, first obtain a reference to your table. If you have your table an id: <table id='MyTable'>...</table> then use var t = document.getElementById('MyTable') to obtain a reference to the table. Since 't' now holds a reference to the table, then assuming you are interested in the x+1th CELL (where X is 0) of row 0 then alert(t.rows[0].cells[1].innerHTML) should show you the html in that cell.

On another note, based on your description, it sounds like you want/need an inline editor. I suggest you look at either of these:
http://www.appelsiini.net/projects/jeditable (the demo is at http://www.appelsiini.net/projects/jeditable/default.html)

http://code.google.com/p/jquery-in-place-editor/ (the demo is at http://jquery-in-place-editor.googlecode.com/svn/trunk/demo/index.html)

hielo 65 Veteran Poster

Then copy all the existing files from an existing folder (FOLDER B) into FOLDER A

Refer to the "copy" function in PHP. Particularly, refer to the second user comment on its manual page:
http://us3.php.net/manual/en/function.copy.php#91256

hielo 65 Veteran Poster

You are welcome! Be sure to mark the question as solved.

Regards,
Hielo

hielo 65 Veteran Poster

Assuming your image is located at http://www.yoursite.com/Images/buyNow.gif, then try:

echo sprintf( '<a href="%s"><img src="%s"/></a>', $row['ProductUrl'], '/Images/buyNow.gif' );
	echo "</td></tr>";
hielo 65 Veteran Poster

Assuming the name of the table is Office AND that the name of the column is stationary, try: SELECT * FROM Office WHERE stationary LIKE '%pen%'

hielo 65 Veteran Poster

On line 13 of array2: $exist[] = $row; $row is an array that has TWO elements. So each time you add an element to $exist, that element does NOT have "110", "114" OR "115". It has an array, and each of those arrays in turn has TWO elements; one with index zero and one with key "contact_type". All you need to do is change: $exist[] = $row; to: $exist[] = $row[0];

hielo 65 Veteran Poster

try:

<?php
 mysql_connect("localhost", "admin", "pwd") or die(mysql_error()); 
 mysql_select_db("app1") or die(mysql_error()); 
 $firstname=mysql_real_escape_string($_POST['fname']); 
 $email=mysql_real_escape_string($_POST['email']); 
 $lastname=mysql_real_escape_string($_POST['lname']); 
 $address=mysql_real_escape_string($_POST['address1']); 
 $addressii=mysql_real_escape_string($_POST['address2']); 
 $state=mysql_real_escape_string($_POST['state']); 
 $zip=mysql_real_escape_string($_POST['zip']); 
 $phone=mysql_real_escape_string($_POST['phone1']); 
 $phoneii=mysql_real_escape_string($_POST['phone2']); 
 $advertising=mysql_real_escape_string($_POST['advertising']); 
 $otherjobtype=mysql_real_escape_string($_POST['otherjobtype']); 
 $jobtype=mysql_real_escape_string($_POST['jobtype']); 
 $objective=mysql_real_escape_string($_POST['objective']); 
 $resume=mysql_real_escape_string($_POST['resume']); 
 $weekendavail=mysql_real_escape_string($_POST['weekend_shift']); 
 $nightavail=mysql_real_escape_string($_POST['night_shift']); 
 $pt_ft=mysql_real_escape_string($_POST['shift_preference']); 
 mysql_query("INSERT INTO `data` VALUES ('$firstname', '$lastname', '$email', '$address', '$addressii', '$state', '$zip', '$phone', '$phoneii', '$advertising', '$jobtype', '$otherjobtype', '$nightavail', '$weekendavail', '$pt_ft', '$objective', '$resume')"); 
 print "Thank you for your resume. Your information has been successfully added to the database and will be reviewed by a hiring representative. Please continue to explore our site for more opportunities."; 
 ?>
hielo 65 Veteran Poster

For some reason, the error message doesn't have the full text (ending height with just heig)?

On the field in question, look at the size of the field in your db. In other words, look at the maximum number of fields it can accept. Now look at the text you are trying to insert for that field. Are you exceeding the limit? If so, you will need to increase the size of your field.

hielo 65 Veteran Poster

try:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>hielo</title>
	<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
	<script type="text/javascript">
	$(function(){
		$('input[name^="qty"]').each(function(){
			update(this);
		});
	});

function update(el)
{
	var tr = el.parentNode;
	while (tr.nodeName.toLowerCase() != 'tr'){
		tr = tr.parentNode;
	}


	var qty= tr.cells[3].getElementsByTagName('input')[0].value;
	var price = tr.cells[2].getElementsByTagName('input')[0].value;

	var total = Math.round(qty*price*100);


	tr.cells[5].innerHTML = cToD(total);


	var rows = tr.parentNode.rows;
	var i = rows.length;
	var gTotal = 0;
	while (i--){
		gTotal += Math.round(rows[i].cells[5].innerHTML * 100);
	}
	document.getElementById('grandTotal').innerHTML = "<div class=\"field\"><input type=\"hidden\" size=\"3\" class=\"textbox\" id=\"total\" name=\"total\" value=\""+ cToD(gTotal) +"\"/></div>"+ cToD(gTotal) +"";
}


function cToD(c)
{
	if (c<10) return '0.0' + c;
	if (c<100) return '0.' + c;
	c += '';
	return (c.substring(0,c.length-2)) + '.'+(c.substring(c.length-2));
}
	</script>
	</head>
	<body>
	<!-- Your table stuff goes here -->
	</body>
</html>
pietpiraat commented: Coding is spot on! +1
hielo 65 Veteran Poster

well for example if i type in "po" it should give me all possible definitions such as police and pocket but instead it gives me definition for police and just word pocket where it shouldn't even return "word" it should only return definition.

The problem is that when you type "po", your $def ends up with the following:

$def="police-protects people from crimes and danger<br>pocket-a small holding space atached to the close"

so, when you split at the hyphens, $definition SHOULD get the string

"protects people from crimes and danger<br>pocket" because it is BETWEEN hyphens. What you needed to do was NOT to store those hyphens to begin with:

...
if ($def=="")
{//value of array is placed in the def variable
$def=preg_replace('#^([^-]+).#','',$a[$i]);
}
else
{//else it is placed below def variable
$def=$def."<br>" . preg_replace('#^([^-]+).#','',$a[$i]);
}
...
hielo 65 Veteran Poster
<%
On Error Resume Next
Dim sConnection, objConn , objRS

sConnection = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=Your_Mysql_DB; UID=mysql_username;PASSWORD=mysql_password; OPTION=3"

Set objConn = Server.CreateObject("ADODB.Connection")

objConn.Open(sConnection) 
If Err.Number <> 0 Then
    Response.Redirect "maintenance.asp"
    Response.End
Else
    'continue coding here
    '...

    objConn.close
    Set objConn=Nothing
End If

%>
hielo 65 Veteran Poster

On your original post you are infact missing a space to the left of the WHERE keyword. My suggestions would be to use "&" instead of "+" symbol to concatenate the strings and enclose the table/fieldnames in brackets.

On another note, with regards to:

UPDATE passwrd

Are you sure your TABLE is named passwrd? To clarify, if you had the following:
Table: Person
Fields: password, username

then it should be:

Dim ssql As String = "UPDATE [Person] SET [password] ='" & TextBox1.Text & "' WHERE [username]='" & TextBox2.Text & "'"
hielo 65 Veteran Poster

how to keep it from being a pop up?

For that, you should NOT be using window.open(). Instead, just assign the url to location.href:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<title>Rotate Marketing</title>

<!-- 
IMPORTANT: Notice that I am importing "cookies.js". Go to:
http://www.quirksmode.org/js/cookies.html

scroll down to the section titled "The Scripts" and grab those three functions.
save them to a file named cookies.js and import them into your page similarly to
the way I am doing below
 -->
<script src="cookies.js" type="text/javascript"></script>

<script type="text/javascript">

      <!--
 
      var Win;

      var page_index = 0;

      var page = new Array();
      page[ page.length ] = "http://www.homebiz.usaloe.com";
      page[ page.length ] = "http://www.makethatmoney.usaloe.com";
      page[ page.length ] = "";
      page[ page.length ] = "";
      page[ page.length ] = "";
      page[ page.length ] = "";
      page[ page.length ] = "";
      page[ page.length ] = "";

      var next_page = function(){

      	//page_index = (( page_index === 8 ) ? 0 : page_index );
		page_index=++page_index % page.length;
      	if ( typeof Win !== "undefined" ) {

      		/* Win.location.href = page[ page_index ]; */
		location.href=page[ page_index ];
		createCookie("lastPage",page_index,30);
      	}
		

      };

      

      window.onload = function() {
	 page_index=readCookie("lastPage");
	 if(!page_index)
	 {
	 	page_index=0;
	 }
	 else
	 {
	 	page_index=++page_index % page.length;
	 }
	 createCookie("lastPage",page_index,30);
      	/* Win = window.open( page[ page_index ], 'Win', 'resize=yes,toolbar=yes, status=yes,scrollbars=yes, screenX=0,screenY=0, width=1000, height=666' ); */
	location.href=page[ page_index ];

      timer = setInterval( "next_page()", 10000000 );

      };

      

      // -->

</script>
</head>
<body>
</body>
</html>
hielo 65 Veteran Poster
preg_match('/user=([-0-9]+)/',$str,$m);

That won't work as desired. It will allow entries such as:
90-345

I believe the poster intends that hyphen to be "OPTIONAL and only at the beginning of the numeric substring, in which case he needs:

preg_match('/user=([-]?\d+)/',$str,$m);

where [-]? indicates an optional hyphen, and \d+ indicates one or more digits

It must be stated that the WON can also be PUSH or LOSS.

in that case search for any of those possible three values:

$str = "<td>102</td><td>Over 196.5</td><td>500</td><td>WON</td><td>+500</td>";

preg_match('\b(WON|PUSH|LOSS)\b',$str,$m);
echo $m[1];//this will echo the actual match
hielo 65 Veteran Poster
$str = '<div class="right"><a id="ctl111_contestProfileLink" href="http://contests.covers.com/Sportscontests/profile.aspx?user=265839&amp;sportid=0">Picks History</a></div>';

preg_match('#user=(\d+)#',$str,$m);
echo "User is: " . $m[1];
hielo 65 Veteran Poster
$connection=mysql_connect("localhost","username","password") or die(mysql_error());

mysql_select_db("databasename") or die( mysql_error());

$result = mysql_query("Select field1,field2,... from Table") or die(mysql_error());

if( !mysql_num_rows($result) )
{
 echo "No records  found";
}
else
{
  $row=mysql_fetch_assoc($result);

  /* here $fieldNames is an array that contains the field names of the records returned by your query */
  $fieldNames = array_keys($row);
echo "<table border='1'> ";
echo "<tr><th>" . implode( "</th><th>", $fieldNames) . "</th></tr>";
do{
  echo "<tr><td>" . implode("</td><td>", array_values($row) ) . "</td></tr>";
 }
 while( $row=mysql_fetch_assoc($result) );
echo "</table>";
}