- Strength to Increase Rep
- +6
- Strength to Decrease Rep
- -1
- Upvotes Received
- 34
- Posts with Upvotes
- 31
- Upvoting Members
- 25
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Re: I have the same requirement so I wrote a few lines that would demonstrate the answer to your question and give me a base to work from. <?php if (isset($_POST['submitted'])){ print_r($_POST); } ?> <html> <head> <script type="text/javascript"> function addTextArea(){ var div = document.getElementById('div_quotes'); div.innerHTML += "<textarea name='new_quote[]' />"; div.innerHTML += … | |
Re: I think you are confusing two file system types; localhost is for the browser address bar and relates to hostnames, but the script needs the system path. If 'install.php' is in the same directory, then you can try `'./install.php'` (./ is shorthand for this directory). You need to give the … | |
Re: @ricardojorge register.php line 35: `$r = mysql_query($q);` add some error checking: `if(!$r = mysql_query($q)) die(mysql_error());` do you get an error message? @lastmitch I agree with you, but I fancied the challenge and was already looking :) | |
Re: I copied your code into my own page and ran it and got a result with FF, IE and Chrome: object(SimpleXMLElement)#1 (1) { [0]=> string(5) "52.82" } Strange... | |
Hello :D I am using the twitter API to perform a search for a certain author, and storing the results in a database so that I can perfrom an action on each entry. However, there are many duplicate results that have small differences at the beginning of the string or … | |
Hello :) I'm working with a database of postcodes. I have an existsing query that returns the postcodes within a certain radius: `select *, acos(cos(51.496502411798 * (PI()/180)) *cos(-0.13982862499836 * (PI()/180)) *cos(lat * (PI()/180)) *cos(lng * (PI()/180))+cos(51.496502411798 * (PI()/180)) *sin(-0.13982862499836 * (PI()/180)) *cos(lat * (PI()/180)) *sin(lng * (PI()/180))+sin(51.496502411798 * (PI()/180)) *sin(lat … | |
Re: Hey GraficRegret, welcome to Daniweb :) Your description sounds like a typical use of PHP and MySql, but what help do you specifically need? Is there some code you need some assistance with? Are you looking for general considerations and tips from those who already walked that road? | |
Re: There are probably better ways, but I would make a temporary database with mysql and store them in there for easier manipulation. I would write a script to insert a few hundred at a time, and add the records gradually to avoid PHP execution limit, with an echo for every … | |
Re: I see the problem: `function validateForm(Qform)` expects a parameter passed with the function call, but you pass nothing: `onSubmit="validateForm();` change it to: `onSubmit="validateForm(this); return false;"` and it should work okay. | |
Re: Your database section looks a little mamlformed, specifically this line: `while ($query !=-1 && $row = mysql_fetch_assoc($query)) {` I would guess that the previous line: `$values = mysql_fetch_assoc($query);` already collected the necessary information, so if this line: `echo print_r($values, true);` prints the correct information, I would try changing your code … | |
Re: Line 32: `$sql="INSERT INTO tbl_candidate(email_id) VALUES('$email_id1');` has a missing quote before the semi-colon. Line 39: `else{` is missing the preceding curly brace. Fix those, see what happens. | |
Re: `if(isset($_POST['id']) && ($row['bankID'] == $_POST['id']))` or, `if(isset($row['bankID']) && ($row['bankID'] == $_POST['id']))` depending which key is not set. It's good that you have all errors showing. | |
Re: This hurts me more than it hurts you, but... [Let me google that for you!](http://lmgtfy.com/?q=what+is+json%3F) | |
Re: Welcome to Daniweb **albertsibanda9** :) The long answer: [Read This Before Posting A *second* Question](http://www.daniweb.com/web-development/php/threads/435023/read-this-before-posting-a-question) The short answer: Post your code before LastMitch gets hold of you :D | |
Re: check for result if($result = mysql_query("SELECT * FROM table")){ while ($row = mysql_fetch_array($result)){ // don't echo immediately, store in $string $string .= '["' .$row[1]. '",' .$row[2].'],'; } // now $string has an extra comma... $string = substr($string, 0, -1); } use [substr()](http://uk3.php.net/manual/en/function.substr.php) to select all but last character, then echo … | |
Re: > but i want to show the error in such a way that name of the tables couldn't be shown... Is that all? `$query = mysql_query("DELETE FROM table_2 WHERE tchr_id='".$id."'") or die("Oops, we have a problem, please contact the administrator.");` Change message to suit. | |
Re: `$alert_error = "<script type=\"text/javascript\"> alert('".mysql_error()."') </script>";` In the above line you are referencing `'mysql_error()'`, but it doesn't exist yet because you did not run the query that produces the error. Also, you wanted Javascript to alert the value of `'mysql_error()'`: if (!$query = mysql_query("DELETE FROM abc WHERE id ='$id'")){ echo … | |
Re: This is simple maths, use parentheses to force calculations in correct order: `field3 minus (field1 divided by field2)` $result = ( $row['field3'] - ($row['field1'] / $row['field2']) ); echo "<td>".$result."</td>"; | |
Re: There are probably better ways, but If I had to achieve it with existing knowledge, I would do something like this: $wordString = $_POST['search']; /* first test there are comma separated values */ if (strpos($wordString, ",")){ /* split string into array of strings on the comma */ $words = explode(",", … | |
Re: @kevinp2012 seriously, are you asking the OP to improve **his** English? @dodgers125 I'm not *sure* what you want but maybe I can give some pointers about your code: <!-- header row, the 1 must be in quotes: border="1"--> <table border="1"> <tr><th>Sale Number</th> <th>Item</th> <th>Item Cost</th> <th>Units Sold</th> <th>Sale Cost</th> </tr> … | |
Re: Using javascript: <head> <!-- You must have the id set in the next line --> <link id="stylesheet" rel="stylesheet" type="text/css" href="default.css" /> <script type="text/javascript"> function switchStyle(el){ //get selected theme var styleSheet = el.options[el.selectedIndex].value; //apply the new style using id set earlier. document.getElementById('stylesheet').href = styleSheet; } </script> <body> <!-- (this) refers to … | |
Re: I believe we have two insert types with MySQL: `"INSERT INTO tablename set field='value', column='amount'..."`, and `"INSERT INTO tablename (field, column) VALUES ('value', 'amount')"` But your query is a mixture of both and neither: `"INSERT INTO ".$table." values $fld='$this->add_security($val)'"` | |
Re: `$check= mysql_query("SELECT FROM accounts WHERE (email='".$email."')");` Select what from accounts? ALL, Id etc? I guess error checking the query would have given an error. | |
Re: **@xbat**, from what I can see, `'q'` is not defined in your JS code, it is not even referenced, so it can't be JS that's giving the error. The only way I can understand this undefined error regarding 'q' is the processing page, testwopart1.php. The beginning of the script (testwopart1.php), … | |
Re: A standard array of checkboxes: <input type="checkbox" id="unicycle" name="cycle[]" value="1">I have one wheel. <input type="checkbox" id="bicycle" name="cycle[]" value="2">I have two wheels. <input type="checkbox" id="tricycle" name="cycle[]" value="3">I have three wheels. Now, echoed with PHP: <?php //escaping the double quotes: echo "<input type=\"checkbox\" id=\"unicycle\" name=\"cycle[]\" value=\"1\">I have one wheel."; //using single quotes: … | |
Re: It may well be possible to get all the things you want in one query, using the Join technique, but that is for someone else to tell you, have a look [here](http://www.daniweb.com/web-development/databases/mysql/threads/437575/combine-two-queries-into-one) :D As for looping through the way you mentioned: <?php $cityArray = new array(); $sql = "SELECT city … | |
Re: **vaultweller123** is exactly right. If you declare a variable: `$variable = "value";` ...and then you declare the same variable with a different value: `$variable = "another value";` ...the variable holds the second value and the first value is lost. It is the same in your loop, your variable '$url' can … | |
Re: I read through the code you posted, it was messy and I felt dirty and soiled :D But your question is: > any idea how to pass the selected data to the backend page once i click submit ...?? ...and my answer is yes, I have plenty idea, and I … | |
Re: I don't see how the hidden input can possibly be populated with the intended value because it is PHP that echoes the value and PHP won't do anything once the page is loaded. `$_POST['brand']` needs to exist when the page is loaded for PHP to echo the value onto the … | |
Re: I answered the same question yesterday so I can just copy and paste :D You need to make sure all your form elements are contained within a form declaration: <form action="page_that_will_process_form.php" method="post"> <input type="text"... /> <input type="button"... /> </form> Make sure each input has a unique name. <input name="unique_name"... /> … |