Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 1,000 results for
pdo::fetch_assoc
- Page 1
Re: Data storage and retrieval - cache or database
Programming
Mobile Development
2 Months Ago
by jonathannweyer
If the "status" doesn't change frequently, caching is a solid option. You could fetch it from the database the first time it's needed, then store it in a cache (like in-memory or Redis, depending on your setup), and use that for subsequent loads.
Re: Question/Answering over SQL Data Using LangGraph Framework
Programming
Computer Science
2 Months Ago
by Pelorus_1
Through its combination of natural language processing and structured query generation, LangGraph makes interfacing with databases and extracting insights over SQL data easier than ever.
Error dealing with PDO Fetch...
Programming
Web Development
13 Years Ago
by BenzZz
…stmt = $dbh->query($sql); $result = $stmt->fetch(
PDO
::
FETCH_ASSOC
); foreach($result as $key=>$val){ echo "$val"…php function db_connect () { include'db_connection.inc'; $dbh = new
PDO
("mysql:host=127.0.0.1;$database", $user…what is wrong but i am not sure which
PDO
fetch command i should be using or if …
Re: Error dealing with PDO Fetch...
Programming
Web Development
13 Years Ago
by Stefano Mtangoo
…;query($sql); if(!$stmt){ die("
PDO
Statement is false!"); }else{ $result = $stmt->fetch(
PDO
::
FETCH_ASSOC
); //work with your resultset here… }[/CODE] [QUOTE]
PDO
::query() returns a PDOStatement object, or FALSE…
Re: Error dealing with PDO Fetch...
Programming
Web Development
13 Years Ago
by Stefano Mtangoo
…]Just tried that code and it has returned that the
PDO
statement is false so the query isn't working, any… working? Thanks for the help.[/QUOTE] From PHP Manual [I]
PDO
::errorInfo() returns an array of error information about the last…
Re: Error dealing with PDO Fetch...
Programming
Web Development
13 Years Ago
by ko ko
Did you include db_connection.inc file into db_connect.inc ? Perhaps, like below: [code=php] <?php include('db_connection.inc'); function db_connect () { include'db_connection.inc'; $dbh = new
PDO
("mysql:host=127.0.0.1;$database", $user, $password); return ($dbh); } ?> [/code]
Re: Error dealing with PDO Fetch...
Programming
Web Development
13 Years Ago
by BenzZz
[QUOTE]have you checked $stmt = $dbh->query($sql); does not return false? try something like this[/QUOTE] Just tried that code and it has returned that the
PDO
statement is false so the query isn't working, any ideas why? Is it that the query is wrong or could the db connection not be working? Thanks for the help.
Re: Error dealing with PDO Fetch...
Programming
Web Development
13 Years Ago
by BenzZz
Opened up mysql in cmd and noticed that the Staff table wasn't being created and data was not being inserted. I checked the
pdo
connection to the database and realised i had missed db_name= out before the database name 'library_db' which is what the cause was xD Thanks for all of the help :)
Re: Error dealing with PDO Fetch...
Programming
Web Development
13 Years Ago
by Stefano Mtangoo
… created and data was not being inserted. I checked the
pdo
connection to the database and realised i had missed db_name…
Re: Error dealing with PDO Fetch...
Programming
Web Development
13 Years Ago
by BenzZz
anyone?
Re: pdo does not return an error
Programming
Web Development
11 Years Ago
by pritaeas
$
pdo
->setAttribute(
PDO
::ATTR_ERRMODE,
PDO
::ERRMODE_EXCEPTION);
Re: Fetch data in table cells.
Programming
Web Development
14 Years Ago
by kvprajapati
Fetch/read a record and write it into response buffer. [code] StringBuilder sb=new StringBuilder(); sb.append("<table>"); ... sb.append("<tr><td>" + value1 + "</td></tr>"); ... sb.append("</table>"); .... Label1.Text=sb.ToString(); [/code]
Re: Trying to fetch associative array with prepared statements
Programming
Web Development
12 Years Ago
by LastMitch
…'t see you having `$stmt->
fetch_assoc
()` to fetch associative array. Read here for the `
fetch_assoc
()` http://php.net/manual/en/mysqli… something like this to separate the arrays: while ($stmt->
fetch_assoc
($result)) { echo $result['firstname']; echo $result['lastname']; }
Re: mysqli or mysql pdo
Programming
Web Development
12 Years Ago
by veedeoo
… parameter on its query, this is called
PDO
fetch class . This functionality is perfect for… template $smarty->assign('rockStars', $thisPDO->fetchAll(
PDO
::FETCH_CLASS, "RockStars")); ## you can loop …as you wish $this_PDO_result = $thisPDO->fetchAll(
PDO
::FETCH_CLASS, "RockStars"); That's all I…
Re: Mysqli fetch row not display
Programming
Web Development
11 Years Ago
by cereal
Try with `$row[0]` and `$row[1]`, the fetch row method returns a numeric array, use `
fetch_assoc
()` if you want to use the column names: * http://www.php.net/manual/en/mysqli-result.fetch-assoc.php
PDO help "Call to a member function prepare() on a non-object"
Programming
Web Development
14 Years Ago
by tyop
… return ($dbh); $dbh->setAttribute(
PDO
::ATTR_ERRMODE,
PDO
::ERRMODE_EXCEPTION); }[/CODE] Then the script that…to be :( $sth->bindParam(':email', $email_address,
PDO
::PARAM_STR); $sth->execute (); $count = 0;… :user"); $sth->bindParam(':user', $username,
PDO
::PARAM_STR); $sth->execute (); $count = 0; …
PDO - best practice
Programming
Web Development
13 Years Ago
by extjac
…) or die("failed!"); while($row = $rs->fetch(
PDO
::
FETCH_ASSOC
)){ $result[] = $row; } return $result; } } $Account = new account(); // * …) or die("failed!"); while($row = $rs->fetch(
PDO
::
FETCH_ASSOC
)){ $result[] = $row; } return $result; } } $Account = new account(); // * //…
pdo normalize mysql table
Programming
Web Development
8 Years Ago
by Bacchus_1
…array(":id"=>$id)); $editRow=$stmt->fetch(
PDO
::
FETCH_ASSOC
); return $editRow; } public function dataview($query) { …;rowCount()>0) { while($row=$stmt->fetch(
PDO
::
FETCH_ASSOC
)) { ?> <tr> <td…
Re: pdo normalize mysql table
Programming
Web Development
8 Years Ago
by seularts
…array(":id"=>$id)); $editRow=$stmt->fetch(
PDO
::
FETCH_ASSOC
); return $editRow; } public function edit($user,$shop) …rowCount()>0) { while($row=$stmt->fetch(
PDO
::
FETCH_ASSOC
)) { ?> <tr> <…
Re: pdo normalize mysql table
Programming
Web Development
8 Years Ago
by seularts
…($stmt->rowCount()>0) { while($row=$stmt->fetch(
PDO
::
FETCH_ASSOC
)) { $date_in = $row['data']; $date_out = explode(' ', $date_in); ?> <…array(":id"=>$id)); $editRow=$stmt->fetch(
PDO
::
FETCH_ASSOC
); return $editRow; If I echo `row['limbi_straine']` it …
Re: PDO help "Call to a member function prepare() on a non-object"
Programming
Web Development
14 Years Ago
by Ezzaral
Add[CODE]try { $dbh = new
PDO
( ... ); } catch (PDOException $e) { echo 'Connection failed: ' . $e->getMessage(); }[/CODE] just to be sure. Curious why are you making $dbh global and also returning it from the function. That seems redundant and prone to causing some confusing behavior later.
PDO post dropdown box to output
Programming
Web Development
10 Years Ago
by mkra
…coursename'); $stmt->execute(); while($row = $stmt->fetch(
PDO
::
FETCH_ASSOC
)) { echo '<option>'.$row['Course_Name'].'</option>';…db->prepare($sql); $stmt->bindParam(':ModuleID', $CourseID,
PDO
::PARAM_INT); $stmt->execute(); while ($output = $stmt->fetch…
Re: PDO - Classes and Forms
Programming
Web Development
13 Years Ago
by veedeoo
…will be passing this class to our
pdo
object public function show_userInfo(){ ## The following… will be output on the page once the
PDO
statement is fetched. $u_info = ""; $…include_once 'includes/settings.php'; #### The
PDO
objects ############### try { $someDb = new
PDO
("mysql:host=$db_host;dbname=$db_database"…
Re: PDO database select not returning expected data
Programming
Web Development
10 Years Ago
by Gideon_1
…;bindParam(':user', $subUsername); $q->execute(); $result = $q->fetchAll(
PDO
::
FETCH_ASSOC
); print_r($result); echo "</p>"; print_r($subUsername… not use the right argument for the fetch(). Its `fetch(
PDO
::
FETCH_ASSOC
)` NOT `fetch(
PDO
::FETCHASSOC`)
Fetch Image from database and display
Programming
Web Development
11 Years Ago
by My question
…--</option> <?php try {$db = new
PDO
('mysql:host=localhost;dbname=nativelead', 'newmellow', 'db@nativelead');} catch…$row->ID . '">'; } $rowarray = $result->fetchall(
PDO
::
FETCH_ASSOC
); $rowno = 0; foreach($rowarray as $row) { echo "<option…
Re: PDO Number of Total Queries per Page
Programming
Web Development
15 Years Ago
by smartness
[QUOTE]Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\...\functions.php on line 52[/QUOTE] What is the Code in functions.php on line 52? (the whole function if possible) [QUOTE]Fatal error: Call to a member function fetch() on a non-object in C:\xampp\htdocs\...\index.php on line 69[/QUOTE] I think this is caused because you …
PDO : ->fetchAll() vs ->fetch() + while
Programming
Web Development
12 Years Ago
by extjac
Hello, i wanted to know what you guys use with
PDO
. Do you use ->fetchAll() or ->fetch() + while based on some reading i have done, it seems that
PDO
->fetchAll() is faster but uses more momory...
PDO Query Fatal error:Call to a member function query() on a non-object
Programming
Web Development
11 Years Ago
by Athirah Yusri
…=try', $username, $password); $db->setAttribute(
PDO
::ATTR_ERRMODE,
PDO
::ERRMODE_EXCEPTION); } catch(PDOException $e) { echo &…postID' => $row['postID'])); $catRow = $stmt2->fetchAll(
PDO
::
FETCH_ASSOC
); $links = array(); foreach ($catRow as $cat) { $…
PDO Group fetched results by same ID
Programming
Web Development
8 Years Ago
by seularts
…dbname", $username, $password); $conn->setAttribute(
PDO
::ATTR_ERRMODE,
PDO
::ERRMODE_EXCEPTION); $stmt = $conn->prepare("SELECT submit_time… resulting array to associative $result = $stmt->setFetchMode(
PDO
::
FETCH_ASSOC
); foreach(new TableRows(new RecursiveArrayIterator($stmt->fetchAll())) as …
Re: PDO read BLOB files
Programming
Web Development
8 Years Ago
by seularts
…($stmt->rowCount()>0) { while($row=$stmt->fetch(
PDO
::
FETCH_ASSOC
)) { $date_in = $row['datetime']; $date_out = explode(' ', $date_in); ?> <tr>…
1
2
3
17
Next
Last
Search
Search
Forums
Forum Index
Hardware/Software
Recommended Topics
Programming
Recommended Topics
Digital Media
Recommended Topics
Community Center
Recommended Topics
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
Backlink Auditor
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2025 DaniWeb® LLC