hielo 65 Veteran Poster

instead of simply executing mysql_query("..."); use mysql_query("...") or die( mysql_error() ); . This way you will get details about the error.

As for your ACTUAL problem, I am seeing field named "by", which is a keyword. To avoid this "beginner's mistake" (no offense), ALWAYS enclose the db name, table and field names in backticks:

mysql_query("INSERT INTO `markyourcard` (`date`, `link`, `by`, `time1`, `tip1`, `time2`, `tip2`, `time3`, `tip3`, `time4`, `tip4`, `time5`, `tip5`, `time6`, `tip6`, `time7`, `tip7`, `time8`, `tip8`)
        VALUES ('$date', '$link', '$by','$time1','$tip1','$time2','$tip2','$time3','$tip3','$time4','$tip4','$time5','$tip5','$time6','$tip6','$time7','$tip7','$time8','$tip8')") or die(mysql_error());

Lastly, to avoid "SQL injection" (if you don't know what that is, search it - there are tons of articles out there on the subject), instead of these:

$date        =     $_POST['date'];
            $link        =     $_POST['link'];
...

use these:

$date        =     mysql_real_escape_string($_POST['date']);
            $link        =     mysql_real_escape_string($_POST['link']);
...
hielo 65 Veteran Poster

Try:

SELECT Country, COUNT(*) as total FROM TABLENAME GROUP BY Country
hielo 65 Veteran Poster

@ip=$server1ip

ip is a node, NOT an attribute.

for testing purposes try: select="document('servers.xml')/servers/ip[@id='172.22.17.80']"

hielo 65 Veteran Poster

Assuming you are using PHP to process your form, when you create your form
give all your checkboxes the same name BUT add the following suffix "[]" -ex:

<form method="post" ...>
<input type="checkbox" name="hobbies[]" value="Reading"/>
<input type="checkbox" name="hobbies[]" value="Biking"/>
<input type="checkbox" name="hobbies[]" value="Traveling"/>
...
</form>

Then when you submit your form then:

if( isset($_POST['hobbies']) )
  echo 'Total Hobbies: '.count($_POST['hobbies']);
else
  echo 'No Hobbies checked';
hielo 65 Veteran Poster

assuming you are making an ajax call, when you send the request, be sure to set the ajax dataType option to "xml". Then use the find() method on the result. This is clearly explained here:
http://www.xml.com/pub/a/2007/10/10/jquery-and-xml.html

hielo 65 Veteran Poster

Yes, it is a keyword:
http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html

However, if you really want to use that, enclose with backticks:
create table emp2 (`Leave` decimal(12,2) default NULL)

and when you do any operation on that field (SELECT/UPDATE/INSERT,etc) don't forget to ALSO put the backticks around it as well.

hielo 65 Veteran Poster
i have contacted this with my hosting service they said its the problem with php mail () function

According to them, what exactly is wrong with it? mail() has no problems sending emails TO external/remote domains. If you are trying to authenticate to a remote server (like gmail) and send the email FROM that remote server, then yes, you would need to use phpmailer.


You can download the php class for phpmailer from:
http://phpmailer.worxware.com/

Look at the
Products > PHPMailer > PHPMailer Examples

page to see various examples of how to use it. Basically you need to include the phpmailer class at top of your file, and then instead of your current call to mail(), you will need to create a PHPMailer object, populate the needed properties and then call the send method.

hielo 65 Veteran Poster

Try:

SELECT TOP 10 SearchString, count (*) as total FROM SearchString 
ORDER BY count (*) DESC
GROUP BY SearchString

PS: please open a new thread for other questions. Even though the follow-up questions are related to your project, they are really not related to each other. Besides, it is to your advantage if you create a new thread for them since more people are likely to see your questions, especially if I am offline.

hielo 65 Veteran Poster

I think that result of ajax call cannot be assigned to variable.

Wrong, you can. In your case, it is in the "result" variable within the post callback function. You can simply take what's in it and assign it so whatever other variable you want.
Do you have a link to your page? There might be some incorrect reference to an element somewhere, but can't know for sure without looking at your markup.

hielo 65 Veteran Poster

line 2 is missing an equal sign. It should be:

$js=<<<SCRIPT

>>Hey Thanks Great Help
Glad to help

PS: Be sure to mark the thread as solved.

hielo 65 Veteran Poster
//save everything up to "SCRIPT;" in the variable $js
$js<<<SCRIPT
<script language="javascript" type="text/javascript">
			jQuery(document).ready(function() {
				$('#countdown_dashboard').countDown({
					targetDate: {
						'day': 		17,
						'month': 	9,
						'year': 	2010,
						'hour': 	1,
						'min': 		0,
						'sec': 		0
					}
				});
				
						});
		</script>
SCRIPT;
/*note the line where you see "SCRIPT;" MUST end with a semicolon IMMEDIATELY followed by a NEWLINE. If you leave spaces, you will get a runtime error. */

//now echo the javascript.
echo $js;
qazplm114477 commented: just learnt something new, thanks for that +1
hielo 65 Veteran Poster

when you execute SELECT SearchString, count (*) as total you should get a result set with TWO columns. One of the columns is named 'SearchString', the OTHER column is named 'total'. So intead of $fetch[count($fetch)] you need to use $fetch['total']

hielo 65 Veteran Poster
Select groups, count (*) as total from table group by groups
hielo 65 Veteran Poster

I see your method is "doPost()". I don't work with JSP, but IF in fact your server-side script is expecting a POST request, then the ajax you need to set the appropriate headers.
So, REPLACE xhrequest.send(null); with the following:

xhrequest.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xhrequest.setRequestHeader('Content-Length',0);
xhrequest.send('');
hielo 65 Veteran Poster

try:

$("#ka").change(function(){
	var nadkat=$("#ka").val();
	$.post("uzmi_podkategorije.php", { nk: nadkat },  function(result){   
			$("#pka1").show();
			var niz=podaci.split("+");
			var i=-1,limit=niz.length;
			while(++i<limit){
				$('<option value="'+niz[i]+'">' + niz[i] + '</option>').appendTo('#pka');
			}
	});
});
hielo 65 Veteran Poster

change: <input type="submit" name="submit" id="submit" value="Submit"> to: <input type="submit" name="Submit" id="Submit" value="Submit"> uppercase "S" for the name and id. Do not use lower case since it is reserved for javascript.

As for your problem (with the current submit button), it is on line 138. Change the input field as suggested above and leave line 38 as it currently is.

hielo 65 Veteran Poster

change: page_request.onreadystatechange=function(page_request, containerid){ to: page_request.onreadystatechange=function(){ if you leave them there, then they will be undefined within the onreadystatechange function unless you explicitly pass those values. But you do not need to do this since the variables of function ajaxpage() are visible within the onreadystatechange function.

hielo 65 Veteran Poster

Can i change this url to alertpay payment gateway url? If i change this url will it working?

Not likely. If you changed the URL to point to MY site, then on my site there would need to be a script in place that "receives/processes" the information sent to my server.

If in YOUR original form you had an input field with name="personName" and you were submitting this to paypal and everything worked fine, that's because paypal's script is programmed to "expect/lookout" for a form field named "personName".

Since you are now changing the url to MY site, then on my site, it is very likely that the processing script is looking for a DIFFERENT field name - like name="fullname" .

That means that you need to find out which fields MY site is expecting and then change your form fields accordingly.

That's the reason these companies publish the documentation. You need to read it.

hielo 65 Veteran Poster

When a function executes Synchronously, the following statement is NOT executed until the previous one is done executing - ex:

/* here, the statements are executed one after the other. In other words, if the web server is experiencing delays and it takes 5 seconds to respond then you will see the second alert 5 seconds after the message "Checking Username".
*/
alert("Checking Username");
var username = makeSJAXCall();
alert(username);

By contrast, Asynchronous calls do NOT wait for completion before moving on to the next statement - ex:

/*
here you see the "Checking Username" message and almost immediately after that you will see the second alert. Since the Asynchronous function has not completed, username does not have a value and you should see undefined as the second message.

So how do you "campture/receive" the result. This is where the callback function comes into place, which is what is typically executed onreadystatechange.
*/
alert("Checking Username");
var username = makeAJAXCall();
alert(useranme);
hielo 65 Veteran Poster

to reload the whole page:

<a href="#" onclick="top.location.reload(true)">Reload Page</a>
hielo 65 Veteran Poster

That typically happens when you have the WRONG path to the image and/or you have misspelled the image name. Also, be aware that some webservers are case-sensitive. So if your image name is "logo.gif", then if you code "logo.GIF", it will not work.

So, your first task is to figure out the full path to your image. Type it directly in the browser's address:
http://www.yoursite.com/Images/logo.gif

If it loads, then you have the right path and you should be able to use that path in your image - <img src="http://www.yoursite.com/Images/logo.gif"> Also, if you are viewing your page via http, but your code uses the file protocol - <img src="file:///..."> then it will not work. You must reference the image using http, so you will need to upload the images to webserver.

hielo 65 Veteran Poster

hi hielo.. from now on i'm gonna call you my master

As you wish little grasshopper :)

Glad to help.

Regards,
Hielo

hielo 65 Veteran Poster

When you create a table, you need to specify the engine - ex:

CREATE TABLE `dbName`.`tableName` (
 ...
)
ENGINE = INNODB
CHARACTER SET utf8 COLLATE utf8_general_ci;

By default, it is MyIsam. As a matter of fact, line 7 of your post CLEARLY shows that MyISAM IS the default engine on your db server.

Your post simply confirms that your DB "supports" InnoDB IF you choose to use it on your tables, but you have to specify which engine to use on the tables. If you don't it will assume you meant MyISAM, which does NOT support constraints.

All the tables involved in the relationship constraints will need the InnoDB storage engine.

hielo 65 Veteran Poster

save this as hielo.html and try it:

<!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" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>test page</title>

<script type="text/javascript">

function ajaxpage(url, containerid){
	page_request = false;
	if (window.XMLHttpRequest){ // if Mozilla, Safari etc
		page_request = new XMLHttpRequest()
	}
	else if (window.ActiveXObject){ // if IE
		try {
			page_request = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e){
			try{
				page_request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e){
				return false;
			}
		}
	}
	else{
		return false;
	}
	page_request.onreadystatechange=function(page_request, containerid){
		if (page_request.readyState == 4 && (page_request.status==200 || window.location.protocol.indexOf("http")==-1)){
			document.getElementById(containerid).innerHTML=page_request.responseText;
			page_request=null;
		}
	}

	page_request.open('GET', url, true);
	page_request.send(null);
return false;
}


</script>
</head> 

<html>
<body>
	<div id="leftdiv" style="float:left;">
		<a href="#" onclick="return ajaxpage('page1.htm', 'rightdiv');">Menu1</a>
		<a href="#" onclick="return ajaxpage('page2.htm', 'rightdiv');">Menu2</a>
		<a href="#" onclick="return ajaxpage('page3.htm', 'rightdiv');">Menu3</a>
	</div>
	<div id="rightdiv" style="float:right;"></div>
</body>
</html>
hielo 65 Veteran Poster

all you need to do is use preg_replace() to remove the unwanted set of characters.

//your initial string
$str = 'img*1L%^_ove>ly.jpg';

/*
//this removes anything that is NOT
//a,b,c,....z
//A,B,C,...Z
//0,1,2,...9
//In other words, it KEEPS only a-z, A-Z, and 0-9. 
//If you want other character(s), simply add 
//it(them) immediately after the "9"
*/
$str = preg_replace('#[^a-zA-Z0-9]#','',$str);
hielo 65 Veteran Poster

In details.php you would need something similar to:

<?php
mysql_connect("localhost", "username", "password") or die( mysql_error() );
mysql_select_db("dbname")  or die( mysql_error() );

$sql =sprintf('SELECT * FROM job_profile WHERE id=%d', intval($_GET['id']);
$result = mysql_query( $sql ) or die( "Error executing:<br>$sql<br>".mysql_error() ) ;

if( mysql_num_rows($result) )
{
  echo '<div>No records found</div>';
}
else
{
  $row=mysql_fetch_assoc($result);
  echo '<table><thead>';
  echo '<tr><th>' . implode('</th><th>', array_keys($row)) . '</th></tr></thead><tbody>';
  do{
    echo '<tr><td>' . implode('</th><th>', $row) . '</td></tr>';
  }while($row=mysql_fetch_assoc($result));
  echo '</tbody></table>';
}
?>
hielo 65 Veteran Poster

You are welcome.

Regards,
Hielo

hielo 65 Veteran Poster

on line 2 you forgot to call mysql_query() so that it ACTUALLY executes the query. You are simply assigning a string (the sql statement) to $blogpost.

hielo 65 Veteran Poster

Make sure your tables are using InnoDB Storage engine and then try:

ALTER TABLE `ORDERS` ADD FOREIGN KEY(`CUSTOMER_NUM`) REFERENCES `CUSTOMER`(`CUSTOMER_NUM`);
hielo 65 Veteran Poster

try my post.

SELECT blogpost, DATE_FORMAT(dateandtime,'%M %e %Y at %h:%i%p') as dateandtime FROM TABLENAME

just replace TABLENAME with the actual name of your table.

hielo 65 Veteran Poster

I meant to write "it looks like in your db field `profileid`..."

Based on the link you posted, your links have

href="http://hvn.org.uk/searchengine/details.php?id=<?php echo 1; ?>"

but it should be simply:

href="http://hvn.org.uk/searchengine/details.php?id=1"

hence my suspicion that your table field has PHP code instead of just a unique numeric value.

hielo 65 Veteran Poster

AFTER page_request.send(null) put return false; AND
change these:

<a href="javascript:ajaxpage('pageX.htm', 'rightdiv');">MenuX</a>

to:

<a href="#" onclick="return ajaxpage('pageX.htm', 'rightdiv');">MenuX</a>

where "X" is 1, 2, etc.

hielo 65 Veteran Poster

yes, I restored the default permissions. IE doesn't prompt me either

Strange. I restored my permission on IE and even though it is set to "disabled", it still prompts me. Not sure if this is an OS "feature" and/or IE Version. I tried it on IE 6 and 7 with Win XP/SP3.

hielo 65 Veteran Poster

it should like in your db field `profileid` you have PHP code instead of just a number. Make sure you have a unique number in it.

hielo 65 Veteran Poster

line 54 should be id="rightdiv" NOT class="rightdiv" . Also, get rid of that "dangling" left;

hielo 65 Veteran Poster

instead of

SELECT * ...

use:

SELECT blogpost, DATE_FORMAT(dateandtime,'%M %e %Y at %h:%i%p') as dateandtime ...
hielo 65 Veteran Poster

give them a result as a link which able to redirect them based on their search

assuming your search.php page is doing:

$query = "SELECT linkURL, linkText FROM Resources WHERE linkText LIKE '%{$searchTerm}%'";

(where Resources is your table name) and then generating:

<a href="http://remotesite.com">some text</a>

when you search the db, instead of getting that url ("http://remotesite.com"), be sure that your table has a unique ID for that Resource:

$query = "SELECT id, linkText FROM Resources WHERE linkText LIKE '%{$searchTerm}%'";

and then generate the following links instead:

<a href="search.php?id=37">some text</a>

where 37 is supposed to be the id you retrieved from your query originally. So when the user clicks on the link, the browser will go back to your search.php page, and $_GET will have the id of the link the user clicked. So, BEFORE you even do the SELECT query you would need to see if $_GET is present and if it is, then you query the db for the linkURL and then redirect the user.

<?php
$tableName='Resources';
//do your db connection stuff here


if( isset($_GET['id']) && !empty($_GET['id']) )
{
  $query=sprintf("SELECT linkURL FROM $tableName WHERE id=%d, intval($_GET['id']));  

  //here see if you get a result based on the above query. 
  ...
  
  If yes,
  {
    //then do an update statement 
    /*
    $query=sprintf("UPDATE clickTracker SET clicks = clicks+1 WHERE Resource_id=%d, intval($_GET['id'])); */

    //where $row['linkURL'] is the URL you were supposed to extract above.
    header("Location: " . $row['linkURL']);
    exit();
  }
} 

//here you would do your initial search:
$query = …
hielo 65 Veteran Poster

I tried exactly what you posted and it works fine for me. Here is something else I tried:
http://articles.sitepoint.com/article/xml-data-source-object/

(specifically refer to page 2) and it also works for me. I suspect your problems are all tied to security permissions. If that is the case, I suspect that even that other approach will not work for you.

hielo 65 Veteran Poster

I know you changed the permissions as I previously suggested just to see if what you had then worked fine (which it did), but I also know you then restored your permissions. Are you absolutely sure you restored your permissions correctly? Based on your original post, where you said "IE is able to load html pages through ajax call but not able to load xml document." It sounds like originally you were able to get the content via responseText, but now you seem to be getting permission denied. Does IE even prompt you if you want to run the 'active content' (the yellow bar that pops up at the top requiring you to click on it and decide whether allow the script to run)?

hielo 65 Veteran Poster

OK so you are still NOT able to see anything via alert(page_request.responseText) when requesting an XML file. What about if you try an html file. It seems like originally you were able to do so. I've never come across an IE version where you can get the HTML contents but not the XML contents (verified via the responseText property of the ajax object).

hielo 65 Veteran Poster

you are probably "erasing" your original field OR the field is not in the DOM when you call the function. Can't tell you for sure without looking at your actual page online!

hielo 65 Veteran Poster

Are you always getting "ERROR" when you submit the form? If yes, then try changing $header="from: $name <$mail_from>"; to:

$header="From: " . $mail_from . PHP_EOL;
$header="To: " . $to.PHP_EOL;

If you are NOT seeing "ERROR", then check your spam folder.

hielo 65 Veteran Poster

try:

function calc(){
				
 room_charges = isNaN(parseInt(document.ipd_bill.room_charges.value)) ? 0 :  parseInt(document.ipd_bill.room_charges.value);
  lab_charges = isNaN(parseInt(document.ipd_bill.lab_charges.value)) ? 0 :  parseInt(document.ipd_bill.lab_charges.value);
  consultancy_fees = isNaN(parseInt(document.ipd_bill.consultancy_fees.value)) ? 0 :  parseInt(document.ipd_bill.consultancy_fees.value);
  blood_charges = isNaN(parseInt(document.ipd_bill.blood_charges.value)) ? 0 :  parseInt(document.ipd_bill.blood_charges.value); 
organ_charges = isNaN(parseInt(document.ipd_bill.organ_charges.value)) ? 0 :  parseInt(document.ipd_bill.organ_charges.value); 
discount = isNaN(parseInt(document.ipd_bill.discount.value)) ? 0 :  parseInt(document.ipd_bill.discount.value);
document.ipd_bill.total_payment.value = eval(room_charges) + eval(lab_charges) + eval(consultancy_fees) + eval(blood_charges) + eval(organ_charges) - discount;
}
hielo 65 Veteran Poster

But it is not clear where you are actually calling session_start().

Also, it is NOT clear if you have a variable holding a reference to the db connection. If you do, you need to pass that variable to your user_login() function. Post your code if you still can't resolve it.

hielo 65 Veteran Poster

try:

<%
'Note: No Trim() nor UCase() after the "to"
for i=1 to Request.QueryString("print").Count

'NOTE: the (i) is adjacent to querystring
If Trim(UCase( Request.QueryString("print")(i) ))  = Trim(UCase(rsAuto.Fields.Item("vin").Value)) Then %>
<tr>
<td width="10%" height="45" align="center" valign="middle"><%=(rsAuto.Fields.Item("year").Value)%></td>
<td width="15%" align="center" valign="middle"><%=(rsAuto.Fields.Item("make").Value)%></td>
<td width="30%" align="center" valign="middle"><%=(rsAuto.Fields.Item("vin").Value)%></td>
<td width="15%" align="center" valign="middle"><%=(rsAuto.Fields.Item("title").Value)%></td>
<td width="25%" align="center" valign="middle"><%=(rsAuto.Fields.Item("ticket").Value)%></td>
<td align="middle" valign="middle"><%=(rsAuto.Fields.Item("color").Value)%>&nbsp;</td>
</tr>
<%
End If
Next
%>
hielo 65 Veteran Poster

Let's take it one step at a time. Originally you said:

In Firefox everything works fine.
IE is able to load html pages through ajax call but not able to load xml document.

If upon completion of the ajax request you put: alert(page_request.responseText) a. Do you see the xml string in FF?
b. Do you see the xml string in IE?

If you answered yes to both of them, then try the following changes:

...
if(page_request.status==200 || page_request.status==0) {
	if(window.ActiveXObject && page_request.status==0)
	{
		page_request.responseXML.loadXML(page_request.restponseText);
	}         
	responseHandler(page_request);
}
...

If you answered yes to "a", and no to "b" then your permissions are definitely to restrictive and you will have to ask the users to loosen it. They don't have to loosen the restrictions on the "Internet" zone, but they can do so in the "Local Intranet" zone.

hielo 65 Veteran Poster

Hello to you too Airshow. I've been very busy lately, so I've been mostly off lately.

hielo 65 Veteran Poster

it will take different rows in the database right?like baseball in one row then basketball in the second row

correct

but this might be better:

<input name="sport[3][]" type="checkbox" value="baseball">
<input name="sport[3][]" type="checkbox" value="basquetball">
<input name="sport[3][]" type="checkbox" value="football">
<input name="sport[3][]" type="checkbox" value="hocket">

<input name="sport[7][]" type="checkbox" value="baseball">
<input name="sport[7][]" type="checkbox" value="basquetball">
<input name="sport[7][]" type="checkbox" value="football">
<input name="sport[7][]" type="checkbox" value="hocket">

where 3 and 7 are the corresponding personId. So to do the insert:

foreach($_POST['sport'] as $personId=>$sports)
{
  foreach( $sports as $value)
  {
   $sql = sprintf("INSERT INTO `Atletes`(`personId`,`sportName`) VALUES('%s','%s')"
                ,mysql_real_escape_string( $personId)
                ,mysql_real_escape_string($value)
                );
  }
}

and will you please help me in displaying the value from the database too,

all you have to do is to execute a select statement:

$result=mysql_query("SELECT personId,sportName FROM Athletes") or die( mysql_error() );
while($row=mysql_fetch_assoc($result))
{
  echo sprintf(PHP_EOL.'<div><input type="textbox" name="sport[%s][]" value="%s"/></div>',  $row['personId'], $row['sportName'] );
}
hielo 65 Veteran Poster

the space needs to go immediately to the left of the "s" in "seats": alert("I want a car with " + work_car.seats + " seats yeah");

hielo 65 Veteran Poster

the space needs to go immediately to the left of the "s" in "seats": alert("I want a car with " + work_car.seats + " seats yeah");