1,741 Posted Topics
Re: Here is an example. [code] <html> <body> <ul> <?php for($i=65;$i<=90;$i++) { echo "<li><a href='char.php?alpha=".chr($i)."'>".chr($i)."</a></li>"; } ?> </ul> </body> </html> <?php if(isset($_REQUEST['alpha'])) { $alphabet = $_REQUEST['alpha']; echo "You selected alphabet: ".$alphabet; /* * Then you can query the table for fonts starting from the selected alphabet like * $query = "select … | |
Re: Technically, it doesn't matter if you have only 1 line statement after a condition. ie., [code] <?php $x = 1; if($x == 1) echo "$x is valid."; else echo "$x is invalid"; ?> [/code] This will not work if you have more than 2 statements in your condition. Btw, its … | |
Re: [quote] Do not post homework problems expecting a quick answer without showing any effort yourself. [/quote] Seems like you didn't read the [url=http://www.daniweb.com/forums/faq.php?faq=daniweb_policies]member rules.[/url] Ch, ch. Read more on count and group by clauses. After reading them, you will be able to solve this query yourself. :) Good luck. | |
Re: Very simple. [code] <html> <head> <script type="text/javascript"> function checkCheckbox() { var countselection = 0; var maximumselection = 2; var ch = document.getElementsByName('choice'); for(i=0;i< ch.length;i++) { if (ch[i].checked) { countselection++; } } for(i=0; i < ch.length;i++) { if (!ch[i].checked) { if(countselection == maximumselection) { ch[i].disabled=true; } else { ch[i].disabled=false; } } … | |
Re: I didn't go through so many functions in your script, but it works. You are supposed to select the options from the 2nd list before submitting. Unless you select them, they are not selected by default. | |
Re: ob_start, as it indicates, will start output buffering. If you are using ob_start, then you should also use ob_end_flush, ie., flushing the output buffer. I have used ob_start at places when I had already echo-ed something [which was unavoidable at that time] before starting the session or calling the header … | |
Re: Not only echo, you will get this warning if you have session_start along with header function. Use [code] ob_start(); [/code] as the first line of your script to turn on output buffering and [code]ob_end_flush(); [/code] as the last line to flush the output to the buffer. | |
![]() | Re: [QUOTE=leviathan185;1050970]you could also make a function out of it [CODE=php] <?php function arrayToString($array) { $string = ''; foreach($array as $value) { $string .= "{$string}, {$value} "; } return $string; } echo arrayToString($_POST['Prefered_Engineers']); ?> [/CODE][/QUOTE] Or simply, [code]$string = implode(",",$_POST['Prefered_Engineers']); [/code] ![]() |
Re: To get a new line, you should add a <br /> to your echo. ie., [code] <?php echo $abbr['US']['MI']."<br />"; ?> //or simply <?php echo $abbr['US']['MI']; echo "<br />"; ?> [/code] [quote] Also, can you use the php include function in arrays like I used the HTML image function in … | |
Re: :) You forgot the column name as the 2nd parameter for mysql_result. [url]http://php.net/manual/en/function.mysql-result.php[/url] | |
Re: :( No. I pay around Rs. 1200 (approx $26) for my 512kbps connection. Its around Rs. 3000 for 1 mbps (that is approx $65). | |
Re: You are supposed to put mysql_fetch_array in a while loop. [code] while( $data2 = mysql_fetch_array($query)) { echo $data2['firstname']; echo $data2['lastname']; echo $data2['task']; } [/code] | |
Re: Wow! This thread is unbelievable and you guys are mind blowing! :P | |
Re: I don't recommend using mysql_fetch_row though. This will return an array with numeric indices and the script will fail if you add a new column to your table. I personally prefer using mysql_fetch_assoc . You can also use [icode] mysql_fetch_array($result,mysql_assoc) [/icode] to get the records based on its associative names. | |
Re: [QUOTE=network18;1049921] also do we need to use the exit() below it?Will it ever get executed when already redirected to the header-location page?No it will get its turn to execute.[/QUOTE] The exit function is used as a safety measure just in case the end user gets to echo something before header … | |
Re: There are still some typos. $GET_['formfield'] instead of $_GET['formfield']. One simple suggestion though. You don't need a switch/if-elseif-else condition to find out the day. A simple array will do it. This is what I am talking about. [code=php] <?php //nodag = Norwegian day //endag = English Day // dag = … | |
Re: [QUOTE=cwarn23;1049867]Looks like a bunch of ones and zeros with a few letters to me.[/QUOTE] No, see the 3rd image. From the website: [quote] This is an animation of the clock that shows in "fast forward" how it in twelve hours goes around. [/quote] Quite an effort ! | |
Re: Do as above. But, If you are a novice user and you find it hard to use ajax, then you can do the traditional way. Submit the form having an onchange event on all the dropdowns. When you select, say milk, from the first dropdown, submit the form, so $_REQUEST['firstdropdown'] … | |
Re: I hope this is what you are looking for. [url]http://www.i-marco.nl/weblog/archive/2007/06/14/variable_variables_in_javascri[/url] | |
Re: Have onsubmit event for form. Here is ane example. [code] <?php if(isset($_REQUEST['submit'])) { print "<pre>"; print_r($_REQUEST); print "</pre>"; } ?> <html> <head> <script type='text/javascript'> function validate(form) { if(form.name.value == "") { alert("Name cannot be empty"); return false; } return true; } </script> </head> <body> <form method='post' onSubmit='javascript: return validate(this);'> Name: … | |
Re: [QUOTE=leviathan185;1044621]It could be that you are using single quotes around the values that are meant to be integers, the single quotes are converting them to strings. [/QUOTE] You are almost right. Since its a function, there is no need for single quotes for mysql_insert_id. Secondly, Even integers can have single … | |
Re: Hi, If I understand your question right, this should do the trick. [code] select * from customers c, cust_packages cp where c.cust_custnr = cp.cpack_usernr group by cpack_usernr having count( * ) =1 and cpack_canceldate != '0000-00-00' [/code] This will select all the customers with only 1 record in table cust_packages … | |
Re: One suggestion. When you are inserting a record to the table, you don't have to insert 'NULL' if its an auto increment field. Mysql will do it for you. Ie., [code] $orange_insert = "INSERT INTO orange (orange_name, orange_add) VALUES ('$val_name', '$val_add')"; [/code] Secondly, the 'error' you are getting is not … | |
Re: How about a tutorial on pagination (this question has been asked n number of times) , carts, htaccess, image handling, regular expressions, ... | |
Re: Hi, can you elaborate your question ? If you are inserting the value to the table from php, you can use [url=http://php.net/manual/en/function.substr.php] substr [/url] to insert only a part of a string. If you are directly inserting the record to the table, you can use mysql's [url=http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_substr] substring [/url] function. … | |
Re: Hi, I am not sure how you are validating what mysql returns. In php, when you query the table, for example, [code] //query the table with username and password $query = "select * from table where username='test' and password='test'"; //execute the query and save the resource in $result. $result = … | |
Re: [url]http://www.tizag.com/mysqlTutorial/mysqlfetcharray.php[/url] You should use the array returned by mysql_fetch_array and not the result resource itself. ie., $row['content'], $row['name'] etc and not $result['title'] ! | |
Re: If the kid's behaviour is like Dennis (the menace), then he should be punished. And when i say "he should be punished", i dont mean physical abuse. Physical abuse is bad. And hey, fiery look and a lil yelling can be useful sometimes ! :D | |
Re: [QUOTE=trahrey;1023430]i looked at your message you didn't show me any direction[/QUOTE] Okay! Here is the direction. From this point [b]>> * <<[/b] Go straight up and stop when you see the text "Software Development". Since you have already traveled this far, you might be tired and maybe you need a … | |
Re: As I mentioned in another thread, have another variable array in the for loop, say, $cost_array. Assign the same value to it. Then do array_sum($cost_array). That will give you the sum of $cost. | |
Re: Sorry ! What does this code snippet do btw ? | |
Re: [QUOTE=sumain;863988]Hi All, Hope all are fine. I need some help, that is i want to show email address after provides the username and password. it will happen in my personal site.[/QUOTE] :) You should have started a new thread and mentioned your problem in detail (providing relative code). But anyway, … ![]() | |
Re: or [url=http://www.wampserver.com/en/download.php]wamp [/url] :) | |
Re: :icon_rolleyes: Can't wait to see that golden shiny star ? eh ? Edit: Oh wait, You just got it! | |
Hi all, I have a suggestion (not sure if it has already been discussed). In the profile, at the community tab, we have, for example, [quote] Code Snippets: 10 [/quote] If this number [i]10[/i] is made a href linking to all the code snippets posted by that particular user, it … | |
Re: [QUOTE=crunchie;1005998] EDIT. That's weird. Now I have zero negative :-O[/QUOTE] Its fine! I changed it to +1 when I saw your comment :D [QUOTE=crunchie;1005979]Not sure if I like it. I got 3 negative votes for posts where I posted help :([/QUOTE] (and those 3 posts didn't deserve a negative vote!) | |
Re: Hmm.. Right.. [url=http://www.daniweb.com/newsletter/] This[/url] link is missing! | |
Re: You are almost there! I have modified your code, very small changes. [code=php] <?php if(isset($_POST['submit'])) { for($i=1;$i<=$_POST['count'];$i++) { $textfieldname = "marquee_".$i; print $_POST[$textfieldname]; print "<br />"; } } ?> <html> <head> <script language="javascript" type="text/javascript"> function addField() { var tbody = document.getElementById("tblBody"); var ctr = tbody.getElementsByTagName("input").length + 1; var input; if … | |
Re: Notices are not errors. If you try to use a variable without initializing it, you will get a notice. To disable notices, edit your php.ini and set error_reporting as, [quote] error_reporting = E_ALL & ~E_NOTICE [/quote] This will show all the errors except notices. But, if you want fix these … | |
Re: [url]http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html[/url] Check for [i] foreign key constraints, primary key, foreign key [/i] in google. [quote] From the above link: InnoDB rejects any INSERT or UPDATE operation that attempts to create a foreign key value in a child table if there is no a matching candidate key value in the parent … | |
Re: [quote] I want to fill that third column(duration) when I insert the values to the first 2 columns.. [/quote] Why don't you calculate the difference between starttime and endtime and insert the difference while inserting values to the first 2 columns ? I haven't used triggers myself, but I think … | |
:icon_eek: Strange things have been happening lately. 1. Visited threads are still marked as unread ? 2. Even though I made the last post in [url=http://www.daniweb.com/forums/thread228062.html] this [/url] thread, [url=http://www.daniweb.com/forums/forum17.html] php forum [/url] doesn't say so. I have attached the screenshots of the forum and the thread. One more bug. … | |
Re: Also, try sending a simple mail to see if it works. [code=php] <?php mail("[email protected]","test","test mail ! Hope it works","from: [email protected]"); ?> [/code] If it does, then its obvious that you missed out something in your other script. | |
Re: I have used zend studio, aptana, php Designer, eclipse, netbeans, maguma studio, dev php, editplus, etc. Among all these, I liked zend studio 5.5 more. The later versions, 6 and 7 had a lot of bugs when I last used it (like irregular brace mismatching, delayed code suggest (in ver7), … | |
Re: Try this. [code=php] $query = "select * from table where Concat( column1, ' ', column2 ) LIKE '%".$search."%'"; [/code] This will return all the rows from the table where column1 concatenated with column2 matches $search. eg. [code=php] SELECT * FROM master_table WHERE Concat( firstname, ' ', lastname ) LIKE '%alli … | |
Re: [QUOTE=SKANK!!!!!;1003629]how do i select a row in a table columns i dont know the name of(and find the name of it)? but i know the cell/field of the column has a value of "55" i also have to EXCLUDE ONE COLUMN that i know the name of. does anyone know … | |
Re: Instead of storing the password just like a normal string, save it as an encrypted string, using SHA1 or something. This will provide you more security as well as solves your issue. Here is an example to clarify any further doubt. [code=php] <?php echo SHA1("ABC"); echo "<br />"; echo SHA1("abc"); … |
The End.