Re: How to query database using variable and get all results not just one row Programming Web Development by Chris_103 …($sql); $stmt->bindParam(':variable_name', $variable_name, PDO::PARAM_STR); $stmt->execute(); $records = $stmt->fetchAll(PDO::FETCH_ASSOC); ``` This will fetch all rows that… Re: How to query database using variable and get all results not just one row Programming Web Development by Mikekelvin …($sql); $stmt->bindParam(':variable_name', $currentUser, PDO::PARAM_STR); $stmt->execute(); $records = $stmt->fetchAll(PDO::FETCH_ASSOC); In this modified version of your… Re: How to query database using variable and get all results not just one row Programming Web Development by Biiim … use to access your DB directly I don't use PDO so i'm not too familiar on how it returns… Re: Improve HAVING BY performance Programming Databases by toneewa I added your mentioned alter table index. Took 4.375 secs in MySQL Workbench. It did speed up the results. I'll have to try another method of importing to see if I can improve this. I also ommitted the overhead of converting variables for display output measurements, because they were included in the C++ times. If we were to compare the two, it as … How to query database using variable and get all results not just one row Programming Web Development by nander …;; $stmt = $conn->prepare($sql); $stmt->bindParam(':variable_name', $variable_name, PDO::PARAM_STR); $stmt->execute(); $records = $stmt->fetchAll(PDO::FETCH_ASSOC); Re: How to Code a Load More Button? Digital Media Digital Marketing Search Engine Strategies by MarkMarketer Creating a "Load More" button is a common feature when it comes to handling large data sets. The idea is to load a small amount of data initially and then load more data as the user requests it. This can be done with a combination of HTML, CSS, and JavaScript. This guide will take you through creating a simple "Load More" … Error dealing with PDO Fetch... Programming Web Development 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: Trying to fetch associative array with prepared statements Programming Web Development 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 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 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 Re: Issue with fetch row Programming Web Development by as.bhanuprakash [CODE] <?php //connect //ordering the latitude $query="SELECT Latitude FROM Position ORDER BY Latitude ASC"; $result=mysql_query($query); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } while ($row = mysql_fetch_assoc($result)) { echo $row['Latitude']."<br />"; } ?>[/CODE] Try the … Re: Issue Updating A Single Row From A MySQL Database Table Programming Web Development by alan.davies … does it return an array (single record as in a PDO fetch as opposed to a fetchAll)? Some of your code… fetch_assoc and fetch_object problem Programming Web Development by jacobus8 … I use fetch_row. The problem is that when I use fetch_assoc or fetch_object, the system churns and churns and then finally…;/p>"; /* fetch assoc array while ($row = $result->fetch_assoc()) { echo "<p><strong>Title: "… Re: fetch_assoc and fetch_object problem Programming Web Development by jacobus8 …;/p>"; /* fetch assoc array while ($row = $result->fetch_assoc()) { echo "<p><strong>Title: "… Re: fetch_assoc and fetch_object problem Programming Web Development by jacobus8 …]mysqli_result::fetch_row[/icode] works perfectly, but [icode]mysqli_result::fetch_assoc[/icode] and [icode]mysqli_result::fetch_object[/icode] on the …, but if I comment out the call to fetch_assoc() at line 19, I get what I expect…ok.</p>"; $row = $result->fetch_assoc(); // fetch assoc array one time only if ($mysqli… Dynamic form. Programming Web Development by aphpdeveloper Hello, I am stumped on a problem im having, and I get the feeling that the solution is quite simple yet requires knowledge of certain functions. Basically I am creating a guestbook which allows users to post comments, however I am trying to create an admin approval system so that comments must be approved before they can be seen. So far I have … Re: PHP multi-dimensional arrays Programming Web Development by jkon …, PHP associative arrays (that are the one returned by PDO fetch PDO::FETCH_ASSOC @see http://php.net/manual/en/pdostatement.fetch.php ) need… message). That doesn't happen only for arrays resulted by PDO fetch but for any PHP array. Except for that I… Re: Gravatar Integration Programming Web Development by cereal … the top of each of those pages and move to PDO or MySQLi library. Re: little problem in displaying the next row data from db.. Programming Web Development by R0bb0b There are several ways, here are just a few: mysql_fetch_assoc: [URL="http://us.php.net/manual/en/function.mysql-fetch-assoc.php"]http://us.php.net/manual/en/function.mysql-fetch-assoc.php[/URL] mysql_result: [URL="http://us.php.net/manual/en/function.mysql-result.php"]http://us.php.net/manual/en/function.mysql-result.php… Re: Filling in form for users Programming Web Development by digital-ether Take a look at PHP's docs on mysql_fetch_assoc() : [url]http://www.php.net/manual/en/function.mysql-fetch-assoc.php[/url] (I assume you're using MySQL. ) The first example on that page uses the following functions: [B]mysql_connect()[/B] - [url]http://www.php.net/function.mysql-connect[/url] this connects to your db. [B]mysql_query()[/B] - [… Re: PHP Two Table Query Programming Web Development by jmichae3 …;'") or trigger_error($db->error); while($row_list = $get_list_title->fetch_assoc()) { $list_title = $row_list['title']; $display_block .= "<p>".$list_title….net/manual/en/mysqli-result.free.php[/URL] you want fetch_assoc instead of fetch_array. momo, thanks for commenting. after a respite… Re: images folder variable Programming Web Development by aaro should i use msql_fetch_array instead of fetch assoc ? does fetch assoc work with numbers Re: images folder variable Programming Web Development by aaro [CODE][/CODE][QUOTE=aaro;1705057]should i use msql_fetch_array instead of fetch assoc ? does fetch assoc work with numbers[/QUOTE] ok i fixed it thanks for your help everyone [CODE]$id = $row['id']; if(!ctype_digit($id)){$id = 1;}//if id is not a number set it to 1 $mysql_query = "select `id` from `addrental` WHERE `id` = {$id}"… Re: Function in a Class Programming Web Development by broj1 To display row(s) you should add a variant of a fetch statement: $tables = mysql_fetch_row($result); echo print_r(tables, 1); http://www.php.net/manual/en/function.mysql-fetch-array.php http://www.php.net/manual/en/function.mysql-fetch-assoc.php http://www.php.net/manual/en/function.mysql-fetch-field.php http://www.php.net/manual/en/… Re: three dimensional arrays Programming Web Development by digital-ether Hi, Just to be clear, a multidimensional array looks something like: [PHP]$array = array(array(0, 1)); // 2 dimensional since you need two indexes to get the values eg: $array[0, 0];[/PHP] I believe whats limiting the code right now is the notation of your arrays. (that may just be an example by the way, but anyways..) Since the arrays … Re: Pagination - not displaying results properly, please help! Programming Web Development by michellephp Hi again, Ok I have attempted :confused: the code you sent above, and I also couldn't get it to work. Now, I am getting all the results showing on the first page, a next link that doesn't work and it says, " showing 1 of listings" //set rows per page, page to display and rows to display that correspond to that page… Re: Return Car Make from MySQL database & have the make hyperlinked. Programming Web Development by vidaj First you have to connect to your mysql_database with your username and password, and select the database you want to use. Then you create your query (the select statement) and send that query to the server. Then you get your result back, and you can fetch the values. [code=php] // Connect to the database $link = mysql_connect('localhost', … Re: Live Search Box - Access Database Programming Web Development by digital-ether I'd advise using PHP if you post here, and you can post your ASP version in the ASP forum. :) With PHP, you'll have to connect to the database [url]http://php.net/manual/en/function.mysql-connect.php[/url] Then make the search query: [url]http://php.net/manual/en/function.mysql-query.php[/url] Retrieve the results of the query: [url]http://www.… Re: how to create right amount of check boxes based on data held in database Programming Web Development by as.bhanuprakash Check the following link to know more about how mysql_fetch_assoc() works. [url]http://in2.php.net/manual/en/function.mysql-fetch-assoc.php[/url] [CODE] $sql1 = mysql_query("SELECT equipmentid, description FROM equipment") or die(mysql_error()); //$numberofrows = mysql_num_rows($sql1); Not necessary in this case, but for you to know… Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL Programming Web Development by broj1 [mysql_fetch_array](http://php.net/manual/en/function.mysql-fetch-array.php) function returns result in both associative and numeric arrays while [mysql_fetch_assoc](http://php.net/manual/en/function.mysql-fetch-assoc.php) function returns result only in an associative array. It is the matter of what you want when choosing among them.