-1

I want something like this?

$sql = mysql_query("SELECT lid, ip FROM lua where uid='$uid'"); 
$rows = mysql_fetch_array($sql);
$ip = $rows['ip'];
$res = array('value 1 of $ip from datebase','value 2 of $ip from datebase','value 3 of $ip        from datebase.......');
?>

Is it possible? help related this...thnxx..

3 Answers3

1
$arr = array();
while ($rows = mysql_fetch_array($sql)) {
    array_push($arr,$rows['ip']); // and so on if you willing other values to be in your array
}
var_dump($arr); // test your array

NOTE: Though it's deprecated to use mysql, use mysqli or pdo extensions instead. See this post about this issue

Community
  • 1
  • 1
nanobash
  • 5,419
  • 7
  • 38
  • 56
1

try this:

$arrResult = array();
while ($row = mysql_fetch_array($sql)) {
    $arrResult[] = $row['ip'];
}
Awlad Liton
  • 9,366
  • 2
  • 27
  • 53
0
$result = mysql_query("SELECT ip FROM lua where uid='$uid'"); 
$ip = array();  
while ($ip[] = mysql_fetch_field($result));
$ip = array_filter($ip);
evalarezo
  • 1,134
  • 7
  • 13