1,741 Posted Topics
Re: [code=php] if($variable) { //statements } [/code] This simply means, [i] if(true) [/i]. If a variable is set and if doesn't have values 0,false,'', it will execute corresponding statements. Example, [code=php] <?php $a = NULL; if($a) { echo "$a is true<br />"; } else { echo "$a is false<br />"; } … | |
Re: Without relevant code, it is next to impossible to know what is going wrong. | |
Re: [QUOTE=kadimi;827098]As a beginner, I suggest you use the function "require" like this: [code=php](require "includes/common.php");[/code] Yes, require has a different syntax, to avoid future problems, always surround the hole statement with parenthesis.[/QUOTE] What future problems are you talking about ? Could you explain this a bit better ? | |
Re: I haven't used tomcat, but for apache, its [url]http://localhost[/url] to access the root directory. You can find the config file httpd.conf in conf directory. | |
Re: [QUOTE=serkan sendur;825894]by the way you usually save my ass adding to my reputation points, rashakil fool needs to wait a week to deduce your one contribution.[/QUOTE] Stop calling him Rashakil fool, maybe he will stop the 'war of words' too! ;) | |
Re: What is the error ? I am still confused about what you want and what is the problem. Do you mean something like this ? [code=php] <?php if(isset($_POST['submit'])) { $total = $_POST['field1']+$_POST['field2']+$_POST['field3']+$_POST['field4']; if($total % 4 == 0) { echo "$total Divisible by 4.."; } else { echo "$total Not divisible … | |
Re: Try[icode] or die(mysql_error()); [/icode] instead of your custom message. This will let you know what exactly is the error. | |
Re: [code=php] <?php $reg = '/<h2>(.*)<\/h2>/s'; $fulltext="<h1>Welcome</h1> <h2>Welcome to this website</h2> <p>Some text here. </p>"; preg_match($reg,$fulltext,$matches); print $matches[1]; ?> [/code] This will do. | |
Re: Yeah! Use ad block plus (firefox addon) and block all the unwanted scripts/frames/images/ads/whatever! Life has been good since I started using ABP. :cool: | |
Re: if($_POST['list1']=='m2' && $_POST['list2']=='m3') { //show from table1 } elseif($_POST['list1']=='m3' && $_POST['list2']=='m2') { //show from table1 } else { //some other option was selected } Unless you have some logic to know what to do on selection of particular option, you have to build your script with alot of if's and … | |
Re: [QUOTE=stevehart808;826118]Maybe it got to do with [code] $date = $date15_year.'-'.$date15_month.' '.$date15_date; [/code][/QUOTE] No. That is just fine. Use print_r($_POST); to see what is getting posted and what is not. | |
Re: @vinothkumarc, The OP fixed the problem himself using the function number_format. :) | |
Re: [code=php] <?php /** *.Hack Name: Shop Hack * Version: 3.0 Beta2 * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, … | |
Re: The simplest way to validate username and password is to query the table with both username and password and see how many rows it returns. For example, [code=php] $query = "select * from table where username='$username' and password='$password'"; $result = mysql_query($query); if(mysql_num_rows($result) == 1) { //echo valid user } else … | |
Re: Most of the time (like 99% of the time), people tend to forget how important it is to sanitize the user's input. Using mysql_real_escape_string will prevent sql injections by escaping [b]'[/b] and [b]/[/b]. | |
Re: The simplest answer to your question is, No. Its not possible to disable 'back' button of the browser. As far your question is concerned, When the user logs in, you can set a session variable, say,[icode] $_SESSION['validuser'] = true; [/icode] And on every page, check if $_SESSION['validuser'] is true. If … | |
Re: [code=php] <input type='text' name='name' value=<?php echo $_REQUEST['name']; ?>> [/code] When the submit button is pressed and if the captcha is wrong, it will still show the posted values. | |
Re: Are you sure your query returns ASP developer/WEB developer/PHP when you use [icode]LIKE '%PHP developer%'[/icode] :S This, infact should return only "PHP developer". | |
Re: My first post was in [url=http://daniweb.com/forums/thread98890.html] Community Introduction forum. [/url] :) | |
Re: Pretty simple. Check this example. [code=php] <?php if(isset($_POST['submit'])) { $string = nl2br($_POST['textarea']); echo $string."<br />"; echo substr_count($string, "<br />"); } ?> <html> <body> <form method='POST'> <textarea rows="30" cols="30" name='textarea'> </textarea> <input type="submit" name="submit" value="submit"> </form> </body> </html> [/code] I am using nl2br function to convert newline to <br />. Then … | |
Re: > Before i propose any other solutions, did you try removing the `<b></b>` tags from this line: `<input type="checkbox" name="chkRecipeBook" id="chkRecipeBook" onclick="javascript<b></b>:disableAddressBook();" />` ? mschroeder, That is a bug with code-tags. I have even posted a thread for the same (`<b></b>`) [here](http://www.daniweb.com/forums/thread178010.html). | |
Re: > Hi > > I seem to be getting this error on the reply section of my forum. I've never had this problem before and have tried google but found nothing. So, now i turn to daniweb, surly someone must be able to help me here. > > **This is … | |
Re: Without submitting the page, You can't get the selected option's value in php. However, in Javascript, you can access it. | |
Re: Use [icode] error_reporting(E_ALL ^ E_NOTICE); [/icode] on top of your script (after session_start). | |
Re: [quote]the submenu just stays out...[/quote] I tried your code and it works perfectly ! The only thing I changed was, [code=javascript]<script language="Javascript" type="text/javascript">[/code] which earlier was, [code=javascript] <script language="Javascript" type="javascript/text"> [/code] I haven't seen anyone using javascript/text :-/ | |
Re: Instead of having separate names for checkbox, use checkbox array and assign different values to it. When you click on the submit button, only those checkboxes which were checked would be posted. You can then use a foreach loop to get what was checked. [code=php] print_r($_POST['checkboxname']) //will print the array … | |
Re: [QUOTE=cdeniz;821610]i have a code like this [CODE]select * from tableX group by fieldA order by fieldB[/CODE] this code sort according to fieldA. but i need to sort according to fieldB. please help me ??[/QUOTE] You should have started a new thread. But anyway, Your query is fine and it [B]should … | |
Re: Instead of creating a comma separated string, why don't you use foreach loop ? You can get the key as well as the value. Use the 'key' as variable name! | |
Re: [quote] Now I need to check whether the user must enter minimum 6 letters in the box. [/quote] Use [url=http://www.tizag.com/javascriptT/javascript-string-length.php] length [/url]. [code=javascript] if(form.username.length < 6) { alert('Username less than 6 characters..'); } [/code] Btw, I don't understand your code. What will with [icode] (contact) { [/icode] will do ? | |
Re: The way you are doing it is wrong. Try this. [code=php] $qa = mysql_query("SELECT DATE(DATE_SUB(now() , INTERVAL 31 DAY)) as actual_date"); while ($row = mysql_fetch_array($qa)) { $a = $row[actual_date]; } $qb = mysql_query("SELECT CURDATE();"); while ($row = mysql_fetch_array($qb)) { $b = $row[0]; } mysql_query("SELECT * from $vtable WHERE (trxdate >= … | |
Re: [code=html] <html> <head> <script type="text/javascript"> function validateCB(loctext) { if(document.rec.loc.value=='') { loctext.innerHTML = "please select one option"; return false; } else return true; } function validatePID(inputfield, helptext) { if(inputfield.value.length !=9){ if(helptext != null) helptext.innerHTML = "please enter excatly 9 digits"; return false; } else { if(helptext != null) helptext.innerHTML = ""; … | |
Re: What if 2 people (authors) have the same name ? :S Its never a good thing to query the table on fields like name. But anyway, you can do it this way (but I don't recommend it :) ) [code=php] $query = "select * from authors where name='".$author."'"; $result = … | |
Re: Here are my 2 cents. You can disable those notices by using [icode]error_reporting(E_ALL ^ E_NOTICE);[/icode] on top of your script. If you don't want to disable it but still want to fix the notices, initialize a variable to 0 (or null if its a string). ie., $i = 0; $string … | |
Re: Edit your post. Use [code] tags to wrap your code for better readability (and better response). | |
Re: In the script (the url), check if the user is a unique user (by checking his IP address). If he is a unique user, update count. :-/ You can't call a javascript event (onclick) to update the table. You can try the same with Ajax though. ie., Onclick, call the … | |
Re: @Kevin wood, Your script seems fine. Try this. [code=php] $query = "SELECT email FROM emails"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)) { $emailaddress[] = $row['email']; } // Contacts //$replyName = $merc_replyId; //$replyEmail = $merc_replyAddress; $i=0; foreach($emailaddress as $contactemail) { $replyName = "PiPonliine"; $replyEmail = "info@piponline.info"; $contactname = ""; … | |
Re: [quote]My idea is also that , if we learn technology contribute it to , and even use it only for the good things ( not like to build mass killing machines ) only , then why the ppl hates a good person just for he is still single ?[/quote] Are … | |
Re: [QUOTE=rohnni;819543]hii i m designing a php event based calendar this is my code, can anyone tell me its script code,mine is not working.. <!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=iso-8859-1" /> <title>Untitled Document</title> <link href="style/style.css" rel="stylesheet" type="text/css" /> </head> <body> <?php // … | |
Re: You cannot access $_POST['startdate'] in action2.php . Its only available in action.php since it is posted from form.php to action.php . In order to make it available in action2.php (which is a hyperlink), you have to pass it in the query string like this. [code=php] echo "<a href=action2.php?startdate=".$_POST['startdate'].">Click here to … | |
Re: If you use die function and if an error occurs and prints the die message, then its pretty obvious where exactly the error has occurred ! For runtime errors, php parser will only let you know where the error has occurred if you have error_reporting turned on. | |
Re: Someone posted a question in mysql forum which almost resembles this one! [url]http://www.daniweb.com/forums/thread179456.html[/url] Modify those queries and it should work for you! | |
Re: [QUOTE=RamyMahrous;811001]I prefer for each forum a man of forum each month, that's would be good idea[/QUOTE] I don't think that is a good idea! It would be a herculean task for the committee to find one person in every community every month (not that there aren't enough people, but there … | |
Re: Apart from that, If you are sure that the 'input' is an integer, you can validate it using [url=http://in.php.net/manual/en/function.is-numeric.php] is_numeric [/url]. | |
Re: [b]*Repeats* [/b] Its not the 'invisible character' in your script that is causing this error. Its the permissions. Change the permission of the folder php-ses and tmp to 0766. Ie., Read, write and execute to the owner Read, write to groups and others. :) It will fix the problem. If … | |
Re: [url]http://in2.php.net/manual/en/ref.mysql.php[/url] Most of the functions which interacts with the database can have this $link_identifier as an optional parameter. | |
Re: [quote]But im just wondering if I can do the same thing using headers header("Location: index.php?variable=1")[/quote] Yes you can. Then you can acess the 'variable' in index.php just like how you do it using $_GET['variable']. | |
Hello everyone! I am not sure if someone has already reported this bug, but here it is. An example: [code=javascript] <form method='post' onsubmit='javascript: validateform(this);'> [/code] When you click on "Toggle Plain Text", you can see < b >< /b > getting appended to javascript ! :-/ Some more example threads. … | |
Re: Php is very easy to learn. You can start by going through these pages. [url]http://www.w3schools.com/php/php_intro.asp[/url] You can also find how php and mysql interacts on this link. [url]http://www.w3schools.com/php/php_mysql_intro.asp[/url] One suggestion. Saving images in the database is not a good idea. You can save the image on the server and save … |
The End.