There is a updatemode on the update panels that you can set to conditional. Here is a tutorial on how to use it:
http://www.asp.net/ajax/videos/how-do-i-use-the-conditional-updatemode-of-the-updatepanel
There is a updatemode on the update panels that you can set to conditional. Here is a tutorial on how to use it:
http://www.asp.net/ajax/videos/how-do-i-use-the-conditional-updatemode-of-the-updatepanel
Ok, this takes a little bit more. You will have to create a PHP page between the order form and the process page. On this page you will need another form but instead of using text inputs use hidden fields and place the data you received into the value of the hidden fields. The Submit button on this confirm.php page will submit the data to the process page. The cancel button can just link to a dead page.
So...
The action on the order form will be confirm.php.
The action on the confirm page will be process.php.
Using the example I previously gave the hidden fields on the confirm page will look like this:
<input name="fname" type="hidden" value="<?php echo $_POST['fname'] ?>" />
Your SQL statment is failing so the mysql_query is returning a boolean value (false) instead of a result set.
Make sure that your SQL statement is valid.
try
SELECT id, SUM(exam_Fee+transport_Fee) FROM fee_info group by id
This will create a result set with two fields, the id and the sum of exam_Fee + transport_Fee.
If you only want the sum for one record use the where clause.
SELECT SUM(exam_Fee+transport_Fee) FROM fee_info where id = 2313
You could of course combine the two and also have the id in your result set
SELECT id,SUM(exam_Fee+transport_Fee) FROM fee_info where id = 2313 group by id
Great.
You can mix PHP and HTML on the same page so in the process.php page you can just add all the html for the confirmation.
Just remember everything between the <?php ?> tags are interpretted as PHP. Everything outside is treated as html. So after the closing PHP code you can have all the regular html code. If you need to use the PHP $_POST variables in your html, just include them inside the <?php ?> tags.
<p>Thank you <?php echo $_POST['fname'] ?> for your order!</p>
Now you may see some folks use <?= $_POST ?> which is just a shortcut for the previous statement. The only issue is that the shortcut can be turned off in the php.ini file and if this page is every hosted on someone elses server the shortcut might not work.
Just so your instructor doesn't take off points make sure that the HTML you put in your PHP page has all of the required tags (<html>, <head>, <body>). I used to take off points when my students didn't have valid HTML or a <title>.
If you are asking a question at this level I doubt very seriously that your teacher wants you to delve into ajax calls. PHP is a server side language and javascript is a client side language.
In order to use PHP you have to have a web server with PHP installed. In simple terms, as the page is being retrieved, on the server, the PHP code is being processed. The web browser DOES NOT process PHP.
Javascript is processed by your browser. It is most often used to produce various effects and for form field validation. The web server DOES NOT process javascript.
For this assignment I bet the teacher is not really interested in the javascript but just the PHP code. The easiest way is to have two files. The first one is just an html page to present the form and the second a PHP page to process the request.
Make sure that you order form fields (in the html) are surrounded by the <form> tag. on the <form> tag set the action to the PHP processing page and the method to POST.
<form action="processOrder.php" method="post">
The name attribute on your <input> tags are automatically translated into $_POST variables. For example, if you had the following code:
<label for="fname">First Name</label>
<input name="fname" type="text" />
<input name="submit" type="submit" />
(It is the submit button that sends your form data to the page specified in the <form> tag's action attribute.)
The variable in your PHP …
Your parms are reversed and the databse parm can be left out if you wish to use the last link open. Most pages only open one link anyway
The Syntax (from the manual) is:
resource mysql_query ( string $query [, resource $link_identifier ] )
http://php.net/manual/en/function.mysql-query.php
Sorry, I guess you are doing that in the db.php. I looked again and can't believe that I missed it the first time. I guess I thought it was part of the where clause.
The syntax for the SQL Delete is:
DELETE FROM table_name
WHERE some_column=some_value
Take CustomerName='$cname',CustomerAddress='$cusadd1',CustomerAddress1='$cusadd2',CustomerAddress2='$cusadd3',County='$ccounty',CustomerPostCode='$custpc',CustomerTelNo='$custele',CustomerEmail='$cusemail' out of the statement it should be
$str="delete from customer where customerid=$cid ";
You need to create a connection first. Look at this link and see that the perform a mysql_connect(...) before the mysql_query.
You should look at approaching this from a different perspective. You are not going to be able to access the ID attribute in the called PHP program. What you are going to need to do is build a link (either in a button or just text) that passes the information to the next page. Your link will contain the mode and the faculty id and look sonething like this.
printf("<a href='11.gif?mode='Edit'&id=%s>Edit</a>", $row['faculty_id']);
printf("<a href='11.gif?mode='Del'&id=%s>Delete</a>", $row['faculty_id']);
printf("<a href='11.gif?mode='Info'&id=%s>Info</a>", $row['faculty_id']);
When the link is selected the values are passed throught the $_GET structure instead ofthe $_POST structure
You could save the primary key in hidden fields on the web form after the initial save. If the value of the primary key is null or blanks (which is an invalid value for a primary key) you know that the record needs to be inserted. If it contains a value, you know you need to update the record. This will also ensure that you have the primary key available for the Update process.
The nature of web pages should guarantee that if you navigate away from this page and then back to this page from another page that this will always be true (except, maybe, if they used the back button on the browser).
You could add an extra piece of mind by clearing the primary key field in teh page load when Not Page.IsPostBack.
Instead of putting the SQL Statement in the mysql_query() function, put it into a variable and echo out that string so you can see the actual SQL statement that is being passed.
$sqlStmt = "UPDATE resume SET name='{$_POST['name']}', age='{$_POST['age']}', sex='{$_POST['sex']}', mobile='{$_POST['mobile']}' WHERE id={$_POST['id']}";
echo $sqlStmt;
mysql_query(sqlStmt);
If you cannot see the statement on the web page, do a View Source and you should be able to see the SQL statement somewhere in the HTML source.
Will the code really throw a 'multiple declaration error'? It has been a long time since I programmed in C, but I thought that there would just be two declarations for 'a', one global and one local to the for loop?
Basically the global declararion would be ignored in favor of the local declaration. Given the simplicity of the program, and that 'a' is really only used inside the for loop, it should still work.
The problem is really in the logic. The program will never solve the equation b = a3 * a2.
Since this seems like a homework problem and I can only give you a hint to why the code is not creating the correct answer.
Review the equation you are solving for and the look at the code again. I am sure that the answer will come to you.
Since you are filling the Select Box with the Unit of Measeure data from your database why not have the value attribute contain the calories for each of the different unit of measures. That way you can easily update the information on your page using javascript and not have to try and make another database request.
You can use the onchange event, of the select box, to perform the update.
It looks like you are not closing your second function properly.
function wordCheck($data, $fieldName) {
global $errorCount;
if (empty($data))
{
displayError($fieldName, "Please enter $fieldName");
$retval = "";
} else {
if (preg_match("/^[a-z]+$/i", $retval)==0)
{
displayError($fieldName, "Words must be letters only");
}
return($retval);
}
} // <======= Missing this closing Bracket
$words[] = wordCheck($_POST["lastname"], "lastname");
$words[] = wordCheck($_POST["forstname"], "firstname");
$words[] = wordCheck($_POST["address"], "address");
It appears that you put the closing bracket for the function all the way at the end of the code. Make sure you remove one of the closing brackets at the end of the code.
$wordnum = 0;
foreach ($words as $Word)
echo "Word ", ++$wordnum.": $Word<br />\n";
} } //<==== Remove one of these
Look into using an editor like Dreamweaver or Netbeans as they will help identify and highlight errors like these and maintain correctly indented code. When first starting out it is very difficult to spot errors, like this, if you don't adopt and maintain proper indentation. Actually, it is always difficult to follow improperly indented code.
Create a date data type.
Set it to the initial value.
Use in in while stmt incrementing the date with the DataArr function
NextDay = DateValue(DateStart.Text)
LastDay = DateValue(DateStop.Text)
While NextDay < LastDay
NextDay = DateAdd("d", 1, nextDay)
'
'
[I]' Your code to process each date[/I]
'
'
wend
You could use a subselect on the insert.
INSERT INTO "table1" ("column1", "column2", ...)
SELECT "column3", "column4", ...
FROM "table2" where column3 = $orderNumber
You would then only need two inserts. One to populate the invoice header from the order header and one to populate the invoice detail from the order details.
Table1 would be your invoice table and table2 would be your order table.
make sure that you are filling the drop down box correctly it should look like this now:
while(list($name)=mysql_fetch_array($result)){
echo "<option value=\"$name\" >$name</option> \n" ; }
// or
while($row=mysql_fetch_array($result)){
echo "<option value=\"$row['state']\" >$row['state']</option> \n" ; }
I am assuming that this PC is at your house and that you have a high-speed network.
This is just the simple view. I am no expert on setting up and I probably missed a step or two.
Look at GoDaddy, they have Linux and Windows hosting available.
Since your ID does not uniquely identify a state or a city but rather a user's comment you will have to change your thinking a bit. You should actually read about normalizing a database, but you could get away with the following code:
try
SELECT DISTINCT state FROM comments ORDER BY state
for you first drop down box.
I am the assuming that once the user selects a state you want to show a list of the cities in that state.
For the Second drop down you should then use:
SELECT DISTINCT city FROM comments WHERE state = '$state'
Once the user has selected the appropriate state and city you can then display a list of comments by using the following query
SELECT DISTINCT city FROM comments WHERE state = '$state' and city = '$city'
Tha handles cmdSend.cmdSend.Click is not right it should only be cmdSend.Click. I am not sure how it got this way. Try taking out the first cmdSend. and see if that helps
ASP.NET has a validation control that you can attach to the check boxes. What you need to use is the custom validation checkbox. I know that several of the validation controls generate client side and server side validation. I am not sure if the custom validation can does that. In any case, the server side validation will always be present.
The validation controls keep general validation off of the server until it passes the client validation. They also protect your application because if some tries to send invalid data, bypassing your form, the server side validation will be performed and the request rejected.
At the end of the statment you are escaping the two single quotes. I think that you only need one of them to complete the onclick code and I do not see anywhere else in the code where the single quote is escaped.
Is there a need... NO.
But the toolkit and extension provides a lot of Ajax functionality to your web applications.
Your coding example is correct as long as the variable $memberid holds the correct ID number for the current user/member.
In my example the userID is the column name in the database, the $user is a php variable that holds the user/memeber's id.
I am not sure where you are holding the user information once the user has signed in, but in order to have access to this information on every page and eve subsequent requests to the same page you will have to put this information into session or cookie variables. Session variables might make the most sense.
<?php
session_start(); // required for session variables
$_SESSION['memberid'] = $memberid; // Perform after user has successfully logged in
$memberid = $_SESSION['memberid'] // Perform whenever you need access to Member ID
The Text boxes for check1 and check2 have the same name... The horse ID. If you view the resolved HTML of the web page you will see that they have the same name and form field names need to be unique. Since the text fields are not unique, they are stepping on each other. You should prefix the text box names with the names of the database fields, like this:
<td><input type="checkbox" name="check1[]" value="<?php echo $Horses["HORSE_ID"]; ?>">
<!-- Creating Unique Field names for text fields -->
<input type="text" size="5" name="<?php echo 'Height_' . $Horses["HORSE_ID"]; ?>" value="<?php echo $Horses["HORSE_HEIGHT"]; ?>"></td>
This way every form field would have a unique name.
When you set up your SQL statement add a WHERE clause to restrict it to the current user.
let's say that the logged on user is in the $user variable. you would code it something like this.
$sql = 'SELECT * FROM data WHERE userID ='" . $user ."'"
You should probably substitute the field names you need for the *, but not knowing the layout of your data table this will retrieve everything from that table.
If you are using an MySQL database then you would want to execute the query like this:
//using mysqli functions
$result = mysqli_query($sql);
// using mysql functions
#result = mysql_query($sql);
You can find documentation and examples for mysqli functions here.
You can find documentation and examples for mysql functions here.
You need to make sure that the variable names match between what is on the URL and the $_GET variable. If you are passing dayArrive on the URL then you have to use $_GET to access it.
Yes. like this...
if (isset($_GET['dayArrive'])) {
// Process return variables
$dayArrive = $_GET["dayArrive"];
$month = $_GET["month"];
$year = $_GET["year"];
$nights = $_GET["nights"];
} else {
// First time processing (if any)
}
In order to access php variables They need to be inside <?php ?> tags.
Assuming that you have previously retrieved the correct row and that the $row now holds the data, you can use:
<a href = "mailto:<?php echo $row['sup_email']?>"></a>
PHP variables do not exist between pages you will either have to use session variables, cookies or URL vairiable to pass the information back.
The easiest might be to put the values into the URL. You would have to build your link for the return as follows:
$href = "AvailableRooms.php?dayArrive=" . $dayArrive . "&month=" . $month . "&year=". $year . "&nights=" . $nights;
Then change you link to be more like this
<a href="<?php echo $href ?>" target="_self" >Return to previous page</a>
This will create a link that looks like this.
<a href="AvailableRooms.php?daysArrive=15&month=5&year=2011&nights=6" target="_self" >Return to previous page</a>
Now the information is being passed back to the previous page correctly. You will have to also retrieve this information from the corresponding $_GET array just like you did with the post
$dayArrive = $_GET["dayArrive"];
$month = $_GET["month"];
$year = $_GET["year"];
$nights = $_GET["nights"];
You will also need to use isset($_GET["dayArrive"]) to test to see if you are getting data back or is this a first time display of the page.
You should look at the urlencode PHP function to make sure you do not have any issues passing information this way.
With Gmail I had to specify the port. I am not near that code right now but I believe it was port 465.
In phpmyadmin you have access to an text box where you can enter SQL just place the SQL code for your federated tables there.
Look for the tab that says SQL. I know my version has it (3.2.4)
Have you tried the .Net function ToUpper or ToLower? Here is the MSDN information on the function.
If you change the Apache configuration to look at *:80 instead of 192.168.1.56:80 then any incoming HTTP request, on port 80, will be processed by Apache.
So, if you are using the browser on the local machine, localhost or 127.0.0.1 will work. If you are trying to hit it remotely then 192.168.1.56 will work.
Your HTML button would look like this:
<input type="button" value='Uncheck' onClick="uncheck()" />
At the top of your HTML in the head section place the following code:
<SCRIPT LANGUAGE="JavaScript">
function uncheck() {
document.myform.box1.checked = false;
document.myform.box2.checked = false;
document.myform.box3.checked = false;
document.myform.box4.checked = false;
}
</script>
Make sure you substitute your check box names for box1,box2,...
If they are all the same name here is another technique for setting and unsetting all of them: Check box example
You should also look into the jQuery library.
1) Look at the LIMIT keyword in SQL You can specify the number records to retrieve and the starting record number. You can simply add your page size to the start position on a Next request and subtract page size for a Previous request.
2) If you are using the LIMIT for your paging, you can get a seperate SQL statement that SUMs the amount for a specific account. Use this total for your account total on the page.
3) If you are going to let the user change transaction lines and want the account total to reflect the changes, without having to requery the database, then use Javascript to keep you totals adjusted. Remember to subtract the original amount and add back the new amount.
4) If yo have made it this far, make sure that when the user submits the page all of the changes are stored in the Database. Don't forget to add this logic to your Next and Previous functions so the changes are not lost when the user requests another page.
The $con variable is only a local variable to your constructor method. When you reach the end of the method, your $con is no onger valid. It should be a class variable if you want to keep it around to use in your other methods.
Since you are trying to set this up as a class I would also use the $con variable in the mysql_query function (mysql_query($sql, $con)) just to avoid any confusion.
I would change the SQL statement to use LIKE instead of REGEX. You can change the where clause as follows:
From:
WHERE artist REGEXP '^[$mysortletter]'
To:
WHERE artist LIKE '$mysortletter%'
It might even be better on the database editor as it won't have to try and evaluate a REGEX expression. The only caveat is that Access uses the '*' instead of the '%'.