Jump to content

narutofan

Members
  • Content Count

    64
  • Joined

  • Last visited

Community Reputation

0 Neutral

About narutofan

  • Rank
    Regular Member
  1. thanks @Barand and others who helped me to make it work. it now works now flawlessley.
  2. @Barand so, i should pass arrays is what you suggest sir ?.
  3. @Barandno need to apologise ,everybody make mistakes. i have tweaked the query & code to prevent repeated values from populating the timeline for some silly mistake that i made its not working and i couldn't figure it out. here is the code: function totalprocedures($conn, $v, $update_id1, $gp_id1) { foreach ($update_id1 as $v1) { $unique_up = array_unique($v1); $implode1 = implode(",", $unique_up); } foreach ($gp_id1 as $j => $v2) { $unique_gp = array_unique($v2); $implode2 = implode(",", $unique_gp); } foreach (
  4. finally i got the output to separate both the tables results: sample output: Array ( [0] => Array ( [0] => Array ( [update_id] => 396 [0] => 396 [update_body] => <div>Praesent porttitor, nulla vitae posuere iaculis, arcu nisl dignissim dolor, a pretium mi sem ut ipsum. Morbi ac felis.</div> <div>&nbsp;</div> <div>Etiam sit amet orci eget eros faucibus tincidunt. Pellentesque commodo eros a enim.</div> <div>&nbsp;</div&g
  5. then how come these ppl can run multiple normal queries and get results pl check this stackoverflow page for my confusion and advice on the same as a gut feeling i know that there is a way out there to produce both the tables result.
  6. following @Barand advice i wrote a new function to test in but now the new problem is it brings only updates table result and not group_posts result. here is the new function: function totalprocedures($conn,$friend) { try{ $sql= "select * FROM updates where `author` ='".$friend."' order by time desc limit 1 ;"; $sql.="select * FROM group_posts where `author_gp` ='".$friend."' order by pdate desc limit 1"; $stmt=$conn->query($sql); // $row=$stmt->nextRowset(); //$rows= $row->fetchAll(PDO::FETCH_BOTH); while($rows=$stmt->fetch()){ return $rows;
  7. since i'm still learning i just didn't want to sound stupid of asking the question how??? i'm sorry if i made you uneasy. so was my approach right when it comes to stored procedure. how can i use two normal queries when ajax keeps on producing repeated values bcoz of loops in php while executing the script. its the reason i tried my hand in joins(but will reopen that thread once i finish with this stored procedure) result total failure becoz of poor design(dont know how to correct it). these are the reasons why i might look ignorant sir @Barand as an elder i respec t you the mo
  8. so, @Barand basically i need to create more out parameters is what i understand from your examples and call them through the procedure like this: begin select id1, name1 INTO @a1, @b1 FROM location1 LIMIT 1; //not limit it to 5 select id2, name2 into @a2,@b2 FROM location2 limit 1; //not limit it to 5 end // then call it like: call timeline('shan2batman','aboutthecreator',@a1,@b1,@a2,@b2); is that correct sir. as one of the eldest members you shouldn't be making fun when ppl are learning. ☹️
  9. i will try to fix them but the pressing problem at hand is executing the stored procedure. As it helps me to learn by the way sir @Barand
  10. @Barandbecause its easier and my tables have some problems for joined queries. plus i can get the values in two arrays which helps me a lot to separate them.
  11. @Barandi want to retrieve the values of both the select statements and print it in my timeline thats the objective.
  12. After changing the query to this i get the following error code: SQLSTATE[21000]: Cardinality violation: 1222 The used SELECT statements have a different number of columns sql query that was changed: select update_id as up1,account_name as acc,user_id_u as uid,author as auth,time,title as tit1,update_body as u_body INTO updates FROM updates as up where author in (friend,session_id) order by time desc limit 5 ; select gp_id as gid,author_gp as auth2,type as ty2,title as tit2,data as dat2,pdate,author_id as authid INTO group_posts FROM group_posts as gp where author_gp in (friend,se
  13. @Barand can you help me with this. can you point where i'm going wrong.
  14. after referring to this stackoverflow page i changed the code to: public function totalProcedures($friend_name, $session_id) { /* * query to fetch stored procedure */ try { //executing the stored procedure $sql_sp = "CALL timeline (:friend,:session)" ; $stmt_sp = $this->_db->prepare($sql_sp); $stmt_sp->bindValue(":friend",$friend_name); $stmt_sp->bindValue(":session",$session_id); $stmt_sp->execute(); $row=$stmt_sp-
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.