$result
- это не поле, которое вы ищете, вы должны получить данные из $result
.Обратите внимание на вызов mysql_fetch_assoc
, который извлекает данные из результата запроса.
Вот пример из mysql_query документации
// Formulate Query
// This is the best way to perform an SQL query
// For more examples, see mysql_real_escape_string()
$query = sprintf("SELECT firstname, lastname, address, age FROM friends WHERE firstname='%s' AND lastname='%s'",
mysql_real_escape_string('fred'),
mysql_real_escape_string('fox'));
// Perform Query
$result = mysql_query($query);
// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
$message .= 'Whole query: ' . $query;
die($message);
}
// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the mysql result functions must be used
// See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.
while ($row = mysql_fetch_assoc($result)) {
echo $row['firstname'];
echo $row['lastname'];
echo $row['address'];
echo $row['age'];
}
// Free the resources associated with the result set
// This is done automatically at the end of the script
mysql_free_result($result);
Поэтому вы можетеизмените ваш код следующим образом:
$query="SELECT videoid from blabla";
$result=mysql_query($query);
if (!$result) {
$message = 'Invalid query: ' . mysql_error() . "\n";
die($message);
}
while ($row = mysql_fetch_assoc($result)) {
// loop through every videoid returned, ftp each individually
ftp_put ($connection,$destination,$row['videoid'],FTP_ASCII);
}
mysql_free_result($result);