FAQ Database Discussion Community


Mysqli prepared statements register

php,mysqli,fetch,statements,close
Okay I have one question. I need to check if the user already exists but the question is now what I need to type in the if() I can't fetch because I have closed but if I didn't close i got an error because there can't run 2 statements. So...

Hibernate join fetch does an N+1, how to fix it?

hibernate,join,left-join,fetch
I have this query: @NamedQuery( name = "org.mygovscot.stars.model.UserNeed.findAll", query = "SELECT un FROM UserNeed un " + "LEFT JOIN FETCH un.services " ) With this mapping from Service to UserNeed: <set name="userNeeds" table="service_userNeed"> <key column="service_id"/> <many-to-many column="userNeed_id" class="UserNeed"/> </set> and this mapping from UserNeed to Service: <set name="services" table="service_userNeed"> <key...

Does not generate data in bootstrap thumbnail

php,html,mysql,twitter-bootstrap,fetch
I want to display some data in the bootstrap thumbnail. I dont get it why it does not show any data fetched from the database. database connection is correct. <div class="jumbotron"> <div class="container"> <center> <h1> Welkom!</h1> <p>Op de website van Ter Bruggen Antiek en Curiosa.<br />Voor uw mooiste antieke kroonluchters,...

PLSQL invalid number error after fetch

plsql,numbers,fetch
sorry if this is an confusing post and the style is not proper but this is my first question but im having an error after i want to fetch c_latlong : the things he will fetch are: LAT value : 50,9459744669855 LON value : 5,9704909091251 ORA-01722: invalid number ORA-06512: at...

Fetch Android files using FTP and Python

android,python,ftp,connection,fetch
I'm currently struggling with some difficulties to fetch android files using a FTP server and Python. I installed on my Android device a application to act as an FTP server. I tested on the Windows explorer and was able to view and interact with the ftp data. Now, I'm trying...

Java resultset displayed in reverse order

java,fetch,reverse,resultset
I'm testing a very simple Java webapp doGet() method with the following code: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { Class.forName("oracle.jdbc.OracleDriver"); } catch(ClassNotFoundException ex) { System.out.println(ex); } String sql_qrp="select * from HR.EMP_MGMT"; try { Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/XE","HR","HR"); try(Statement stm=con.createStatement()) { ResultSet rs=stm.executeQuery(sql_qrp);...

How to Correctly Fetch Data From Query Generated Array

php,arrays,pdo,fetch
I'm generally confused about the proper way to get data from a query once you execute. My end goal is to be able to show a list of all the records, but I'm not sure how to do it. I've tried a couple of different things but none have given...

Related nodes are not fetched in Spring Data Neo4j 4.0.0

