PHP Query select one record

Richard de Ree

I just started with PHP and I don't understand why this line won't work

$zoek = '2341 KG';
foreach ($pdo->query ("select * from blad1 where Postkode = $zoek" ) as $klant)

but this one does work perfect

foreach ($pdo->query ("select * from blad1 where Postkode = '2341 KG' " ) as $klant)
meda

You should prepare that query.

$stmt = $pdo ->prepare("select * from blad1 where Postkode = ?" );
$stmt->execute(array($zoek)); 
$klant = $stmt->fetch();//no loop it's a single record!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

MySQL selecting all records and for each select separate record - in one query

From Dev

Query to select latest updated record

From Dev

How to update two select boxes using one mysqli query in php

From Dev

php query Select 10 players and 3 reserves for each one

From Dev

mysql select query only showing one data in php

From Dev

How to update exactly one record and select updated row in a single db2 query

From Dev

SQL Server query to select records for a specific foreign key/month combination, or the master record if one does not exist for that day

From Dev

How to update exactly one record and select updated row in a single db2 query

From Dev

Make a SELECT query from two tables with one record from matching rows in mysql

From Dev

Active record select query to where and joins query

From Dev

Elasticsearch one record for one matching query

From Dev

One to Many, select one and many in one query

From Dev

Select Query does not find existing record

From Dev

Query to Select a "More Complete" Duplicate Record

From Dev

CoreData + Magical Record running select query

From Dev

Get record with Max value from SELECT query

From Dev

mysql query select just last record by time

From Dev

How to select only 1 record with sql query

From Dev

Select null in a linq query if the value is in a previous record

From Dev

CoreData + Magical Record running select query

From Dev

Ajax concatenate select and total record query

From Dev

codeigniter active record select query not working

From Dev

SQL query to select prior record based on value

From Dev

mysql query select just last record by time

From Dev

Select null record through the query string params?

From Dev

Update database record based on the select query result

From Dev

php codeigniter select query

From Dev

MYSQL select query in PHP

From Dev

relations in SELECT query (PHP)

Related Related

  1. 1

    MySQL selecting all records and for each select separate record - in one query

  2. 2

    Query to select latest updated record

  3. 3

    How to update two select boxes using one mysqli query in php

  4. 4

    php query Select 10 players and 3 reserves for each one

  5. 5

    mysql select query only showing one data in php

  6. 6

    How to update exactly one record and select updated row in a single db2 query

  7. 7

    SQL Server query to select records for a specific foreign key/month combination, or the master record if one does not exist for that day

  8. 8

    How to update exactly one record and select updated row in a single db2 query

  9. 9

    Make a SELECT query from two tables with one record from matching rows in mysql

  10. 10

    Active record select query to where and joins query

  11. 11

    Elasticsearch one record for one matching query

  12. 12

    One to Many, select one and many in one query

  13. 13

    Select Query does not find existing record

  14. 14

    Query to Select a "More Complete" Duplicate Record

  15. 15

    CoreData + Magical Record running select query

  16. 16

    Get record with Max value from SELECT query

  17. 17

    mysql query select just last record by time

  18. 18

    How to select only 1 record with sql query

  19. 19

    Select null in a linq query if the value is in a previous record

  20. 20

    CoreData + Magical Record running select query

  21. 21

    Ajax concatenate select and total record query

  22. 22

    codeigniter active record select query not working

  23. 23

    SQL query to select prior record based on value

  24. 24

    mysql query select just last record by time

  25. 25

    Select null record through the query string params?

  26. 26

    Update database record based on the select query result

  27. 27

    php codeigniter select query

  28. 28

    MYSQL select query in PHP

  29. 29

    relations in SELECT query (PHP)

HotTag

Archive