do you mean group or filter?
if you want to total the values that match the dropdown selection only then you want something like this:
SELECT SUM(col1) FROM table WHERE col2 = 'dropdownvalue'
do you mean group or filter?
if you want to total the values that match the dropdown selection only then you want something like this:
SELECT SUM(col1) FROM table WHERE col2 = 'dropdownvalue'
The name of the parameter declared in your datasource needs to be the same as the parameter defined in the query/stored procedure. Otherwise they won't map, afik.
<asp:Parameter Name="in_MPID" Type="Int32" />
You can set the parameter value in code prior to databinding/updating. (Look at OnDataBinding
& OnUpdating
events)
TECT_DataSource.UpdateParameters["in_MPID"].DefaultValue = x;
Although, I find this logically to be a bit of a hack, as setting the Default Value is not the same as assigning a value - but it has the same outcome.
Alternately, simply create the parameters dynamically at runtime in code.
TECT_DataSource.UpdateParameters.Add("in_MPID",value);
//you can also specify type and other properties in the method overloads
You might want to look into the other types of parameters as well. Of course it depends on your usage/requirements but I like the ControlParameters as they hook up to a page control such as a dropdown and automatically grab its value - great for user input based queries. SessionParameters (hook up to a session variable) are also great for passing things like sessionid, user login, and other persistent data to the query.
<asp:ControlParameter Name="in_MPID" ControlID="DropDownList1" />
//example.
http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html
What are you trying to group, what does your data look like?
The basic format is
SELECT SUM(col1) FROM table GROUP BY col2
Whatever.
Look... I develop for cross platform and cross browser compatibility. Always. I know how to make the various browsers quirks work, and was enquiring about a new attribute I hadn't explored yet. Again, the original question was theoretical in nature and the slight against IE was in jest. If you can't take the joke, take your rage-fest someplace where people care. Daniweb is not the place for it.
we don't go yelling around "I hate non IE browsers"
Except that that is exactly what you have been doing the last 2 posts.
You know, I have read some of your other recent posts as well, and you sound angry. Like you have a major chip on your shoulder against anyone who doesn't do things precisely the way you think they should be done. Maybe its just general teenage angst, I don't know, but you should probably talk to someone about it.
I posted for an intelectual discussion - which I am clearly not getting - not a flame war, and as such I am going to let this thread die without expending the energy to read or respond to this or other posts further.
OK neither of those answered my question.
@Dany12
thanks, but that doesn't help specifically - I can just use css.
@Troy_III
The question was posed out of simple curiosity as to whether MS had some proprietary implementation similar to the HTML5 attribute that they apparently don't support.
That's some of the dumbest reinventions I've ever seen!
Moreover it's against the core principles of web coding.
That's as may be but it is in the HTML5 spec.
Have you ever heard of CSS?
Thats why I said "do I have to just use the style properties" ... I know how to do it in css, I wanted to know if I could do it using the hidden attribute, or some other way supported in IE.
Evermore, w3schools are teaching you wrong HTML(5),
w3schools is a simple reference, not the be-all and end-all of web development. It was a quick and easy link to provide more information about the question I was asking, not a religous quotation.
Because in HTML(n) you don't have to write: <p hidden="hidden"> because it is a Boolean!
You can write <p hidden="bananas"> for that matter and it will work.
The proper HTML syntax is: <p hidden> and it will suffice.
If you actually read the page, they do have:
<element hidden>
<element hidden="hidden">
<element hidden="">
And how about <p disabled> or <a href=" " disabled>
I don't need to disable an element, I need …
is there a way of incorporating shell commands like PING into a T-SQL procedure?
Yes. This page has a demonstration of such.
However, let it be said that shell access via SQL is regarded as a high security risk and is often disabled, so it will depend on your level of access to the server whether you will be able to use those system procedures or not. Also, just because you can doesn't mean you should... if it is the only workable solution, then just make sure you and your team/admins know what it's doing and have some configuration & monitoring in place to ensure the system access is protected.
you could try using the onscroll event (the HTML select control supports this event) to call an ajax function which will trigger your sql cursor.
But due to the sheer quantity of data you are dealing with, you might be better served to use a datalist or something with paging capability to make it easier for your users to work their way through it all.
Is there a chance that there could be any server maintenance or database/table optimisation, backup or occurring at these times which may have some affect on the indexes or hold an extended table lock?
I would recommend checking all server logs for the specified timeframe to see if there is anything that may indicate a cause.
I would also ask the customer to report immediately next time the site is down as catching a live event may yield clues to the root cause as well.
It is still possible that this could be a coding error such as a loop running too long or forgetting to release a lock or transaction, or unintended SQL session carryover.
I think your query might be timing out on the larger files.
http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_connect_timeout
If you don't have access or are otherwise unable to set the timeout in the config, it can be done on the fly using a SET
statement executed via mysql_query
in PHP.
if(!$insert = mysql_query
is an assignment operation, which will always return true. If you are trying to check the success of the query operation, just use
if (mysql_query(...))
MySQL server has gone away
This means that the connection has been closed or has timed out, and the query is unable to complete execution - likely the cause of your second error.
mysql_fetch_assoc() expects parameter 1 to be resource
I can't see where line 113 is in your page code, but this error usually means that the query has failed. This could be a result of the previous error.
@Mitch
Thanks for the ideas. I do know about AD Auditing, but its more on the post-analysis of the resulting logs that I'm looking for. Also, I am more interested in network based access (AD Authentication entries for instance) than File level activity.
@Jorge
I think that SCOM is probably a lot bigger than we need, but I will look further into its log alert capabilities and see if there is enough value for me to justify including it in our planned server upgrade.
@Jim
Thanks, it looks like that tool might do what I need for the time being. I've downloaded and will give it a try.
---
Any more ideas or 3rd party tools I'd love to hear about, but I'll go ahead and mark this solved now. Thanks all.
12 year old scotch.
enough said.
No worries. Doesn't look like your comment stuck, but thanks and glad I could help.
Sorry, you can add to what I posted of course, I was just highlighting the check for your rewrite rules.
Someone correct me if I'm wrong, but I don't think the Error page or access rules need to be inside the IfModule
block. It's been a while since I wrote .htaccess rules by hand.
@Mitch
Thanks. We are mostly on older WS2003 Servers. Its not he logging itself that is a problem, the logs are catching all the information I need. What I am looking for is a tool to analyse the logs, and make them more easily human readable with the ability to filter for specific types of data and highlight patterns of activity. I have scripts I use for our linux servers and firewall logs, but I'm looking for a good easy way to do this with the Windows event logs.
correcting my code because apparently I'm dyslexic...
md5($email);
etc... not mdf
can't believe I posted that wrong through that whole thing and didn't even notice ... <facepalm/>
Have you got the Apache rewrite module active?
Try this
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.localhost/magiclight)(:80)? [NC]
RewriteRule ^(.*) http://localhost/magiclight/$1 [R=301,L]
</IfModule>
I will give you a really basic example of how this might work. Take a look at the md5 hash function.
This function will generate a hash (using the md5 algorithm) from any string you provide, the hash will always be the same given the same input string. For instance, 'user@hotmail.com'
will always produce the hash '7b928f8a1884fc44709e0b17ec65228c'
So your registration page would include something like this:
$email = $_POST['email']; // get the users email address from the form post
$hash = mdf($email); // generate the hash code
$link = "http://mydomain.com/confirm.php?email=".urlencode($email)."&hash=$hash"; // include the hash code in link to email to user
You then send the email to the registered address with the generated link, and the user must click on the link to confirm their valid email address. The confirm.php
page will then check the hash code.
$email = urldecode($_GET['email']); // grab the email & hash code from URL
$hash = $_GET['hash'];
if (md5($email) == $hash) { // check if the hash code matches
// successfully validated
// add email to registered user list here...
} else {
echo "invalid registration";
}
---
Note that md5 is a common algorithm and you may want to vary you hash output by adding something unique of your own to it so that people can't generate their own hash codes to manipulate or bypass the registration system. This is called Salt and is generally a fixed or random string that you add to your data …
The way email validation usually works is to have a unique key or hash that is sent to the email, and then passed back to the webpage when the user clicks on the link. The web page then needs to identify that the hash is the same as that which was generated for that email, the storage mechanism is largely irrelevant to this process.
You could for instance, store the hash together with the email in a flat file.
newuser@hotmail.com=GENERATEDKEYHASH
...
Or you could generate the hash based on the email address itself, so that the confirmation page will recreate the hash from the email and it must match the originally created hash to verify. This way you don't need to actually store the hash at all.
Your first query does give me rows 4 and 7
The second however returned no results.
It is because of the layout of the page - these styles apply to several different nested elements or tags in the html, not just the button. Depending on the actual styles implemented they will have quite different effects if applied directly to the button, which is not necessarily what the designer wants to achieve.
Sometimes it is necessary to nest elements like this to allow for full cross browser compatibility, especially when catering for older browsers. Sometimes it is necessary simply to achieve the desired layouts or visual effects.
button
These styles will apply directly to the button itself
button a
These styles apply to an anchor tag inside the button tag.
<button><a></a></button>
button a ins
these styles apply to text marked as inserted inside the anchor tag.
<button><a><ins></ins></a></button>
button a:hover
These styles apply to the anchor tag again, but only when it is in hover state - ie: the user has the mouse over the link.
take a look at array_keys
maybe something like...
$array_keys = array_keys($_POST);
foreach($array_keys as $key){
echo $key." = ".$_POST[$key]; // or whatever you want to do here
}
I think it depends on how you access the data from the mysql_result.
The mysql_fetch_array man page states:
Note: This function sets NULL fields to the PHP NULL value.
Yeah, I had a similar thing happen in one web app where I was using the same name for an SQL parameter in a couple different queries. It seems that somehow a value from another query was inadvertantly maintained in that variable holder in the MySQL Session and was used as the ID of a subsequent insert query. (hopefully that makes some kind of sense how I described it)
The upshot of it was that it overrode the auto increment, and everything went on fine until the autoincrement caught up and tried to reuse that key value. This caused a duplicate key error and the insert failed. I had to manually adjust the data to get the app back on track.
Whether this will be a problem for you, I suggest depends entirely on how your autoincrement fields are implemented if they will 'skip' existing values on their own.
I use the FPDF class and some extensions to it, and find it very useful. FPDI allows you to import existing PDF files to use as templates and you can add data via standard FPDF functions.
I need to confirm that is really worked?
The original code posted looks like it should work, although is a very basic example and would require a few minor adjustments.
However, although the script says to download the class from fpdf.org, when you get there the only downloads offered are manuals in various languages and ports to any language EXCEPT php
The download page is not very clear, but if you look just below the translated version, you will see links to the various versions. "v1.7" is the latest, and downloads a zip containing the required PHP class files. Here is a direct link to the download (Sorry Mods, if this is agains the rules feel free to remove this link)
this cose send attach but I'didn't send a text messagge.why?
The original code doesn't include and message content.
mail($to, $subject, "", $headers);
To fix this simply add it to this line.
mail($to, $subject, $message, $headers);
---
If anyone has any more questions I'll do my best to help out. If you have trouble with the original code in this post, let me know and I will post some sample code of my own that I know is working.
cheers
Mine comes from a character name I used when I first started playing MMO's. I had a bunch of characters, but this was the one that became well known in the guild and circle of players I was involved with. I started using it on the game forum, got an email address and lo and behold Hearth had become my online identity.
I could believe they are fairly accurate, however I think you are correct in assuming that much of what is categorised as "cyber crime" is probably very low on the severity scale. Personally, I get virus warnings - a lot of false positives, tracker cookies and things like that, and some genuine - every few months. I have also been receiving emails from various companies stating they have reset my passwords for various website/game accounts and the like due to "possible security breaches", it seem like every couple months.
Its impossible for any antivirus software to offer 100% protection. The only way to get that is to never go online, ever. It's unfortunate that these statistics are so high, but in my experience a lot of people aren't aware of what constitutes a risk or threat online. Education towards recognising threats, both before and after you have become their victim, I believe is the way forward.
The fact that my spam folders in gmail/hotmail are always full has to tell us something about the sheer quantity of dodgy stuff that is out there. But a very small percentage, I suspect, actually finds a mark.
You may also need to set the collation of your database, tables and/or fields to support the extended character set.
EG:
# Create New Database with UTF8 Collation
CREATE DATABASE `testdb` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
# Create new table with UTF8 collation and UTF8 field
CREATE TABLE IF NOT EXISTS `tbl` (
#...Fields...
`value` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
#...More Fields...
) ENGINE=InnoDB DEFAULT CHARSET=utf8_general_ci;
# change existing field collation to UTF8
ALTER TABLE `tbl` CHANGE `value` `value` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_general_ci
An apple and yoghurt - not together, that'd be weird.
I believe Dani is correct in this assessment. Direct transfers have little to nothing you can fall back on in the case of fraud, as I have experienced myself through a bad ebay purchase. In that case, I was able to claim back through ebay's own buyer protection program, but the Banks are not able to do anything as I was responsible for transferring the cash myself.
Credit Cards are another matter, in most cases the credit company/bank will be able to claw back the funds, and there are greater restrictions on the merchant receiving the funds in the first place.
You are right to be wary. My advice in general, never give out cash (direct bank transfers included) without a contract and formal invoice/receipt.
What editor are/were you using? (if you don't mind me asking)
Hey ... just had another thought. Can you open the code file in a text editor and show whitespace characters? It is possible that there is an invalid invisible character somewhere that is causing a parse error for php - I have seen this happen before.
Just an idea.
It means it found something incorrect in the php on that line. This error can also be caused by things like forgetting a semicolon, closing quote or bracket on an earlier line.
---
Hmm.. the code you have posted works fine for me. I am led to assume, then, that the error may be originating in your connect.php
or is possibly data related (invalid characters, or disparity in the character set being used in php to that in mysql).
I assume that your connect.php
includes a call to mysql_connect ... are you also checking to make sure the connection is successful?
Should your password hash be before tring to connect to the DB?
You need to set up your mail to be a multi-part MIME message, which means you need to generate boundaries and MIME headers for each section (message & attachments) as well as an overall/outer header. Additionally, non-text files (binary files) such as pdf's or images should be base64 encoded so they do not become corrupted when transmitted.
Here are the mail functions I wrote and use, which work fine for me sending attachments or using inline images etc.
function mime_attach($content,$filename,$format="text/plain",$encode=0,$embed=0) {
$mime = "Content-Type: $format; \n"
. ($encode?"Content-Transfer-Encoding: base64\n":"")
. "Content-Disposition: ".($embed?"inline":"attachment")."; filename=\"$filename\"\n"
. "Content-ID: <$filename>\n\n"
. ($encode?base64_encode($content):$content)."\n";
return $mime;
}
function send_mail($to,$message,$subject,$format="plain",$attach="",$priority=0) {
$boundary = "==allyourbasearebelongtous==";
$headers = "From: \"Altiora Martial Arts\" <noreply@altiorainsurance.com.au>\n"
. "Reply-To: <martialarts@altiorainsurance.com.au>\n"
. "MIME-Version: 1.0\n"
. "Content-Type: multipart/mixed; boundary=\"$boundary\"";
if ($priority) $headers .= "X-Priority: 1 (Highest)\n"
. "X-MSMail-Priority: High\n"
. "Importance: High\n";
$message = "--$boundary\n"
. "Content-Type: text/$format; \n"
. "Content-Disposition: inline\n\n"
. "$message\n";
if (is_array($attach))
foreach ($attach as $item)
$message .= "--$boundary\n".$item;
else if ($attach!="")
$message .= "--$boundary\n".$attach;
$message .= "--$boundary--\n";
mail($to, $subject, $message, $headers);
}
Example usage:
$message = "Test message. <br/>This can include HTML formatting."
//repeat this line for multiple attachments.
$atts[] = mime_attach(file_get_contents("./example.pdf"),"example.pdf","application/pdf",1);
send_mail("recipient@email.com",
$message,
"Test Email Subject",
"html",
$atts);
Try running the installer as Administrator, it might be a security issue under win7 preventing the install.
If you right click on the installer exe, you should have an option to Run as Administrator
you need to escape the string before saving it to the database.
In other words, str_replace("'","\'",$filename)
or better yet, use the function mysql_real_escape_string
It's good practice to perform this escaping on any user input string prior to saving to the database, as it helps prevent both errors and SQL Injection attacks.
try using display:inline-block
$outputstring = "</br><b>" .$name. " </b> le <?php
echo date('d/m/Y') ;
?> a <?php
echo date('G:i') ;
?> a ecris:<hr/>" .$area. "</br>" ;
I think what you want is something like this
$outputstring = "</br><b>" .$name. " </b> le ".date('d/m/Y')." a ".date('G:i')." a ecris:<hr/>" .$area. "</br>" ;
to add the date at time of posting to your output string.
ah, ok... your dropdown is inside a gridview, which I assume means you have a list of Locations the user can select from, and the parent records will display the selected Location they have been saved with. (hopefully that makes sense).
If so, this is going to be a 2 stage process:
1 - bind the dropdown to the list of items (which will be its own query/dataset, and databound as I described above)
2 - bind the selected item to the current record in the gridview.
it can depend on many things including differing versions of software installed on the server and the development machine (such as PHP or mysql).
It could also be different database configuration, assuming you are reading from an existing table to gather the data for your updates.
I suggest checking for differences between server configuration and your development machine, as well as any table data that you are relying on for certain assumptions in code.
Beyond that, post your code and see if anyone can notice any discrepencies.
I haven't tested this, but it should give you an idea of how to modify your existing loop to include the page breaks.
$db_results = $wpdb->get_results("SELECT * FROM table");
$counter = 0;
foreach ($db_results as $result) {
if ($counter % 40 === 0)
echo '<table><thead><th>Name</th><th>Number</th></thead><tbody>';
echo '<tr>';
echo '<td>' .$result->name. '</td>';
echo '<td>' .$result->number. '</td>';
echo '</tr>';
$counter++;
if ($counter % 40 === 0)
echo '</tbody></table>';
}
echo '</tbody></table>';
apparently I was trying to use the wrong version of the extension dll.
Erm, I think you'll find that it works
Conceeded.
I had to go back and read the documentation again as I've never seen it done that way before. AFIK that syntax is not standard SQL - at least not T-SQL or PL/SQL - but is MySQL specific.
The easiest way is probably to use a third party service like paypal or google checkout. When you sign up they usually provide you with sample code and instructions for how to incorporate it into your site, and they handle all the security side of things so you don't have to worry.