hielo 65 Veteran Poster

On the Web Developer Toolbar there is an icon labeled "Information". Click it and then select "View Javascript".

Click on "Collapse All" then scroll to the last link and expand it. You should see the javascript code that is giving you problems - copy it.

Now open a new tab in Firefox and go to http://jsbeautifier.org/ and paste the code there. Check all the checkboxes and then submit.

At this point it should be clear to you that your php file is creating nested try{}catch() statements but ultimately is NOT closing them.

So, to fix the error you need to examine your php code. It seems that it is dynamically generating javascript from within some loop.

It should NOT be doing that from within a loop since:
a. it keeps sending code to validate the same fields over and over.
b. it is not sending the closing brace for your try (this is what the browser is complaining about).

hielo 65 Veteran Poster

If there is already Data in the field should I be using UPDATE instead of INSERT?

UPDATE

How do I specify which record/primary key is to update?

currently you are generating:

...
echo "<input type='text' size='2' name='PTS1011_wk1'>";
...
echo "<input type='text' size='2' name='GP1011_wk1'>";
...

for each player. I am assuming that playerID IS the unique key for every record. If that is the case then what you need to do is put that as an array index in the name of the field:

...
echo "<input type='text' size='2' name='PTS1011_wk1[" . $row['playerID'] . "]'>";
...
echo "<input type='text' size='2' name='GP1011_wk1[" . $row['playerID'] . "]'>";
...

which should generate something like:

...
<input type='text' size='2' name='PTS1011_wk1[7]'>
<input type='text' size='2'  name='GP1011_wk1[7]'>
<input type='text' size='2' name='PTS1011_wk2[7]'>
<input type='text' size='2'  name='GP1011_wk2[7]'>
<input type='text' size='2' name='PTS1011_wk3[7]'>
<input type='text' size='2'  name='GP1011_wk3[7]'>
<input type='text' size='2' name='PTS1011_wk4[7]'>
<input type='text' size='2'  name='GP1011_wk4[7]'>
...
<input type='text' size='2' name='PTS1011_wk1[21]'>
<input type='text' size='2'  name='GP1011_wk1[21]'>
<input type='text' size='2' name='PTS1011_wk2[21]'>
<input type='text' size='2'  name='GP1011_wk2[21]'>
<input type='text' size='2' name='PTS1011_wk3[21]'>
<input type='text' size='2'  name='GP1011_wk3[21]'>
<input type='text' size='2' name='PTS1011_wk4[21]'>
<input type='text' size='2'  name='GP1011_wk4[21]'>
...

where the 7 and 21 represent the unique id for each player per row. PHP will see an array SIMILAR to:

$_POST['PTS1011_wk1'] => array(7=>"a")
$_POST['PTS1011_wk2'] => array(7=>"b")
$_POST['PTS1011_wk3'] => array(7=>"c")
$_POST['PTS1011_wk4'] => array(7=>"d")

$_POST['PTS1011_wk1'] => array(21=>"e")
$_POST['PTS1011_wk2'] => array(21=>"f")
$_POST['PTS1011_wk3'] => array(21=>"g")
$_POST['PTS1011_wk4'] => array(21=>"h")

the same goes for the GP1011_wk# group. So if you want to get the value "a", you would need to get it from $_POST[7].

So, your "challenge" …

hielo 65 Veteran Poster

xpath('//table/tr[td[@class="tickerSm"]') can get:
...reportdate

that should be getting your BOTH 'reportdate' and 'Cash & Equivalents' since it too has class="tickerSm"