neo4j,nodes,fetch,spring-data-neo4j,spring-data-neo4j-4
I have a weird problem with the node auto fetching in Spring Data Neo4j 4.0.0. I have a class like below : @NodeEntity public class FilterVersionChange extends UnitVersion { @GraphId private Long id; public FilterVersionChange() { super(); } public FilterVersionChange(String description, Long creationDate) { super(description, creationDate); } @Relationship(type="CONTAINS", direction =...

My fetch appears not to get any results

php,pdo,fetch
I want to use this code to fetch content out of the database, database connection is made with global $connect and is working correctly. But I do not understand why there is no content available on the web page. If someone can help me with this, that would be very...

How can I get all id's from a database column into one single array?

php,mysql,pdo,fetch
How can I fetch all the values from columns (like an id column) and put them into an array? I'm using PDO API and I tried with other code, but it's not working for me. $STH = $DBH->query('SELECT Tid from Playlist '); $STH->setFetchMode(PDO::FETCH_OBJ); $result = $STH->fetch(); while($result = mysql_fetch_array($result)) {...

Notice: Array to string conversion in pathname on line 33 Array

php,arrays,json,dynamic,fetch
I continually get the notice, "Notice: Array to string conversion in pathname on line 33". When I hide the notice though error_reporting(E_ALL ^ E_NOTICE); I still get the word "Array" appearing as many times as rows I have returning. Being new I can't seem to get rid of them. There...

React Native fetch is not a function

fetch,react-native
I'm trying to use react native for a simple app. I want to download a json array from a page and display it as a listview. I'm doing this var listApp = React.createClass({ fetchData : function() { fetch(requestURL) .then((response) => response.json()) .then((responseData) => { console.log(responseData); }) .done(); }, componentDidMount: function()...

Array Fetching time one row value is skipping by code

php,mysql,fetch
In php code i tried to fetch data from my database but when i fetch data two times or one time the next time the output of code is skipping first value in my output .. $result = mysql_query($order) or die(mysql_error()); echo mysql_num_rows($result); $row=mysql_fetch_array($result); while ($row=mysql_fetch_array($result)){ echo ("<tr><td>$row[name]</td>"); echo ("<td>$row[email]</td>");...

SELECT * FROM WHERE Query isn't retrieving any results

mysql,select,mysqli,fetch
I'm using a SELECT * FROM "" WHERE "" = "" query and I'm not sure what I'm doing wrong with it. I'm trying to select an item based on its PO which is a completely unique identifier to one row in the table. Here's my process in doing so:...

Fetch part of url to make subject of mail

php,fetch,subject,mail-form
I have just received a great answer to my previous question: LINK In addition to this answer, I have a new challenge. My mailform is supported with a form.lib.php file where the mailsubject is defined and printed to the mail. define( 'PHPFMG_SUBJECT' , "" ); function sendFormMail( $form_mail, $sFileName =...

while ($stmt->fetch()) not fetching all rows

php,sql,loops,fetch
I am trying to display all recipes belonging to a logged in user using the while loop. I noticed that let's say, the user have 4 recipes, the first one will not be displayed, resulting in only 3 recipes appearing in the table. If the user have 3 recipes, the...

fetch_array() - cannot add multiple array fields to new array

php,arrays,json,mysqli,fetch
I am trying to return a json from a MySQL query to use it with xCode but I cannot get an array of several objects with multiple fields. I have read the documentation on php.net and over here, but I still can't get it. 1) Let's say I have a...

Fetch several rss feeds from other blogs in one page

wordpress,function,rss,fetch,autoblogged
I am trying to make a function which take an rss fedd URL and fetches the most recent 2 posts. I have tried to remake the snippet from here to a full function in funtions.php as following. I don't want to use a plugin for this since the plugins I...

mysql_fetch_array() expects parameter 1 to be resource, boolean given in, and a [duplicate]

php,mysql,sql,select,fetch
This question already has an answer here: mysql_fetch_array() expects parameter 1 to be resource (or mysqli_result), boolean given 29 answers I'm getting the following error : Warning : mysql_fetch_array() expects parameter 1 to be resource, boolean given in and Warning: Cannot modify header information - headers already sent by...

How to use OFFSET and Fetch without Order by in SQL Server

sql-server,sql-server-2012,sql-order-by,fetch,offset
I want use OFFSET and Fetch in my SQL server 2012 query.But without any order by.I can not use order by.Because my sort order will be lost. How can I use OFFSET and Fetch without order by and row number and where in my query? My 2 select tables have...

How to figure out the optimal fetch size for the select query

oracle,memory,jdbc,fetch
In JDBC the default fetch size is 10, but I guess that's not the best fetch size when I have a million rows. I understand that a fetch size too low reduces performance, but also if the fetch size is too high. How can I find the optimal size? And...

MYSQL fetching rows to different tables

php,mysql,row,fetch
I'm here with following problem. I have table with multiple records. Each row represents news of some kind, so I need to distinguish one from the another. The way to do that, is to make a table for each of these news(or a wrapper of some kind), however I encoutred...

PHP loop Foreach + While

php,loops,foreach,while-loop,fetch
I don't know why the result is return duplicate rows. This code is try to fetching every coloumn & row data. $n=array(); $s=array(); i declared array for moving data coloumn to variable $i =0; $x =0; $matkul = 0; while ($matkul<$ttlrow){ //try to fecth all coloumns data every row. foreach($dom->find('td[style="text-align:left;"]')...

How to appropriately performFetch from NSFetchedResultsController after changes in another context?

ios,objective-c,core-data,refresh,fetch
When I make some changes in another top layer controller with own context then I post notification to UITableViewController class for update cells. This notification calls performFetch after setting fetchedResultsController to nil. But I have seen this changes only if I reload UITableViewController entirely. I'm not using cache. How to...

Git fetch adds random text to my code

git,github,fetch,pull
Im a beginner at using git. I am working on a project using two a work computer and a home pc, saving my code to github as I go. However when I make changes on one computer and want to update the project on the other pc by fetching from...

Keep somewhere additional data after backbone's collection fetched

javascript,backbone.js,collections,fetch
I receive next data from server after get request: { data: { items: [...], itemsCount: Number } } I'm saving items in backbone collection in next way: parse: function (response) { return response.data.items; } How do I keep somehow in collection or outer itemsCount?...

Adding Array to MySQL Fetch

php,mysql,arrays,json,fetch
I'm fetching results from my database (fetchAll), and later encoding it into json. However, I want to add additional values to it, but I have no idea how to achieve that. I tried doing this is: while ($posts = $database->fetchAll()) { $posts['additional'] = 'test'; } But it wasn't working. The...

PDO fetch without moving internal cursor

php,pdo,fetch
I have a method called getField and it calls fetch, and I was wondering if there is method similar to fetch, only that it doesn't move the internal cursor forward, and instead stays where it is. So, I have the following methods: public function getField($field_name){ if(!is_array($this->row) || empty($this->row)){ $this->row =...

how to edit XML files in batch / python

python,xml,batch-file,vbscript,fetch
I'm trying to edit xml files in a batch / python script this is my xml file: <?xml version="1.0" encoding="UTF-8"?> <task name="analyse"> <taskInfo taskId="21a09311-ade3-4e9a-af21-d13be8b7ba45" runAt="2015-05-20 13:48:50" runTime="5 minutes, 53 seconds"> <project name="13955 - HMI Volvo Truck PA15" number="e20d51c0-71dc-4572-8f9b-4c150bf35222" /> <language lcid="1031" name="German (Germany)" /> <tm name="ENG-DEU_en-GB_de-DE.sdltm" /> <settings reportInternalFuzzyLeverage="yes" reportLockedSegments="no"...

php mysql fetch two table [closed]

php,mysql,while-loop,fetch
i have two table from mysql. 1, photo (url_link) 2, video(url_link) i wanna fetch only 1 table (video url) if both table aren't empty.. Is there anyways? am using code below: <--photo --> <?php $query_img = mysql_query("SELECT `url` FROM `photos_news` WHERE title='{$thumn_content['titles']}' LIMIT 0,1"); while($img = mysql_fetch_array($query_img)){ ?> <img src="<?php...

How do I use window.fetch() with httpOnly cookies

javascript,dom,cookies,fetch
I'm playing around with window.fetch() in Firefox and Chrome. For some reasons, fetch() doesn't send any cookies. Now that wouldn't be a problem, as I can send them using fetch('/something', { headers: { Cookie: document.cookie } }) But this won't work for httpOnly cookies....

how to data store in mysql using form in php

php,mysql,fetch,sql-insert
I face a little problem. i cant find out problem in my code. My INSERT query is running fine but my data is not inserted in sql table using php form. when i run this code, my code cannot fatch the data which is filled by a user. Here is...

How can I combine multiple IMAP fetch commands?

java,javamail,imap,fetch,javax.mail
I'm using JavaMail to fetch data of messages from an IMAP account. For example, I use the following command to retrieve the bodies of the messages with uid 1 to 4: UID FETCH 1:4 BODY[] Is there a way to fetch specific body parts for specific messages? For example, I...

Ruby 2.1.3 options hash cannot be assigned with fetch

ruby,hash,fetch,options
Please explain to me why this is happening: def resizeImage(event_file, resize_width, resize_height, options = {}) puts options aspect_ratio = options.fetch(:maintain_aspect_ratio, true) puts aspect_ratio "return value" end resizeImage('event_file', 'resize_width', 'resize_height', {maintain_aspect_ratio: false} ) {:maintain_aspect_ratio=>false} false => "return value" I want to set a variable to = the fetch from the hash...

Mysql PDO : get row with “dynamic” fields in query

php,mysql,pdo,row,fetch
I have a query with a dynamic field, how do I access this field without knowing its name? define('FIELD_NAME',"name"); $stmt = $connexion->query('SELECT '.FIELD_NAME.' from mytable); while ($rs=$stmt->fetch(PDO::FETCH_OBJ)){ echo $rs->FIELD_NAME; // DOESN'T WORK echo $rs->name; // WORK } ...

Backbone.js collection fetch not setting response objects as models

backbone.js,collections,fetch
When fetching a collection, my api response has 10 objects, but the resulting Backbone collection only has 1 model with an attributes array containing the 10 response objects....to put it another way, the fetch is not creating models out of the objects in my response...and I don't know why. Model...

Fetch array after SELECT statement

python,mysql,arrays,fetch
I am trying to write a script that works with MySql. The script must select a row of a table and then print the result. This is the script: #! /usr/bin/env python import MySQLdb import sys id_room=sys.argv[1] connection = MySQLdb.connect("localhost","residente","pinkrabbits","domotica") cursor=connection.cursor() command="SELECT active FROM home WHERE id_room = " +...

CloudKit fetchRecordWithID error: “Fetching asset failed”

ios,fetch,cloudkit
I am trying to fetch a record with CloudKit and it fails with the following error: "Fetching asset failed" I confirmed (via the CloudKit Dashboard) that the record exists in my public database and the default zone and the default container (not a custom container). Here is my code: CKContainer...

What is the benefit of using PDO::FETCH_CLASS and when to use it [closed]

php,pdo,fetch
I wonder when do I have to use PDO::FETCH_CLASS and what is the benefit of using it rather than using other fetch method like PDO::FETCH_ASSOC?

Migrating to prepared statements

php,prepared-statement,fetch
I know that there are similar topics to this but they didn't helped me out, I want to migrate my code to prepared statements but I keep on getting errors or wrong answers. The plan is to get code like this: $sql = "SELECT * FROM our_videos ORDER BY datemade...

Location updates not received during Fetch background mode

ios,background,location,fetch
I'm using Selene to schedule background fetch tasks. During the fetch task I call requestAlwaysAuthorization and startUpdatingLocation on a CLLocationManager instance. When the fetch task is launched it can be seen on the status bar that location services are on, but the callback locationManager:didUpdateLocations: is not called. I have set...

How to connect from your iOS app to a backend server? how to read,modify and fetch data to backend server?

ios,objective-c,server,fetch,backend
I am new in developing iOS application. I like to learn communication between my app and an specific back-end server(which is written in ruby). I would like to learn how to read, fetch and modify data on back-end server? I do not have any idea that from where I should...

How to download a web directory when authentication is required?

linux,wget,fetch,ubuntu-14.04,web-folders
For instance, I want to fetch the entire folder3 from a web site http://something.com/folder1/folder2/folder3 I saw similar posts where the solution is given by wget. But in this case the web site ask me for user name and password, which I have. I tried to download the folder with wget...

React-native upload image to amazons s3

javascript,file-upload,amazon-s3,fetch,react-native
I want to upload images from my app to S3 server. I have all data and codes calculated (tested using curl on computer) but I can't figure out how to call 'fetch' correctly. I'm getting response: 'At least one of the pre-conditions you specified did not hold. Condition: Bucket POST...

Core Data - Accessing data in retrieved Managed Object (swift)

ios,swift,fetch,nsmanagedobject,nsfetchrequest
I'm trying to aces data in retrieved Managed Object. Xcode giving me error "Cannot subscript a value type "[AnyObject]?" with an index of type 'int'". Doesn anybody know what I sould do to? Thank you This is my method which saves data and which is called from my viewDidLoad method:...