immunity Posted June 24, 2007 Share Posted June 24, 2007 Hello i would like someone to help me on PHP arrayI have on my page 6 get names ( $_GET['1'] , $_GET['2'] ...)i want to put them on an arrayi have a strin $string = "Select * from account ";then create a loop for how many array for ( ){ if ( i ==0){ $string = $string."Where ";}$string = $string.$array ;}how i say array in php ? Link to comment Share on other sites More sharing options...
immunity Posted June 24, 2007 Author Share Posted June 24, 2007 of course on array i will add "account=".$_GET['1'] etc Link to comment Share on other sites More sharing options...
zppblood Posted June 25, 2007 Share Posted June 25, 2007 It looks like you want the you/user to enter SQL code into the address bar. Just remember the user would be able to do whatever they wanted with your database.Use mysql_real_escape_string().You might want something like for ($i=0; $i<count($array); $i++) { // execute code;}Instead of allowing the user to control the code, create your own inside the array, and check for a value inside of the array with in_array().$array=array("user='$user'", "pattern LIKE '%people%'"); Link to comment Share on other sites More sharing options...
justsomeguy Posted June 25, 2007 Share Posted June 25, 2007 how i say array in php ? $array = array("a", "b", "c", "d", "e", "f");for ($i = 0; $i < count($array); $i++){ echo $array[$i];}foreach ($array as $element){ echo $element;}foreach ($array as $key => $value){ echo "element {$key} = {$value}";} http://www.php.net/manual/en/ref.array.php Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.