Before you misread the title… I’m not asking how to echo the number of rows, I’m simply looking to find the position that the row is in. Let’s say we have five total rows: Now I’d like to get the position of the row that contains the post ID of 718. From looking at the data, we can visually see
Tag: php
How can I use an SQL query’s result for the WHERE clause of another query?
Okay, basically I have a table that contains statements like: I would like to use the contents from this table to generate other tables that fulfill the conditions expressed in this one. So I would need to make it something like But the last part of the where has to come from the first table. Right now what I’m trying
How to fetch all values of a column based on value of another column in same table?
I got the following structure: How to fetch all values by taking the $_SESSION[‘admin’][‘id’], finding the country_id of that admin and getting all other admin_id and country_id that are the same of the session admin? So, lets say the currently logged in admin has id = 5 , that means the admin_id: 5 has two country_id: 1 and 62. I
Search function on multiple rows in the same table
I’m wondering how do I add more row’s on my search script to be searched. Here’s my php script: As you can see this: I want to it to search on region and rank rows. I tried: …. it’s showing 0 results. Thank you in advance. Answer Is this what you want? This searches for the parameter in both columns
Loop runs until the condition is met but insert statement is being used only once
I am trying to create an Expense Management system where I will be able to schedule future expenses if the user selects frequency like daily, weekly, monthly etc. To achieve this, I have created a …
How to update rows with new values for groups found and make this as fast as posible?
I have a table which have these fields: id, client_id, visit_id, number_of_visit. This table can have from 30k to 100+k rows of data. The primary key is client_id and visit_id. (I cannot have a row with these two values being the same, but meanwhile client_id can appear more than 1 time having different visit_ids and so on). The thing I
Eloquent hasMany doesn’t load collection
I’m relatively new to eloquent, and have problems loading data from a hasMany relation in an app that uses eloquent as the database layer. My (simplified) code is as follows: The SQL Schema is like below I then do the following query: This results in a json like the following Raw SQL query shows me that I do have data
SQL Server Time Format is not equal to Client Side Time format
I’m trying to compare the client side time format (“14:00”) to SQL Server time format (“14:00:00.0000000″) with SQL Query, technically is not equal because SQL Server time format has seconds and milliseconds, so I tried to concatenate the seconds and milliseconds to client side time format in PHP script like this 14:00.”:00.0000000″ and yet is not equal to SQL Server
Need to fetch all users that logged in user is following as an objects
I am building handmade MVC framework, and I want to implement following system (Like Twitter) so User that is signed in can follow another user and when that signed in user visits his profile he can see all other users that he is following and vice versa. I am not sure which query to apply in order to fetch all
Problem with identifying index in php html
My website must consist of a page with table where admin must upload some file. Later that file is saved by php as a blob in mysql, however, $_FILES cannot find and index of my file input. Please help finding a mistake. PHP code Answer Apart from security flaws in your code you are missing enctype=’multipart/form-data’ inside the form element.