Question: I have a script to find the lowest value from a column but some entries dont have a value or its set to 0 if this is the case I'd like ti to find the next lowest value.

Here is my sql command.

```
$result = mysql_query("SELECT DISTINCT product_name, format, image_url, MIN(online_price), EAN FROM products where $searchstring and format = '{$cat}' AND EAN != ' ' AND EAN != '-' AND EAN != 'PRERELEASE' AND online_price > '0' group by EAN LIMIT " . ($page-1)*$Limit . ",$Limit");

```

Any ideas?

Answer: 
I believe you'll have to go with [CreateProcess](http://msdn.microsoft.com/en-us/library/ms682425%28VS.85%29.aspx) instead.
I must say, the existing answer wasn't particularly descriptive. Here's a way to execute commands without a new `cmd.exe` window.

Based on [an answer by Roland Rabien](https://stackoverflow.com/a/1597315/6850771) and [MSDN](https://msdn.microsoft.com/en-ca/library/windows/desktop/ms682425(v=vs.85).aspx), I've written a working function:

```
int windows_system(const char *cmd)
{
  PROCESS_INFORMATION p_info;
  STARTUPINFO s_info;
  LPSTR cmdline, programpath;

  memset(&s_info, 0, sizeof(s_info));
  memset(&p_info, 0, sizeof(p_info));
  s_info.cb = sizeof(s_info);

  cmdline     = _tcsdup(TEXT(cmd));
  programpath = _tcsdup(TEXT(cmd));

  if (CreateProcess(programpath, cmdline, NULL, NULL, 0, 0, NULL, NULL, &s_info, &p_info))
  {
    WaitForSingleObject(p_info.hProcess, INFINITE);
    CloseHandle(p_info.hProcess);
    CloseHandle(p_info.hThread);
  }
}

```

Works on all Windows platforms. Call just like you would `system()`.