nonexistentera Posted September 14, 2008 Share Posted September 14, 2008 Hello. I have the script below that creates a list of random alphanumeric combinations. include('db_connect.inc.php'); function md5this($length,$limit){ while ($length<$limit){ set_time_limit(0); $charset = "abcdefghijklmnopqrstuvwxyz0123456789"; // Do not edit beyond this point! for($i=0;$i<strlen($charset);$i++) $x[]=$charset{$i}; for($i=0,$z="",$e="echo ";$i<$length;$i++){ $z.="foreach(\$x as \$y[$i])"; $e.="\$y[$i]."; } $evalinsert = eval($z.$e."\"<br />\";"); $length++; mysql_query("INSERT INTO `table`.`x1` ( `id` , `ancode` ) VALUES ( NULL , '$evalinsert' );"); } } md5this(1,3); I know that it is connecting to the database and inserting data, but not the data I need. With how it is now it just inserts a blank space. I am trying to input all of the data that the script displays. Anyone know what to change. Script output is Here Link to comment https://forums.phpfreaks.com/topic/124237-help-inserting-data-into-mysql/ Share on other sites More sharing options...
nonexistentera Posted September 18, 2008 Author Share Posted September 18, 2008 Anyone? Link to comment https://forums.phpfreaks.com/topic/124237-help-inserting-data-into-mysql/#findComment-645231 Share on other sites More sharing options...
Maq Posted September 19, 2008 Share Posted September 19, 2008 mysql_query("INSERT INTO `table`.`x1` (`id`, `ancode`) VALUES (NULL , '$evalinsert')"); I think you have an extra ';'. $evalinsert is outputting data correct? If this doesn't work check out this tutorial. http://www.tizag.com/mysqlTutorial/mysqlinsert.php I'm also unsure of `table`.`x1` You're only inserting into 1 table correct? Link to comment https://forums.phpfreaks.com/topic/124237-help-inserting-data-into-mysql/#findComment-645372 Share on other sites More sharing options...
nonexistentera Posted September 21, 2008 Author Share Posted September 21, 2008 mysql_query("INSERT INTO `table`.`x1` (`id`, `ancode`) VALUES (NULL , '$evalinsert')"); I think you have an extra ';'. $evalinsert is outputting data correct? If this doesn't work check out this tutorial. http://www.tizag.com/mysqlTutorial/mysqlinsert.php I'm also unsure of `table`.`x1` You're only inserting into 1 table correct? Yeah. To my knowledge the `table`.`x1` means that it will insert into the database named table, and the table named x1. Not sure, just got it from phpMyAdmin. include('db_connect.inc.php'); function md5this($length,$limit){ $_GLOBALS[$evalinsert]; while ($length<$limit){ set_time_limit(0); $charset = "abcd"; // Do not edit beyond this point! for($i=0;$i<strlen($charset);$i++) $x[]=$charset[$i]; for($i=0,$z="",$e="echo ";$i<$length;$i++){ $z.="foreach(\$x as \$y[$i])"; $e.="\$y[$i]."; } $evalinsert = eval($z.$e."\"<br />\";"); mysql_query("INSERT INTO `md5Sums` ( `id` , `anValue`, `md5Sum` ) VALUES ( NULL , '$exits', '".md5($exits)."')") or die(mysql_error()); $length++; } } md5this(1, 3); Here is what I have after the fix in the SQL and setting evalinsert to global. Anything look wrong, as it still is just inserting a blank. 1 (blank) d41d8cd98f00b204e9800998ecf8427e Link to comment https://forums.phpfreaks.com/topic/124237-help-inserting-data-into-mysql/#findComment-646757 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.