1,741 Posted Topics
Re: No. It doesn't work that way with torrents. Btw, Its a taboo subject to discuss it here. :) | |
Re: $result will have a result resource. You need a loop to get all the result. mysql_fetch_array() will fetch only 1 record at a time. [code=php] while($row = mysql_fetch_array($result,MYSQL_NUM)) { print "<pre>"; print_r($row); print "</pre>"; } [/code] | |
Re: Nothing wrong with the script. Umm.. Check if it enters the loop, [icode]If (isset($_POST['submit'])) { [/icode]. Try mysql_error to know what exactly is the error message. ie., [code=php] $sql = mysql_query("INSERT INTO accesscarduse (SchoolName, SchoolEmail, UserName, pscode) VALUES ('$SchoolName', '$SchoolEmail', '$UserName', '$pscode')") or die (mysql_error()); [/code] Also check if error … | |
Re: Nice queries.. But still, that wouldn't solve what OP is looking for.. The still doesn't return the count as 0, if a user doesn't have any posts. I created dummy tables to create the same scenario and I am also clueless ! :S | |
Re: You need to mention http:// in your hyperlinks. See this for example. [code=php] <?php echo "<a href='www.google.com'>Click here </a><br />"; echo "<a href='http://www.google.com'>Click here too</a>"; ?> [/code] | |
Re: Yeah, possible. Have a hidden field in the form to store the id. When the user clicks submit, update the table :) [code=mysql] update table set orderno='".$_POST['orderno']."' where id='".$_POST['id']."'"; [/code] | |
Re: I guess, you don't have enough permissions on tmp directory. Give all the permissions to tmp directory and try again. When you use session_start, it will create a cookie if this option [i]session.use_cookies[/i] is turned on. | |
Re: What does your query do ? Query the table 'photos' and for every photo, You are again querying the table 'ratings' if that photo's fbid has a count > 150 ? I didn't get the question or what you actually want. Do these 2 tables have any common 'linking' field … | |
Re: Use [icode]$action == 'preview' [/icode] and [icode]$action=='submit' [/icode]. Also, mention Form's 'method'. If you don't mention it, I guess, the default method is GET. | |
Re: Simply use double quotes. ie., [icode]$num="0024";[/icode] Adding 0 before a number forces php to consider this as a octal number. [url]http://us3.php.net/int[/url] | |
Re: @cwarn23, mail function works fine in if condition. The mail function returns true on success and false on failure. It works just like, [icode]if(empty($var)) { [/icode] @OP, check your spam folder. On many occasions, mails sent using php function lands up in spam folder! | |
Re: [icode]select * from database [/icode] would work just fine since you want all the records without satisfying any condition :) Btw, 'for' and 'type' are mysql reserve keywords and requires ` to be wrapped around it. like, `for`, `type`. | |
Re: print "<pre>"; print_r($_POST['checkbox_element_name']; print "</pre>"; Does it print anything ? There is nothing wrong in your code except the checkbox name may be wrong :) Edit: And a thumbs up for using [code] tags in your first post You should close the tag correctly next time. :) | |
Re: Btw, Java is totally different from Javascript. :) | |
Re: Hi there! The issue is with innerHTML! Check this link.. [url]http://www.developer-x.com/content/innerhtml/[/url] | |
Re: [url]http://www.daniweb.com/forums/thread177977.html[/url] Multiple threads for the same problem ? Not good. | |
Re: [url=http://www.w3schools.com/htmldom/prop_text_readonly.asp] readOnly . [/url] | |
Re: [quote]In the table there is no value of c and hence nothing is returned What is the value of $b?[/quote] $b will still hold a result resource. Check [i]Return values[/i] here.. [url]http://in.php.net/function.mysql-query[/url] | |
Re: password column is of datatype varchar (I think). Try this. [code=php] $q="UPDATE login SET password='".SHA1('$newPassword')."' WHERE id='$loginID' AND password='".SHA1('$oldPassword')."'"; [/code] | |
Re: FYI, Notice is not an error and can be turned off with different [url=http://in.php.net/manual/en/function.error-reporting.php]Error reporting [/url] values.. Edit: It is kind of an error, but can be ignored. (Doh!) | |
Re: [code=php] $q="SELECT id FROM login WHERE username='$username'"; $sql=mysql_query($q); if (@mysql_num_rows($sql)==1) { $arr=mysql_fetch_array($sql); $id=$arr["id"]; } [/code] :-/ | |
Re: [code=mysql]select count(*) as total from user group by jobs[/code] ----------------------------- Total ------ Jobs ----------------------------- 10 ------> Unemployed 20 ------> Employed Cheers! | |
Re: You can have a field in your table to store the total questions answered by the user in bit format. For example, if there are 10 questions and the user has answered 4 of it, save, 1111000000 to the table. Then, when the user logs in next time, show only … | |
Re: [code=php] <?php //install2.php if(isset($_GET['unlink']) && $_GET['unlink']=="true") { unlink("install.php"); unlink("install2.php"); header("location: success.php"); } //rest of the code here echo "<a href='install2.php?unlink=true'>Click here to remove the installation files ! </a>"; ?> [/code] Works on local machine. I haven't tested it on server! If you want to do the same with a button, … | |
Re: In your dblayer.php, echo [url=http://in2.php.net/getcwd]current working directory[/url]. Depending on which directory you are in, you can use [b]../[/b] to go back one step to previous directory, [b]../../[/b] to go back 2 steps and so on.. ie., If the file is in public_html/common/dblayer.php , using [b]../[/b] will take you to the … | |
Re: Do you get any error ? And, you don't have session_start(); in this script :-/ | |
Re: You are doing it wrong.. [icode]$result = mysql_query($query);[/icode] This will execute the query and return the result resource. You have to then use mysql_fetch_array (mysql_fetch_row/mysql_fetch_assoc/mysql_fetch_object) ! Read it here.. [url]http://in.php.net/function.mysql-query[/url] [code=php] $query = "SELECT * FROM item WHERE item_id = '1'"; $result = mysql_query($query); $row = mysql_fetch_array($result); //if it returns … | |
Re: When adding the data to the table, use [url=http://in.php.net/nl2br]nl2br[/url] function (if you are using php). | |
Re: 1. Yes. Since you know where you will be uploading the file, you can save the foldername as albumname 2. By using multiple [icode]<input type='file' >[/icode] tag I am not sure if the examples in these links work, but, this is how you do it. [url]http://www.phpeasystep.com/workshopview.php?id=2[/url] [url]http://www.plus2net.com/php_tutorial/php_multi_file_upload.php[/url] | |
Re: [code=php] <?php $con = mysql_connect("localhost","root"); mysql_select_db("test"); $q = "select * from table1"; $result = mysql_query($q); $i=0; while($row = mysql_fetch_array($result)) { $result_set[$i] = $row; $i++; } for($i=0;$i<count($result_set);$i++) { print "<pre>"; if($next_element < count($result_set)-1) { $next_element = $i+1; print "Next element in the array is: <br><br>"; print_r($result_set[$next_element]); } print "Now the array … | |
Re: [url]http://www.mssqlcity.com/FAQ/General/char_vs_varchar.htm[/url] Summary: If you specify column's datatype as char(20) and you enter a value, say, "test", mysql still uses 20 bytes.. But if the column's datatype is varchar, and you enter "test", it uses only 4 bytes.. The best place to use char is when you are 100% sure that … | |
Re: No it wont! cwarn23 is appending a "|" after every error message. So, if there are 2 errors, the query string would look like, [quote] Name is a required field please complete and submit it again.| Please fill in a correct email address| [/quote] I personally don't prefer doing it … | |
Re: Did you check the source ? [icode] $string = "<div id=\"$class\"> $words </div>"; [/icode] I just had everything in one script and it works fine. (Oh, I also replaced . with # of your css. [code=php] <?php function pop_boxes($words, $class) { $string = "<div id=\"$class\"> $words </div>"; print($string); } ?> … | |
Re: You can do this in php itself ! Why do you want to rely on javascript ? | |
Re: Answer is Yes to both the questions. [code=php] <html> <body> <form name='test' method='post'> <input type='text' id='name' name='name'> <input type='text' id='age' name='age'> </form> <?php $value = 1; if($value == 1) { echo "<script>document.getElementById('age').focus();</script>"; echo "<script>document.getElementById('name').disabled=true;</script></script>"; } ?> </body> </html> [/code] | |
Re: [quote]and another issue: include("$path/...") ===> you are giving dynamically path to your pages, this is not secure. don't do that.[/quote] Could you please explain why ? | |
Re: Do you mean this ? [url]http://www.daniweb.com/code/snippet130.html[/url] | |
Re: [quote] if($filename!="NULL" || $filename!="FALSE" || $filename!="") [/quote] This must be [quote] if($filename!=NULL && $filename!=FALSE && $filename!="") [/quote] In your example, you are checking if variable filename value is NULL or FALSE (which is wrong). And, you should use logical operator "and" instead of "or". | |
Re: Are you sure it doesn't work ? I downloaded the script and it works just fine! See the attached screenshot.. | |
Re: 2 errors. 1st one is on line 30. $message = $_POST('$SchoolName',.... 2nd error, there is no ; after mail function. Please check [url=http://in.php.net/manual/en/function.mail.php] this [/url] for the correct syntax of mail function! Edit: Also, this [quote] echo "Form not properly completed") [/quote] is not terminated by a semicolon and there … | |
Re: Well, thats because only the last value is stored in variable $val because of the while loop. You can 1. Put value of $row["name"]; to an array and iterate through that array in your select tag or 2. Use <option> tag in your while. | |
Re: [code=mysql] update journey j, passengers p, shuttle s set j.occupancy=j.occupancy - 1 where p.journey_id = j.id and s.id = j.shuttle_id and s.id = 1 and p.passenger_name='bill gates' [/code] wouldn't this work ? Many people at my workplace avoid joins (they say its comparatively slower than normal queries). | |
Re: Check mysql function [url=http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_substring-index]substring_index [/url] Eg. [code=mysql] SELECT SUBSTRING_INDEX(columnname, "\n", 10 ) FROM table [/code] | |
Re: foreach($array as $value) simply means, for every element in the array, assign its value to $value. foreach($array as $key => $value) assigns the index of the array to $key and value of that index to $value. :S I hope I am not confusing you! This is almost similar to for … | |
| |
Re: [quote] i want to remove all word from that string if that string have minimal three word'x'[/quote] I am not clear what you want. Do you want to search for xxx, if found, remove it ? | |
Re: While fetching, use str_replace to replace "<br />" with "". ie., [code=php] str_replace("<br />", "", $data); [/code] ![]() |
The End.