Timeline for How to get the CID number of comments from comment table?
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 10, 2014 at 5:02 | vote | accept | user3530082 | ||
Oct 6, 2014 at 6:12 | comment | added | Aparna | just make $key->cid into an array. Take a look at this stackoverflow.com/questions/2476876/… | |
Oct 6, 2014 at 5:52 | comment | added | user3530082 | Yes, with print_r it worked, Thank you so much.so just one more question. so now my output is like: stdClass Object ( [cid] => 22 ) stdClass Object ( [cid] => 23 ) stdClass Object ( [cid] => 24 ) stdClass Object ( [cid] => 25 ) stdClass Object ( [cid] => 26 ) stdClass Object ( [cid] => 27 ) stdClass Object ( [cid] => 28 ) So if I want to save just those numbers(22,23,..) in array, how can I do it? @aparna | |
Oct 6, 2014 at 5:45 | comment | added | Aparna | No. I don't know what is causing you the error. As I said I was able to execute this query successfully. | |
Oct 6, 2014 at 5:41 | comment | added | Aparna | I was able execute this query successfully without an errors. Please try print_r($key); | |
Oct 6, 2014 at 5:32 | comment | added | user3530082 | and if I write: $result1=$result->execute(); I will get this error: PDOException: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound in include() (line 187 of C:\xampp\htdocs\myproject\sites\all\themes\Project\templates\node.tpl.php).Do you know what is the problem? | |
Oct 6, 2014 at 5:26 | comment | added | user3530082 | also if I write krumo($result), I will see this: ... (Object) DatabaseStatementBase dbh (Object) DatabaseConnection_mysql queryString (String, 40 characters ) SELECT cid FROM comment WHERE | |
Oct 6, 2014 at 5:25 | comment | added | user3530082 | so I wrote foreach($result as $key) echo $key; and I get this error:Recoverable fatal error: Object of class stdClass could not be converted to string in include() (line 187 of C:\xampp\htdocs\myproject\sites\all\themes\Project\templates\node.tpl.php). Do you think I can use this query in node.tpl.php ? | |
Oct 6, 2014 at 5:13 | comment | added | Aparna | There is no need for "$record=$result->execute()->fetch();" put $result in foreach loop and print the result and see. | |
Oct 6, 2014 at 4:58 | comment | added | user3530082 | So when I write only what you said,I will not get any error, but what should I write to execute the query? when I write $record=$result->execute()->fetch(); it gives me error. | |
Oct 6, 2014 at 4:56 | review | Low quality posts | |||
Oct 6, 2014 at 5:11 | |||||
Oct 6, 2014 at 4:41 | history | answered | Aparna | CC BY-SA 3.0 |