1,741 Posted Topics
![]() | |
Re: [quote] $query = "SELECT id, topic, event, date FROM events ORDER BY 'id' DESC LIMIT 5"; [/quote] Should be [code=mysql] $query = "SELECT id, topic, event, date FROM events ORDER BY id DESC LIMIT 5"; [/code] Cheers, Naveen | |
Re: [QUOTE=The Dude;536019]oops i didnt notice the extra 0 there.[/QUOTE] Dude! you noticed an extra 0 there :P Btw, Congrats ShawnCplus! | |
![]() | |
Hello, The dropdown menus doesn't work [url=http://www.daniweb.com/forums/forum44.html] here [/url] and [url=http://www.daniweb.com/forums/search.php?do=getnew&f=44] here [/url]. I tried it in FF as well as IE6. Is it possibly a bug ? | |
Re: [quote]$html = implode('', file($url_to_fetch)); // this is the code that gets the code fron that url into an array..[/quote] It won't gets the code from the url into an array. Try [code=php] $html=htmlentities(implode("",file("http://www.daniweb.com"))); [/code] $html will have the contents(javascript,css,..) of [url]www.daniweb.com[/url] as a string. | |
Re: [icode]concat(firstname,lastname) as name [/icode] More on concat [url=http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat]here[/url]. | |
Re: print out the query, execute it in mysql or phpmyadmin. I think $cps and $lps are not passed correctly OR the values of $cps and $lps doesn't return anything when you limit. | |
Re: [QUOTE=cscgal;535818]Something is in the works regarding this but those of you without access to Area 51 will have to wait and be surprised.[/QUOTE] Wow! I can't wait to be surprised :P | |
Re: [code=php] $query = "UPDATE $table SET '$io='$io2', $pp='$pp2', $sn='$sn2', $re='$re2', $sd='$sd2', $ed='$ed2', $dp='$dp2', $rn='$rn2' WHERE ID='$id'"; [/code] Look near SET '$io. An extra ' . :) Remove it! | |
Re: [code=php] $i=0; while($row=mysql_fetch_array($result)){ $photo=$row['photo']; if($i==0) { //initially, i is 0, so it inserts a new tr. echo "<tr>"; } $i++; echo "<td>$photo</td>"; //add the photo if($i==4){ //adds 4 photos, once its done, make i as 0 to insert a new <tr>, end the existing <tr>. $i=0; echo "</tr>"; } } … | |
Re: What happens is, the query ends when it encounters ' in hilgard's. Escape it with \. Eg. [code=php] 'SELECT * FROM `table3` WHERE name LIKE '%hilgard's%' [/code] To escape the single quote, you can use addslashes (or mysql_real_escape_string if your database is mysql). Or You can use double quotes. [code=php] … | |
Re: Check where include directory is. If you are executing a script in, say for example, www/site/test/1.php and you are trying to include a file eg. functions.php, which is in www/site/include folder, you should give, [inlinecode]include ("../include/functions.php"); [/inlinecode] because that's where the file is. If you give, [inlinecode]include ("include/functions.php"); [/inlinecode] it … | |
Re: And what are you supposed to do ? :) | |
Re: What's the complete error ? And what do you mean by command at server side ? | |
Re: He selects a keyword from the dropdown ? Well, then, you can simply use, [inlinecode]$query="select * from table where col like '%$value%'"; [/inlinecode] $value is the selected value of the dropdown. | |
Re: Thats because you dont have a condition in your update query. [code=php] update bridal_songs set artist='someone'; update bridal_songs set track='something'; [/code] would update all the artists with 'someone' and all the tracks with 'something'. Have some condition like, [code=php] update bridal_songs set artist='someone' where id='1'; update bridal_songs set track='something' where … | |
Re: [url]http://www.google.co.in/search?q=why+penguin+is+the+logo+of+linux&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a[/url] | |
Re: Well, You mean, based on one dropdown's value, the other dropdown should be populated ? You can use ajax to do this. If you don't have enough time to learn ajax, then the simplest solution would be to submit the page when 'onchange' event occurs in the first dropdown. [code=php] … | |
Re: As ShawnCplus has suggested, learn the basics of php programming. The basic working of Login and logout script is simple. A login script takes username and password as input, check the table if the username with that password exists. If yes, then add the username to the session and redirect … | |
Re: [code=php] <?php //connection //select db $selected_id=$_POST['select']; $query="Select * from table"; $result=mysql_query($query); $options=""; while($row=mysql_fetch_array($result)){ $name=$row['name']; $id=$row['id']; if($selected_id==$id){ $selected="selected": } else { $selected=""; } $options.="<option value='$id' $selected>$name</option>"; } ?> <html> <body> <form method="post" action="test.php"> Select something: <select name="select"> <?php echo $options; ?> </select><br /> <input type="submit" name="submit" value="submit"> </form> </body> </html> [/code] … | |
Re: Simple. Fetch all the questions from the table and print it as follows. [code=php] $query="Select question from question_table"; $result=mysql_query($query); $i=1; echo "<form method=\"post\" action=\"questionpaper.php\">"; while($row=mysql_fetch_array($result)){ $question=$row['question']; echo $i."." $question."<br />"; // to print 1. What is your name ? echo "<input type=\"text\" name=\"answer$i\" /><br />"; \\ to have unique textboxes … | |
Re: No. Do what he has said in the previous post. ie., [code=php] echo "<script type='text/javascript'>" echo "redirTimer()"; echo "</script>"; [/code] But, Change this line in your redirTimer function. This [code=javascript] self.setTimeout("self.location.href redirURL;",redirTime); [/code] To [code=javascript] self.setTimeout("self.location.href=redirURL;",redirTime); [/code] That ll solve your problem. | |
Re: Welcome to Daniweb Richie! | |
Re: [code=php] WHERE siri = '".$_POST[status_batch][$i++]."' and ".$_POST[status_batch]." = '".$_POST[status_batch]."' [/code] Wouldn't work since $_POST['status_batch'] is an array. Assign the value of $_POST['status_batch'] to a variable and pass the index . For eg, [code=php] $arr=$_POST['status_batch']; for ( $f = 0 ; $f < $fields ; $f++ ) { echo $arr[$f]; //... … | |
Re: Your code works fine on my computer. You are probably getting 'access denied' because you don't have enough privileges for the mysql user. Use [url=http://dev.mysql.com/doc/refman/5.0/en/grant.html] grant[/url] to grant permissions for the users. | |
Re: Welcome to Daniweb! :) | |
Re: Its not a good idea to store images in the database. As Ryan_vietnow has mentioned, it will add on to the server load, slows down the execution of the script and takes a lot of time to display it if you have more (say 100 images ) per page! | |
Re: [code=php] <td><img src="<?php echo $photo_name; ?>" width="30" height="30"></td>[/code] Like that ! | |
Re: [url]http://dev.mysql.com/downloads/[/url] ! :S | |
The End.