我只需要数组中一列的值。没有php我会使用“SELECT valueX FROM tableY”。 这不适用于PHP。我只得到一个结果。 这就是我所拥有的:
$salty = "SELECT salt FROM login";
$salts = mysqli_query($connection, $salty);
$validsalts = mysqli_fetch_array($salts);
答案 0 :(得分:1)
您必须进行循环迭代才能获取所有值。
例如。
public static Bitmap ScaleImage(Image image, int maxWidth, int maxHeight)
{
var ratioX = (double)maxWidth / image.Width;
var ratioY = (double)maxHeight / image.Height;
var ratio = Math.Min(ratioX, ratioY);
var newWidth = (int)(image.Width * ratio);
var newHeight = (int)(image.Height * ratio);
Bitmap newImage = new Bitmap(newWidth, newHeight);
using (Graphics gr = Graphics.FromImage(newImage))
{
gr.SmoothingMode = SmoothingMode.HighQuality;
gr.InterpolationMode = InterpolationMode.HighQualityBicubic;
gr.PixelOffsetMode = PixelOffsetMode.HighQuality;
gr.DrawImage(image, new Rectangle(0, 0, newWidth, newHeight));
}
return newImage;
}