Re: grabbing data and auto email set users

From: Date: Tue, 11 Apr 2006 07:22:20 +0000
Subject: Re: grabbing data and auto email set users
Groups: php.db 
Request: Send a blank email to php-db+get-41690@lists.php.net to get a copy of this message
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("SELECT nickname FROM tipping WHERE 1 ORDER BY score DESC 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 $query = "insert into round3 SET username='$username[$a]'"; mysql_query("$query"); echo(" "); } else {echo("Ooops, something bad happened! Please try again shortly.");} ?> <a href="admin.php">BACK</a> --- But when I check the db only ONE entry is added and it's blank. But on the the page that displays the data shows 12 records. So it's not updating for some reason? Any help? J

« previous php.db (#41690) next »