Skip to content
Advertisement

Tag: sql

SQL – Selecting a users conversation based on members

I am trying to formulate a query to select a conversation based on members passed in, this can be many participants. Users can have multiple conversation with the same users in, and they can rename conversations. Here is my messages members table: And the messages relation table: Messages table for reference: My latest solution is not working right as it

Display SQL query result on front-end WordPress site

I am trying to get the total data (SUM) within a column in a Wordpress database. I am using the following SQL (and PHP) code to run the request; however, I do not know how to display the result on the front end of my site. or I have tried using print_r($avg_items_purchased); and var_dump($avg_items_purchased); but it outputs more information than

get value from select inside $post request

Could someone help my with an issue I have? I have made an select list with different options, based on the option the user did choice I want to run a certain function so i can later show the data which i have already saved in my database. However how do I do this? right now I have been working

SQL (sqlsrv) Cursor not finishing when execute from PHP

The SQL code below works great in MSSQL but when called via php it only outputs roughly half the results. I have tried placing this in a stored procedure and executing from php but that produces the same result as well. It should be inserting 150 rows, but I am getting only 77, sometimes 78, but it is always one

Bulk move 20000 post_meta value to wp_content with mysql command

I have more than 1 million Wordpress article, I want to achieve the following effect through mysql: copy the post_meta key value named views to wp_content field. I know how to insert value from table wp_posts to table wp_postmeta, but how to move value from wp_postmeta to wp_posts? I used code like this: but get error messge: ERROR 1054 (42S22):

PHP categories showing only one item

I’m trying to create a categories list, where user will be able to choose item with certain category, but as soon as I’m opening any of the categories, where “soon = ‘2’”, there is only one item coming up. Everything else works. The code bellow is for categories, where user can chose which caegory s/he want to see. Than here

Use of Complex (curly) Syntax in external file

I am having a problem with getting an sql query to interpolate as I would want, and would be grateful for some help please. Within the manual page for pg_query_params,there is a code example for pg_query() passing a variable using curly braces. This appeared to be exactly what I need for my task. So, my code is as follows: The

Advertisement