Re: grabbing data and auto email set users
| From: | Chris | Date: | Wed, 12 Apr 2006 00:18:54 +0000 |
| Subject: | Re: grabbing data and auto email set users | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-41693@lists.php.net to get a copy of this message | ||
JeRRy wrote:
Okay here is the full code. Now I got this code off a friend! In this first section to display the data that is grabbed from the db. ---- <?php $db = mysql_connect("localhost", "user", "pass"); mysql_select_db("db_select",$db); $result = mysql_query("SELECTRe: this comment - they only do if you have register_globals turned on. If you have it turned off (very very good idea!), you have to: $username = $_POST['username']['$a'] Then you can use that in your query instead of $username[$a] Note that the quotes are important - otherwise it will look for variable $a which doesn't exist (at least in this code). I don't know why you have the input area named like this: <input type=text name=username[$a] but that's up to you (me, I'd just call it 'username'). Check register_globals with a phpinfo page. -- Postgresql & php tutorials http://www.designmagick.com/nicknameFROM tipping WHERE 1 ORDER BYscoreDESC LIMIT 0, 30",$db); while ($myrow = mysql_fetch_row($result)) {printf("<br><input type=text name=username[$a] value=%s> <br>",$myrow[0]);} ?> <input type="submit" value="submit"> </form> </p> ---- It displays the data fine. Please note in the above there is more code and I doubt the issue is in there as the data fetching shows fine, I believe the error lies somewhere below. Than the form submit is pushed to another page with this code: --- <? include('../conf.inc.php');if ($REQUEST_METHOD == "POST") { $usr = "user"; $pwd = "pass"; $db = "db_select"; $host = "localhost"; $cid = mysql_connect($host,$usr,$pwd); mysql_select_db($db); // NOTE that form fields automatically become variables