0

I am trying to delete a file or copy a row into a new table, depending on a $_GET. The $_GET works fine, and I'm not including all the code, I know it isn't relevant. The table copy works, but the select statement that gets called when the $_GET is a different value returns nothing, except when I copy the query directly into phpmyadmin.

Base code:

$pID = $_GET['pID'];

$con = mysqli_connect("...","...","...","...");

The following works:

$query = 'INSERT INTO `photos` (`id`, `photo1`, `photo2`, `demographic_id`)
SELECT `id`, `photo1`, `photo2`, `demographic_id`
FROM `photos_queue`
WHERE `photos_queue`.`demographic_id` = '.$pID;

mysqli_query($con, $query);

This does not:

$query = 'SELECT `photo1` FROM `photos_queue` WHERE `demographic_id` = '.$pID;
$result = mysqli_query($con, $query);
print($result);
unlink($result);

I've printed $query and the value of it is valid; I can copy it directly into phpmyadmin and it will work fine.

4

2 に答える 2

0
($row = mysqli_fetch_array($result)

これは、

$result = mysqli_query($con, $query);
于 2013-10-06T20:04:30.063 に答える