Php pdo mysql

Php pdo mysql

f.lee

Member
Joined
Jan 11, 2015
Posts
19
Reaction score
1
How to move data inside the loop

Eg......

q = $db->prepare("SELECT id FROM table WHERE forename = :forename and surname = :surname LIMIT 1"); $q->bindValue(':forename', 'Joe'); $q->bindValue(':surname', 'Bloggs'); $q->execute(); if ($q->rowCount() > 0){ $check = $q->fetch(PDO::FETCH_ASSOC); $row_id = $check['id']; // do something }

I need to move $row_id ...
 
How to move data inside the loop

Eg......

q = $db->prepare("SELECT id FROM table WHERE forename = :forename and surname = :surname LIMIT 1"); $q->bindValue(':forename', 'Joe'); $q->bindValue(':surname', 'Bloggs'); $q->execute(); if ($q->rowCount() > 0){ $check = $q->fetch(PDO::FETCH_ASSOC); $row_id = $check['id']; // do something }

I need to move $row_id ...

Declare $data = array ();

while( $check = fetch ){

$check = data[];
}
print_r data;
 
Didn't work

Maybe I don't understand what do you want?

Kwa code nilizoandka ni sample tu jins yakufanya sio actual solutions unayotaka bcoz mi sijasoma pdo ndo maana nimeandika short kwa kukupa knowledge...
 
Thanks for advice but you gave me an idea when I find the permanent solution I will post over here
 
Back
Top Bottom