0

I got table names from may schema into array. Now I want to use this array to make a scan through these tables and get latest date to make future update. Problem what I have now is I don't know how to use this array to make a SELECT query. To be honest Iv tried everything what i know like different quot dots mysql versus mysqli (".$table.") do some work I have output what i want but stil errors are echo. Below is the error what Im getting for

Warning: mysql_error() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\Stock_Project\UI\updater.php on line 36

Error occur probably because I try parse array int a string...??

Once when table is defined manually this piece of code is working. Does anybody knows solution how to Use array values to query database?? Appreciate for any help

$schema Array ( [0] => aaoi [1] => adbe [2] => blfs [3] => comm [4] => cste [5] => f [6] => input_control [7] => nasdaq [8] => nflx [9] => ntgr [10] => omab [11] => ubnt [12] => user [13] => yahoo [14] => yhoo [15] => zn )





foreach ($schema as $table) {       

      $sql=mysql_query("SELECT * FROM '$table' ORDER by date DESC LIMIT 1");

        if(!$sql) 
         {  
                echo mysql_error($sql);
         }
 }
    while($row= mysql_fetch_assoc($sql))
    {
     $data[] = $row['date'];
    }
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Daroo
  • 1
  • 1
  • 1
    Take off the quotations on '$table' – Juakali92 Dec 19 '15 at 21:03
  • Not working iv tried allready – Daroo Dec 19 '15 at 21:48
  • Well you're passing in a sql query into mysql_error. Pretty sure you can only pass your database connection as a parameter hence why it's not recognising the variable. Just use the if statement you have to echo errors instead. – Juakali92 Dec 20 '15 at 12:19
  • Not make a difference wont work at all. Finally i left this this idea for update my tables because I'v no clue how to fix that. – Daroo Dec 20 '15 at 15:44

0 Answers0