From what you posted:
xpath('//table/tr[1]) should give you 'reportdate' row
xpath('//table/tr[2]) should give you 'Cash & Equivalents' row
xpath('//table/tr[3]) should give you 'Receivables' row

hielo 65 Veteran Poster

You are currently doing:

if( conditions )
{
   ...
   required: true
   ...
}

If you look closer at your working example, your required is NOT true|false, it is a reference to a function that returns true or false. So, instead of what you have (and is not working) put your conditions in an anonymous function and assign that anonymous function to required:

$(".yearly_ns").each(function() {
		$(this).rules(	"add"
						,{	required: function(){
									return (''+$("input[name='package']").val() != '99' && $("input[name='nameserver_setup']:checked").val() == "SET") ;
									} 
						}
					); 
	});
hielo 65 Veteran Poster

On the lower right-hand side of Firefox you will see a "bug". Click on it and reload your page.

On another note, I suggest you ALSO install "Web Developer" AddOn:

https://addons.mozilla.org/en-US/firefox/search/?q=HTML+Developer&cat=all&lver=any&pid=1&sort=&pp=20&lup=&advanced=

Once installed, restart firefox. You will see a new bar across the top of the browser. On THAT bar, the last icon on the far-right of the browser window will be red if there are errors.

hielo 65 Veteran Poster

try:

header("Cache-Control: no-cache \n");
header("Pragma: no-cache \n");
header("Expires: 0 \n");
//header("Refresh:3; $_SERVER[PHP_SELF]?sid=$sessionid");

//not sure if the variable with the id that you are using is $sid OR $sessionid, but be sure to use the correct one below
echo sprintf('<script>setTimeout( function(){location.href="%s?sid=%s&cb=%s"} ,3000);</script>',$_SERVER['PHP_SELF'], $sessionid, time());
echo $percent_done.'% completed';
hielo 65 Veteran Poster

You posted this in MySQL. The syntax I gave you is for MySQL, NOT access.
Try:

strQuery = "
	SELECT SUM([Production]) as total
	FROM [MONTHLYPROD] 
	WHERE( 
			CDATE([DATE])
				BETWEEN 
						#01/12/1999# 
					AND 
						#01/02/2000# 
		) 
		AND ([UNIQUEID] LIKE '"+engineName+"')"
hielo 65 Veteran Poster

You can send it via Private Message here.

hielo 65 Veteran Poster

Make sure that your page STARTS with session_start(); THEN (later on) you can assign to/retrieve values from $_SESSION.

In your case, instead of $sum use $_SESSION - ex:

$_SESSION['sum']=mysql_fetch_assoc($totals);
...
echo $_SESSION['sum']['GP1011_wk1'];
...
echo $_SESSION['sum']['PTS1011_wk1'];
...

Lastly, on the OTHER php page(s) where you want to use those values, you MUST also call session_start() at the beginning of the file first, THEN you can echo the values.

ceeandcee commented: Thank you! +1
hielo 65 Veteran Poster

... how I did it

That looks like a copy and paste of Hielo's first post!! :)

hielo 65 Veteran Poster

Basically you need to use a particular program on your server that in turn executes a certain program at a specific date/time OR at periodic intervals.

On a windows server, you have the "Task Scheduler". On a Unix/Linux box you would use the crontab or at command. Again, if you are with a webhost, find out from them what they have available for you.

http://www.linuxjournal.com/article/4087
http://www.ibm.com/developerworks/linux/library/l-job-scheduling.html
http://kevin.vanzonneveld.net/techblog/article/schedule_tasks_on_linux_using_crontab/

hielo 65 Veteran Poster

sorry, it should be an "arrow" not an "equal": foreach($row as $k => $v)

hielo 65 Veteran Poster

That ":hover" will likely not be recognized by IE 6. There are a lot of users still using that browser. Try the following instead:

<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

<script>
//cache the images first 
var imgs=[];
imgs[imgs.length]=new Image();
imgs[imgs.length-1].src='images/numr.png';

imgs[imgs.length]=new Image();
imgs[imgs.length-1].src='images/num1.png';

imgs[imgs.length]=new Image();
imgs[imgs.length-1].src='images/num2.png';

imgs[imgs.length]=new Image();
imgs[imgs.length-1].src='images/num3.png';

$(document).ready(function(){
 		$('.imageButton').hover( hoverIn, hoverOut);
});

function hoverIn(){ 
	$(this).attr('prevImage',$(this).attr('src')).attr('src','images/numr.png');
}
function hoverOut(){ 
	$(this).attr('src', $(this).attr('prevImage') ).attr('prevImage','');
}
</script>
</head>
<body>
<input type="image" class="imageButton" src="images/num1.png" id="as">
<input type="image" class="imageButton" src="images/num2.png" id="ad">
<input type="image" class="imageButton" src="images/num3.png" id="af">
</body>
</html>
hielo 65 Veteran Poster

Generally, when a function/method call returns something, and you need that something later on, you need to "receive/assign" it to something else. Your $post->get_news($user_id); returns an array, but there is NOTHING "receiving" that array. Also, just because your method get_news() returns an array, it does NOT "overwrite" the $post variable. Thus, after the method call, the $post variable is still a 'News' object. So $post[$i] is not valid - again, because $post is NOT an array - it is still a News object. So try:

$post=new News;
$data = $post->get_news($user_id);

//to verify that you got the array you were expecting
print_r($data);

for($i=0; $i<5; $i++){
  foreach($data[$i] as $k=>$v){
      echo $v; //get error: "Cannot use object of type News as array in ..."
   }
}

On another note, the only similarity between your thread and the other was that both of you have the need to retrieve data from the db. You are way ahead of the game since you already have some php code in place that needs minor fixing. The other poster didn't seem to have anything in place yet.

Regards,
Hielo

hielo 65 Veteran Poster

assuming your fields are named `GP` and `PTS`:

<?php

$result = mysql_query("SELECT * FROM stats1011 where 1A = 'BULL' OR 1B = 'BULL' order by field(pos,'LW','C','RW','D','G'), Last ASC")
or die(mysql_error());  
   

?>


<?php
echo "<table width='150' border='1' cellspacing='0' cellpadding='1' bgcolor='ffffff'>";
echo "<tr> 
<tr bgcolor='000000'>
<td align='center'colspan='5'><img src='/images/bar_bull.jpg' width='150' height='19' border='0'></td>
</tr>

<tr>
<td colspan='3' align='left' width='100' bgcolor='000000'><font face='arial' size='1' color='ffffff'><b>Player</b></td>
<td align='center' bgcolor='000000'><font face='arial' size='1' color='ffffff'><b>GP</b></td>
<td align='center' bgcolor='000000'><font face='arial' size='1' color='ffffff'><b>PTS</b></td>

</tr>
";

// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
	// Print out the contents of each row into a table
	


	echo "<tr><td width='15' align='center' bgcolor='FFFF99'><font face='arial' size='1' color='000000'><b>";
	echo $row['Pos']; 
	echo "</b></td><td width='100' align='left' bgcolor='ffffff' align='center'><font face='arial' size='1' color='000000'>";
	echo $row['Last'];
	echo "</td><td width='15' align='center' bgcolor='ffffff' align='center'><font face='arial' size='1' color='000000'>";
	echo $row['Team'];
	echo "</td><td width='15' align='center' bgcolor='ffffff' align='center'><font face='arial' size='1' color='000000'>";
	echo $row['GP1011_wk1'];
	echo "</td><td width='15' align='center' bgcolor='ffffff' align='center'><font face='arial' size='1' color='000000'>";
	echo $row['PTS1011_wk1'];
	
} 
$totals=mysql_query("SELECT SUM(`GP`) as GP1011_wk1, SUM(`PTS`) as PTS1011_wk1 FROM `stats1011` where 1A = 'BULL' OR 1B = 'BULL' ") or die(mysql_error());
$sum=mysql_fetch_assoc($totals);
echo "<tr><td colspan='3' align='left' width='100' bgcolor='000000'><font face='arial' size='1' color='ffffff'><b>TOTALS</b></td>";
echo "<td align='center' width='100' bgcolor='000000'><font face='arial' size='1' color='ffffff'>";
echo $sum['GP1011_wk1'];
echo "</td><td align='center' width='100' bgcolor='000000'><font face='arial' size='1' color='ffffff'>";
echo $sum['PTS1011_wk1'];
echo "</td></table>";

?>
hielo 65 Veteran Poster

When I go to the link you posted and then look at the browser's source code I am seeing:

<form action="verify.php"...>
   ...
  <form action="javascript:alert('enable');"> 
  <input type="submit" id="Submitter" value="Continue to next step" disabled="disabled" /> 
  </form> 
...
</form>

That is NOT valid html and some browsers "choke" on it. You are NOT allowed to nest form tags:

WRONG:

<form>
  <form>...</form>
</form>

CORRECT:

<form>...</form>
<form>...</form>

So on your code get rid of the inner <form> and leave only the submit button <input type="submit" id="Submitter" value="Continue to next step" disabled="disabled" />

hielo 65 Veteran Poster

currently in user_list.php (line 95) you have SELECT * FROM users LIMIT $startrow, 10 . If in fact your users table has a field named `id`, then focus your efforts in profile.php since user_list.php seems fine. In profile.php you should be retrieving the user id by issuing $_GET['id'] NOT $_POST['id']

hielo 65 Veteran Poster

Then just get rid of the <html>...</html> . On the page you are submitting FROM you need your submit button to have name="Submitter" for the php code above to work.

hielo 65 Veteran Poster

newprimitive, please stop hijacking someone else's thread and open your own. I'll gladly help

hielo 65 Veteran Poster

... where id = '$_SESSION[user_id]'") are you updating $_SESSION[user_id] to that of the one you selected/click on in profile.php?

hielo 65 Veteran Poster
<?php
if( isset($_POST['Submitter']) && !empty($_POST['Submitter']) )
{
 $to = "reciever@example.com";
 $subject = "Test Subject";
 $body = "Test Body";
 $headers = "From: sender@example.com\r\n" .
     "X-Mailer: php";
 if (mail($to, $subject, $body, $headers)) {
   echo("<p>Message sent!</p>");
  } else {
   echo("<p>Message delivery failed...</p>");
  }
  exit();
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>
<body>
<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
<input type="checkbox" name="agree" value="yes" onclick="Submitter.disabled = !this.checked" />Do you Agree?
<input type="submit" name="Submitter" id="Submitter" value="Submit" disabled="disabled"/>
</form></body>
</html>
keavon commented: It was very fast and worked pretty well. He helped me later on in an other post too. +1
hielo 65 Veteran Poster

The amount is credited and the balance is updated very well. But interest should be added daily.

OK, then if the queries are working fine, then your problem is NOT really about "adding interest rates to your account tables", but rather, "how to auto-execute queries on a daily basis". If that is the case, you need to set up a "cron job". If you are with a web host, ask them what utility they have available to schedule a "cron job".

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

<html>
<head>
<title>Untitled</title>
</head>
<body>
<form>
<input type="checkbox" name="agree" value="yes" onclick="Submitter.disabled = !this.checked" />Do you Agree?
<input type="submit" name="Submitter" id="Submitter" value="Submit" disabled="disabled"/>
</form></body>
</html>
hielo 65 Veteran Poster

save this as hielo.php and try it:

<?php
define('TABLE_NAME','accounts');

$dbConnection= mysql_connect("localhost","username","password") or die( mysql_error() );

$fields=array(	'tran_ID'=>array('label'=>'Transction ID','format'=>"%d")
				,'account_type'=>array('label'=>'Account Type','format'=>"'%s'")
				,'account_number'=>array('label'=>'Account Number','format'=>"'%s'")
				,'transaction_type'=>array('label'=>'Transaction Type','format'=>"'%s'")
				,'amount'=>array('label'=>'Amount','format'=>"'%s'")
				,'Date'=>array('label'=>'Date','format'=>"'%s'")
				);

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

if( isset($_POST['update']) && !empty($_POST['update']) )
{
	updateRecord($_POST['tran_ID'], $dbConnection);
}
elseif( isset($_POST['edit']) && !empty($_POST['edit']) )
{
	showSelectedRecord($_POST['tran_ID'], $dbConnection);
}
else
{
	showAllRecords($dbConnection);
}
mysql_close();
exit();

function showAllRecords($dbConnection)
{
  $sql = sprintf("SELECT `tran_ID`,`account_type`,`account_number`,`transaction_type`,`amount`,`Date` FROM `%s`",TABLE_NAME);
  $result=mysql_query($sql) or die( mysql_error() );
  $total=mysql_num_rows($result);

  if( 0==$total )
  {
    echo "<p>No records found.</p>";
  }
  else
  {
    $row=mysql_fetch_assoc($result);
	$id=$row['tran_ID'];

    echo '<table>';
    echo '<thead><tr><th>' . implode( '</th><th>', $keys) . '</th></tr></thead><tbody>';
	unset($row['tran_ID']);
    do{
      echo '<tr><td>' . implode('</td><td>',$row) . '</td><td><form method="post" action="' . $_SERVER['PHP_SELF'] . '"><input type="hidden" name="tran_ID" value="' . $id . '"/><input type="submit" name="edit" value="Edit"/></form></tr>';
    }while( $row=mysql_fetch_assoc($result) );
    echo '</tbody></table>';
  }
return $total;
}

function showSelectedRecord( $id,$dbConnection )
{
  global $fields;
  
  $sql = sprintf("SELECT `account_type`,`account_number`,`transaction_type`,`amount`,`Date` FROM `%s` WHERE `tran_ID`=%d", TABLE_NAME, mysql_real_escape_string($id));
  $result=mysql_query($sql) or die( mysql_error() );
  $total=mysql_num_rows($result);
  if(1==$total)
  {
  	$row=mysql_fetch_assoc();
	echo sprintf('<form method="%s" action="%s">','post',$_SERVER['PHP_SELF']);
	foreach($row as $k=$v){
		echo sprintf('<div><label for="%s">%s</label>: <input type="text" name="%s" value="%s"/></div>', $k, $fields[$k]['label'], $k, htmlentities($v, ENT_QUOTES) );
	}
	echo '<div><input type="hidden" name="tran_ID" value="'.$id.'"/><input type="submit" name="update" value="Update" /></div>';
	echo '</form>';
  }
  elseif(0==$total)
  {
    echo '<p>Unable to find a record with tran_ID='.$id.'</p>';
  }
  else
  {
    echo '<p>Unable to find a UNIQUE record with tran_ID='.$id.'. Instead, a total of '.$total.' records were found!</p>';
  }
}

function updateRecord($id, $dbConnection)
{
  global $fields;
  $sql="";
  unset($fields[$id]);
  foreach($fields as $k=>$v)
  {
    $f=",`%s`=".$fields[$k]['format'];
  	$sql.=sprintf($f, $k, mysql_real_escape_string($_POST[$k]) );
  }
  $sql=sprintf("UPDATE `%s` SET %s WHERE `tran_ID`=%d", TABLE_NAME, substr($sql,1), mysql_real_escape_string($id) );
  mysql_query($sql) or die(mysql_error());
  echo …
hielo 65 Veteran Poster

mysql_real_escape_string() is to avoid sql injection. It's for security purposes. IF you don't know what sql injection is, search it. Tons of results out there.

The sprintf() is not required, but I find it easier to construct strings. Look it up on the php manual and be sure to look at the examples section.

As for that last line, it just puts the name of the fields at the top of the table. Look up the implode() and array_keys() in the manual as well. All of these are well documented that it is pointless for me to try to reword what is already properly and clearly described in the manual.

hielo 65 Veteran Poster

This line of your coding should be changed know.

There is NOTHING wrong with that line.

On line 2, are you sure you included the "!" symbol to the left of empty()?

hielo 65 Veteran Poster

Save this as hielo.php and try it:

<?php
if( isset($_POST['nic']) && !empty($_POST['nic']) )
{
  mysql_connect("localhost","username","password") or die( mysql_error() );

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

  $sql = sprintf("SELECT `customer_id`, `nic`, `full_name`, `name_with_initials`, `address`, `contact_number`, `gender` FROM `customer` WHERE `nic`='%s'", mysql_real_escape_string($_POST['nic']) );

  $result=mysql_query($sql) or die( mysql_error() );

  if( 0==mysql_num_rows($result) )
  {
    echo "<p>No records found.</p>";
  }
  else
  {
    $row=mysql_fetch_assoc($result);  

    echo '<table>';
    echo '<thead><tr><th>' . implode( '</th><th>', array_keys($row) ) . '</th></tr></thead><tbody>';
    do{
      echo '<tr><td>' . implode('</td><td>',$row) . '</td></tr>';
    }while( $row=mysql_fetch_assoc($result) );

    echo '</tbody></table>';
  }
exit();
}
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
<div>Enter NIC number: <input type="text" name="nic" value="" /> <input type="submit" value="Submit"/></div>
</form>
hielo 65 Veteran Poster

Use the DATE_ADD() function to determine the seventh birthday:
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-add

Then combine it with the DATE_FORMAT() to format the output:

SELECT DATE_FORMAT(DATE_ADD(`user_birth_date`, INTERVAL 7 YEARS), '%m/%d/%Y') as seventhBDay

hielo 65 Veteran Poster

Try:

strQuery = "
	SELECT SUM(`Production`) 
	FROM` MONTHLYPROD` 
	WHERE	(STR_TO_DATE(`DATE`,'%m/%d/%Y') 
				BETWEEN 
						STR_TO_DATE('01/12/1999','%m/%d/%Y') 
					AND 
						STR_TO_DATE('01,02,2000', '%m,%d,%Y') 
			) 
		AND (`UNIQUEID` LIKE '"+engineName+"')";
hielo 65 Veteran Poster

im using this code to make selection field. Here i want to get a Item ID when selecting Item. bt i cant change that Price as the "value=" of the Option. because i need value as a price for the bill counting

OK, so currently for every record you are sending something similar to: <option value="12">...</option> Why not just send something like: <option value="xxx___12">...</option> Where "xxx" is your ItemId and "___" is just a "delimiter".

echo sprintf('<option value="%s___%s">%s</option>' . PHP_EOL, $row['ItemId'], $row['Price'], $row['ItemName']);

Thus, all you would need to do when you get that value, is split the value at the delimiter:

list( $itemId, $itemValue) = explode("___",$_POST['item8']);
echo 'Item: '.$itemId . '=' . $itemValue;
Kadafiz commented: really good +1
hielo 65 Veteran Poster

In your php.ini file look for "display_errors" and set it to Off. If you don't have access to the php.ini file, then at the START of your php file put:
ini_set("display_errors","Off");

hielo 65 Veteran Poster

If you don't have Firefox, install firefox.
Install the Firebug Addon.

After restarting firefox, load your page again. It should tell you a more helpful description of the problem. If the problem persists, post a link to your page.

hielo 65 Veteran Poster
I am using jQuery $.post to send Ajax requests. It works fine for non redirecting PHP scripts,

There's your problem. From the jQuery manual

jQuery.post( url, [ data ], [ success(data, textStatus, XMLHttpRequest) ], [ dataType ] )

the third argument is a reference to a function which is to be called whenever the request completes "successfully". But this "successful" request equates to a http response status=200. A redirect gives you a 301 request, NOT 200. So you cannot use $.post(). Instead use $.ajax(). Currently you probably have something SIMILAR to:

$.post('page.php',params, function(){
  //here is whatever you are doing on a successful request
  ...
});

change that to:

$.post('page.php',params, function(){
  //here is whatever you are doing on a successful request
  ...
});
$.ajax({
  type: 'POST'
  ,url: 'page.php'
  ,data: params
  ,success: function(){
    //here is whatever you are doing on a successful request
    ...
  }
  ,complete: function(httpObj, textStatus){
     switch( 1*httpObj.status )
     {
          case 301: //here you do whatever you need to do
                    //when your php does a redirection
                    alert("Redirection");
                    break;

          case 404: //here you handle the calls to dead pages
                    alert("Page Not Found");
                    break;
     }
  }
});
hielo 65 Veteran Poster

why would it?

You were not including the "url=" part. INSTEAD of the header() function, you can try:

echo '<script>location.href="'.$_SERVER['PHP_SELF'].'?cb=(new Date()).valueOf()";</script>';
exit();
hielo 65 Veteran Poster

try the following, if it still doesn't work, then the problem is the imagejpeg() function in which case you'll have not choice but to remove it.

imagejpeg($result, "thumb/" . stripslashes($title) . ".jpg", 100) or die("Can't save image");
hielo 65 Veteran Poster

If you do not want any redirection to take place when viewing the page via ajax, what you can do is to send a parameter that identifies the request as being ajax. In your php code, immediately before the redirect code see if you detect that parameter and if you do, then do NOT redirect.

To clarify, if the url you are sending the requests to is http://site.com/file.php, then simply make the requests to http://site.com/file.php?rt=ajax (rt=requestType).

Then, assuming you currently are redirecting using header("Location: ..."); , then it would now be:

if( !isset($_GET['rt'])  || $_GET['rt']!='ajax' )
{
  header("Location: ...");
  exit();
}

That way if the page is NOT accessed via ajax, it would still redirect.

hielo 65 Veteran Poster

Well, if the imagejpeg() function is chocking on the apostrophe, all you need to do is remove the offending character from $title:

imagejpeg($result, "thumb/" . str_replace("'","",$title) . ".jpg", 100) or die("Cant save image");
hielo 65 Veteran Poster

Here's a really good one that explains it step-by-step:
http://www.tonymarston.net/php-mysql/pagination.html

hielo 65 Veteran Poster

That's called "paging". Tons of search results for "PHP, MySQL, Paging"

http://www.tutorialspoint.com/php/mysql_paging_php.htm
http://www.web-max.ca/PHP/misc_1.php

hielo 65 Veteran Poster

you have to use the getElementById() AFTER the page has finished loading. Try:

function car(seats,engine,theradio) {
this.seats=seats;
this.engine=engine;
this.theradio=theradio;
}

var work_car=new car ("cloth","V8","Tape Deck");
var b1=null;

window.onload=function(){
	b1 = document.getElementById("work_car");
	b1.onclick=function(){
		alert("I want a car with " + work_car.seats + " yeah");
		
		//if you put <div id="message"></div> in your document,
		//instead of the alert you  can use
		//document.getElementById("message").innerHTML="I want a car with " + work_car.seats + " yeah"
	};
};
hielo 65 Veteran Poster
<body>
<div id="content">
<div class="contentbox">
<h1>Search For A PO</h1>
<form method="post" action="">
<table class="search">
<tr><td> Search: <select name="type">
<option value="po_num"<?php if(isset($_REQUEST['type']) && $_REQUEST['type']=='po_num'){print "selected";}?>>PO Number</option>
<option value="date" <?php if(isset($_REQUEST['type']) && $_REQUEST['type']=='date'){print "selected";}?>>Date</option>
<option value="vin_num"<?php if(isset($_REQUEST['type']) && $_REQUEST['type']=='vin_num'){print "selected";}?>>VIN Number</option>
</select></td>
<td>for: <input type="text" name="term" /><br /></td></tr>
<tr><td> <input type="submit" name="submit" value="Search" /></td>
<td class="date">* date format: yyyymmdd</td></tr>
</table>
</form>
</div>
<hr width='100%'></hr>
<?php
$term = $_POST['term'];
if ($term == '')
{
echo '<h2>Please enter a value</h2>';
exit;
}
$search_result = '';
if($_SERVER['REQUEST_METHOD'] === "POST") {
mysql_connect ("localhost", "user","pass") or die (mysql_error());
mysql_select_db ("podat");

$type = mysql_real_escape_string($_POST['type']);
$term = trim(mysql_real_escape_string($_POST['term']));
$sql = mysql_query("select * from parts_ord where $type like '%$term%' AND date<>'0'");
}
$total = mysql_num_rows ($sql);
if (!$total ){
echo '<h2>No Results Found</h2>';
exit;
}

echo '<h2>Search Results: ' .$total .' matches found.</h2>';
while ($row = mysql_fetch_assoc($sql)){
//var_dump($row);

echo "<br/><table class='results'>
<tr><td class='short'><B>PO Number:</B> </td><td>".$row['po_num']."</td></tr>
<tr><td><B>Vendor:</B> </td><td>".$row['vendor']."</td></tr>
<tr><td><B>Date:</B> </td><td>".$row['date']."</td></tr>
<tr><td><B>VIN Number:</B> </td><td>".$row['vin_num']."</td></tr>
<tr><td><B>Description:</B> </td><td>".$row['descr']."</td></tr>
<tr><td><B>Invoice Number:</B> </td><td>".$row['inv_num']."</td></tr>
<tr><td><B>Purchase Agent:</B> </td><td>".$row['agt']."</td></tr>
<tr><td colspan='2'><a href=\"edit.php/?id=".$row['po_num']."\">Edit</a></td></tr></table>";

}

?>
hielo 65 Veteran Poster

you need to capture the x-y coordinates of the mouse. Search for "mouse x y coordinates" in google.

hielo 65 Veteran Poster

Glad to help.

Regards,
Hielo

PS: Don't forget to mark the thread as solved.

hielo 65 Veteran Poster

Like before, I was about to suggest

switch ('' + `cLogin`)

to force the value into string context and leave the quotes around the numbers in the case statements, but what you did is the inverse of what I was about to suggest. Glad it's working now.

Regards,
Hielo

PS: Don't forget to mark the thread as solved.

hielo 65 Veteran Poster
hielo 65 Veteran Poster

It forces IE to make the ajax request EVERY TIME, since it adds the current timestamp, which is different everytime. From the browser's view, the url is different everytime, it does NOT use the cached page. That was your problem - it was reusing the cached page.

hielo 65 Veteran Poster

The only other change I can suggest is (based on my previous post), change: switch (cLogin) to switch (''+cLogin) to force cLogin into string context.

There are not syntax problems in the given javascript code, so if the problem persist, it must be related to SpeedScript. Are you sure you can "share/dereference" SpeedScript variables from javascript?

hielo 65 Veteran Poster

This is probably what you seek:

<!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=utf-8" />
    <title>Index</title>
        <style type="text/css">
			.marker
			{
				background-color:#0066FF;
				height:32px;
				width:32px;
				z-index:4;
			}
			
			#map
			{
				position:absolute;
				top:250px;
				left:0px;
				width:100%;
				height:auto;
				z-index:0;
				text-align:center;
			}
        </style>
     
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>
        <script type="text/javascript">
 $(document).ready(function(){
				var count=1;

				$("img.image").click(function(e){
					 var div=$("<div class='marker'></div>").attr("id","marker" + count)
					 								.css("left",e.pageX)
													.css("top",e.pageY)
													.show()
					 								.appendTo("div#map");
					 alert( div.attr("id") );
					});
            });
        </script> 
</head>
    <body>
		<div id="map"><img src="worldDotMap.png" height="429" width="900" alt="World" class="image" id="world" /></div>

    </body>
</html>
hielo 65 Veteran Poster
<xsl:value-of select="concat('/upload/product/new/',image)"/>
hielo 65 Veteran Poster

IMHO, this is simpler:

$arr_pcs = array("3408","1203","3421");
echo "'" . implode("','",$arr_pcs) . "'";