Link to home
Start Free TrialLog in
Avatar of lawrence_dev
lawrence_dev

asked on

Transitioning to PDO/MySQL. Need help with SELECT statement, Do I have to bind value?

On a select statement without a WHERE clause, do I have to bind anything using PDO?

I am getting the following error:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 32 bytes)
on "$query2->execute();" line.


$query2 = $conn->prepare('SELECT * FROM `download');
// Do I bind a value here?
$query2->execute();

while ($row2 = $query2->fetch(PDO::FETCH_ASSOC))
{
    
 echo $row2['image']."<BR>";

}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lawrence_dev
lawrence_dev

ASKER

Thanks Gary!
I have 17040 rows,  None being returned.  If I place php.ini in the same folder, PDO stops working for some reason...  

Still working on it...
Add this to the top of the php page to get any errors reported

    error_reporting(E_ALL);

32 MB is rather small for a site, 64 or 128 would be better.
But you are returning a lot of rows - is there a reason?

If you are using a custom php.ini file you should place it in the site root.
I've just noticed a syntax error in your code

Should be (no need for the backticks and you were missing the closing one)

$query2 = $conn->query('SELECT * FROM download');

Open in new window

Thanks Gary for all of your help!!  Memory Limit issue with IonCube required for PDO.  Fixed it and it is good!
Thanks again!