If you really need these variables set in JavaScript then you might do the following:
var today = new Date(),
nextMonth = new Date();
nextMonth.setDate(nextMonth.getDate() + 30);
If you really need these variables set in JavaScript then you might do the following:
var today = new Date(),
nextMonth = new Date();
nextMonth.setDate(nextMonth.getDate() + 30);
Where is $GroupCode being defined? The lack of a definition (due to it being indicative of having register_globals turned on) is more worrysome than the rest of the issues in your code. Let's start with that and work our way through it.
I am beginer of php.
Now only i have learned inserting deleting and implemented in my website now i need to insert image,,
What is your logic behind wanting to store the image within the database system instead of the regular file system? It's not that it's impossible (or even difficult), but that we want to ensure you're doing it for the right reasons. You've said it yourself: you're new to PHP. Help us help you by answering our questions.
if($results = mysql_num_rows($sql_query)) !== 0) //here!!!!
That line is throwing an error because you have closed both parenthesis, but then continued on to use a conditional operator. It looks to me that you attempted to do this:
if (($results = mysql_num_rows($sql_query)) !== 0)
Perhaps most importantly: I would strongly encourage you to stop using the original MySQL extension. As of PHP 5.5.0 the extension has been deprecated. It has not been actively developed in quite a few years. MySQLi or PDO are the recommended alternatives.
The outlook for programmers is good. IT as a whole is thriving as far as number of jobs, and those opening up, goes. The career opportunities are rather endless outside of game development. You could go to work for a software house, contributing to whatever software it is they sell. Or perhaps go to work for a company in their IT department and create/maintain internal applications (medium to large banks are notorious for writing their own applications).
Hi all,
I have more than 50 pages in a site. suppose, in every page i want to write "ABC" and edit every some days. Please anybody tell me the code how i can call ajax file in php. And complete code for both files.
First off, you're not making the Ajax call in PHP but rather the other way around. You would use Ajax to ask the PHP script for some output (in this case, anyways).
There are a whole slew of ways of doing this. But for simplicity I would encourage you to pick up a JS framework such as jQuery (specifically it's Ajax functionality). Your PHP script would then return the "ABC" (or whatever it needs to be).
Using mysqli_error () won't solve the problem. Rather, it'll aid in diagnosing it. What is the output received when you kill on mysqli_error? The PHP error you're receiving is due to a bad query, so the output of mysqli_error is critical.
What's happening is your queries are erring out. Thus instead of a MySQL resource being returned by mysql_query (), an error is being passed. mysql_num_rows () expects, not surprisingly, a MySQL resource and not such an error.
One of the easiest ways to output this (per chrishea's suggestion) is to use an or die () clause.
$sql = mysql_query ('SQL HERE') or die (mysql_error ());
The result is: if the query fails the or die () will invoke, outputting the contents of mysql_error ().
One final note: you're using the outdated and, now, deprecated MySQL API. Unfortunately many online tutorials/guides are slow to move with the tides. It has been an extremely long time since the original API has been recommended, though. I would strongly encourage you to read up on, and switch over to, MySQLi or PDO. Given you're still very new, MySQLi done procedurally may be your best bet.
what is difference b/w web development & web designing.In which we have better scope or income?
Developers will, per national average, earn a higher salary than designers. That said, the two are entirely different skillsets and require different mentalities. People don't typically choose to go one way or the other due to salary, but rather which jives with their personality and the way their brain functions.
http://www.indeed.com/salary/Web-Designer.html
http://www.indeed.com/salary/Web-Developer.html
Takes those numbers with a grain of salt though. The difference may be even more marginal than Indeed leads one to believe.
can they hack using utorrent or any torrent downloader software ?
Any software could potentially be used for malicious intent if there is a security vulnerability within it. Is uTorrent any more or less secure than its alternatives? Who knows.
**whisper* - Happygeek, who are you considering a spammer?
Likely the person who made a thread in which all they did was post the URI to a web site.
i have forgot yahoo passwrod and i also forgot first name of my favorite uncle name
Here's a quick thought then: ask one of your parents. He's their brother/brother-in-law. If you've managed to forget the first name of your favorite uncle then let's hope they haven't forgotten the name of someone they grew up with.
Dear all, I would really appreciate your help and assistance with a bug i'm facing in myphpadmin Mysql table.
I have a table which is named as total amount. I also have a front end php. interface where i do my data entry from. When I enter for example (100000) it displays as its is, but I'm facing difficulty when i have to check my totals because i want when ever i eneter (100000) it should automatically display or store my data as (100,000) or if im entering an amount ( 54600) fifty four thousand six hundred it should diplay it ( 54,600) so the confusion doesn't occur in reading the amounts. I'm going to paste the coding of my php page and if you think there is anything i need to make changes from dreamweaver i will do that accordingly. thank you ! i really appreciate the effort. Thanks!
So you're asking how to format numbers (100000 to 100,000) with MySQL? If that's the case then this isn't an issue for your database. Number formatting should be handled at the application level. MySQL doesn't, and shouldn't, care how data is going to be interpreted or displayed. It's merely concerned with accurate and safe storage and retrieval of said data.
Given you're using PHP you can easily format your output via its number_format () function. Use that upon output of the number.
Also, there are far too many issues in your code for me to bother …
I'm a student and I have to make a program with Console application to manage a Bank Account, using Classes.
The program must be able to:
- Create e new bank account
- Deactivate a bank account
- Draw money from account
- show the account balanceI tried to write something, and I want to ask you if I'm going worng or need to go through GET and SET.
If you create a bank account, they need more data from your side like date of birth an more.
I wrote some code below, please tell me the next step.I'm a student and I have to make a program with Console application to manage a Bank Account, using Classes.
The program must be able to:
- Create e new bank account
- Deactivate a bank account
- Draw money from account
- show the account balanceI tried to write something, and I want to ask you if I'm going worng or need to go through GET and SET.
If you create a bank account, they need more data from your side like date of birth an more.
I wrote some code below, please tell me the next step.I'm a student and I have to make a program with Console application to manage a Bank Account, using Classes.
The program must be able to:
- Create e new bank account
…
In the last two posts above there are bracets missing. So the correct code is:
Mltiple isset () calls are not needed. That's an unnecessary action due to the isset () function being capable of receiving multiple parameters. Reference PHP's documentation on the isset () function.
When multiple parameters are passed to isset () it will return true if all are set or false if any of them are not. Thus it's the same logic as the code you've presented, but removes unnecessary code.
isset ($_GET['submit'], $_GET['test'])
We can't solve problems by using the same kind of thinking we used when we created them.
Albert Einstein
I love this quote and feel it can be applied to most anything.
Hi
I am very new php propgramming. But I have done classic asp.
I have a string request, eg www.xyz.com?test=1In my php page, I would like to read test value.
On my index.php, I have this code.
<?
$y=$_GET["test"];
?>But I am getting error, Undefined index: test in index.php.
I can see, when I call index page first time, I call just as www.xyz.com.Please can some help.
Many thanks.
You need to check for the existence of the query string prior to using it. When calling http://domain.tld/index.php there is no query string. Thus $_GET['test'] does not exist. Hence the notice you're receiving.
if (isset ($_GET['test']))
echo $_GET['test'];
How to upgrade PHP 5.2.10 version to PHP 5.2.13? I have already had PHP 5.3.19 and downgrade the version to PHP5.2.10 and I need of PHP 5.2.13. I have downgraded version using the script file.
Thanks in advance.
You can get ahold of previous PHP release versions here. Your best bet will be to install via source.
I went and saw Skyfall in theaters last night. I'm not typically a James Bond fan but I enjoyed the movie.
ello everyone,
Hello everyone,
I wanna make software like ipmsg aur any lan mssnger software . Please any one guide me from where i can start my work . I am good in coding but dont wanna from where i have to start this .
Miranda IM may be what you're looking for. It's free and open source to boot.
plzz help...
http://speedtest.in/results/12110293e01edd3b7fa9e60491cb88b076bd this website n other all website same result except http://www.speedtest.net/result/2328677319.png
first one is showing me more speed to download.. and i m getting only 70-80 kbps...
plzz help... :(
In order to accurately test your bandwidth you should be connected directly to the ISP's modem. If you're presently behind a router then that may affect your speed. Also ensure you are not running any bandwidth intensive applications (such as P2P software).
Once you've tested your speed accordingly (or if you already have), contact your ISP with the numbers. They'll be able to tell you whether there is a problem or not. It's very possible they only sold you a 1Mb connection. Or their service may have no form of agreement on throughput. You're only going to find out by talking to them.
I have heard about this Internet Marketing for years now, How can you make some profit while sitting on your desktop? Thank you for your shared knowledge :)
First off, I hope you're not actually sitting on your desktop!
On topic though: do you actually have something to market? Online marketing is simply traditional marketing adapted to the technologies and rigors of the Internet. You need to actually have something to market in order to perform online marketing.
Knowing what products you're trying to promote, or at least what *types* of products, would help us in guiding you in the right direction.
that seem to be a good plan. just one question what is ext?
$ext is referring to the file extension (.jpeg, .png, etc.).
Apple devices have unique user agents, all with their device name within it. For example, an iPhone 5 may have a user agent of Apple-iPhone5C2 (which, by the way, will be most USA-based iPhone 5 users). This can be taken advantage in detecting whether a visitor is using an Apple device. The following script will do just that:
<script>
//<![CDATA[
iosReg = '/apple-[ipod|iphone|ipad]/i';
if (navigator.userAgent.search (iosReg))
{
// What do you want to do with the Apple device?
}
//]]>
</script>
Fortunately (or unfortunately, in this case) I am an Android user so I cannot test the validity of my RegEx pattern. But it should be fine.
$result = mysql_query($query) or die (mysql_error ());
Append the or die (mysql_error ())
clause to your query. This will print any errors stemming from MySQL. If you receive any then post what it is here. If you do not receive any errors then it's a logic error within your application flow or variable definitions.
Hi guys,
I have decided to learn php, can some one help me to give a good start. Is it mandatory to know any language before i start learning Php. I have no knowledge in any programming langauge. Any help would be much appreciated. Thanks in advance guys.
There are no prerequisites to learning PHP, per se. That's not to say there aren't any languages/technologies that go hand-in-hand with PHP. Even though PHP is categorized as a general purpose language it's still very much designed for web development. It does not replace client-side technologies such as HTML, CSS or JavaScript. You'll want to familiarize yourself with at least HTML and CSS in order to create and stylize web documents.
bobs mentioned MySQL. And I agree with him, though I would like to expand a little on that front. PHP's role is largely centered around data; retrieval, storage and manipulation to be specific. The vast majority of the time that data is going to be coming from a database. MySQL is one of a few commonly used RDBMS solutions (relational database management systems). It's easily the most popular amongst hobbyist developers and has an extraordinarily mature documentation and community. Thus support for it is ample.
There are alternatives though. PostgreSQL is the next big name in open source RDBMS solutions. The MySQL vs. PostgreSQL discussion is huge and outside the scope of this article. But I do want you to at least be aware of its existence. Also, …
thanks for the try =)
what i want is 1 value per column not two separated in any delimeter
So if one column contained 'hot' and the other contained 'dog' you'd want 'hotdog', correct? If that's the case then blocblue's solution is correct. Merely remove the delimiter from the CONCAT function.
SELECT
CONCAT(a.col1, b.col1) AS fused
FROM table1 AS a
LEFT JOIN table2 AS b
ON a.id = b.table_a_id
Are you constantly receiving this error or only after submitting the form? If it's constant then the problem lies with you not checking for form submission. Otherwise are you using the correct enctype attribute on the FORM element?
Make sure form submission has taken place prior to working with superglobals such as $_GET, $_POST and $_FILES
if ('POST' === $_SERVER['REQUEST_METHOD'])
{
// work with the upload
}
Using multipart/form-data enctype
<form method="post" enctype="multipart/form-data">
I could spend my entire work day on Wikipedia if I wasn't careful.
People and there's absolutely zero hesitation there. I do IT work for a non-IT company. Thus my coworkers have zero appreciation or understanding for what it's like to have someone repeatedly interrupt your train of thought. It doesn't help that I work in the auto industry and people are, by tradition, very talkative. It's an encouraged trait. You don't sell cars by keeping quiet around customers. Team that with my office being right off the showroom and it creates a very annoying environment.
Second to that would be music, excluding classical. I can play classical and remain entirely focused. If anything it actually helps promote focus for me. Especially when it works as an indicator to my coworkers to just let me work (those that actually get the clue).
I'm really not much of a gamer. Few hold my interest for very long. If it's not The Elder Scrolls (Skyrim lately, obviously) or Civilization then I'm probably not playing it.
I do, however, keep up with the Zelda releases on console. I grew up with that franchise and it holds a special place in my heart.
I am puzzled that so many people actually like that smell enough to buy it. There are so many other scents to put in a can and spray on your body. Why is this one so popular right now? It really has an edge to it and makes your eyes water.
It's cheap and has a remarkable marketing campaign. Put those two elements together and there's little that cannot be accomplished. Including convincing young people to wear something akin to skunk scent.
Going along with your pet peeve, mine has to be people who wear too much cologne/perfume. Whether it smells good or not, there's a such thing as too much. I shouldn't have to smell someone fifty feet away.
I can't seem to edit my post, but I did want to mention one other thing:
The value can be set via the DOMAttr's constructor. Afterwards you can then directly access the value property to change it, if need be.
Example of setting value via constructor$attr = $domDoc->createAttribute ('name', 'my value');
I agree with radow here. There's nothing syntactically wrong with your rewrite conditions or rule. The HTTP 500 error you're receiving is likely because mod_rewrite is not enabled. Do you have any other configuration details in your .htaccess file that may be causing the 500 error? If not, I would change your rewrite body to this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?rt=$1 [L,QSA]
</IfModule>
If the 500 error stops occuring then you've confirmed mod_rewrite is not enabled. Either enable it in your Apache configuration or contact your host to do it for you.
You'll want to create the attributes against the DOMDocument object. This is done with the DOMDocument::createAttribute method.
$cat = $doc->createAttribute ('category');
$author = $doc->createAttribute ('author');
$cat->value = 'book';
$author->value = 'ramk';
$title1->appendChild ($cat);
$title1->appendChild ($author);
What's happening is a DOMAttr object is being instantiated for each attribute you'll utilize. You then set the value property of each attribute, as necessary, and append it to the element you want it applied to.
Assuming $main_category_p is being set to $_POST['main_category']:
The problem is:
if($main_category_p == "Choose...")
The value attribute of the OPTION is what is sent via HTTP POST. Not the actual display text you're showing the client. That's arbitrary and has no implications beyond presentation. So, given your default value is actually "Choose one", that't what you'd want to be checking for in that IF statement.
Unfortunately, HTML5 doesn't support a placeholder element for SELECT statements. So avoiding this problem entirely is not possible. What I prefer to do, however, is to give the placeholder OPTION an empty value. Then, in PHP, check for a non-empty value. If it's empty, then the user chose the placeholder.
The HTML
<select name="main_cat">
<option value="">Choose...</option>
<option value="Apparel">Apparel</option>
<option value="Home Decor">Home Deco</option>
<option value="Beauty">Beauty</option>
</select>
PHP
$selected = $_POST['main_cat'];
if ( ! empty ($selected))
echo $selected;
Break down exactly what you're doing and see if you can spot the logic problem.
if ( ! $email_p)
{
$forgot_error .= 'Error - Enter your email address';
}
else if (filter_var ($email_p, FILTER_VALIDATE_EMAIL))
{
$forgot_error .= "Invalid e-mail address";
}
Your first statement is checking to see if $email_p is not defined; if it isn't, you shoot off the error message.
The second statement is checking to see if $email_p is a valid email address (by format, anyways). If it is, you shoot off an error message.
Do you see the problem now? Your logic doesn't line up with what you're trying to accomplish.
else if ( ! filter_var ($email_p, FILTER_VALIDATE_EMAIL))
Or
else if ( FALSE === filter_var ($email_p, FILTER_VALIDATE_EMAIL))
Whichever style you prefer.