Skip to content
Advertisement

Tag: php

How to calculate win chance ticket in percentage

I’m trying to calculate a win chance from buying a freebies ticket in the percentage of each user that has been recorded in the database here is my freebies table the total number of tickets is 10 user id 60 have a 5 tickets user id 50 have a 3 tickets user 4 have 2 tickets so I want to

MYSQL table wont allow multiple foreign keys

I know this has been asked again and again, and I’ve tried so many times and don’t understand why I keep getting errors, but I’m trying to connect the order details table to the order items, users and payment table, but SQL is coming up with. (this is for a school project) I’ve been able to connect a table with

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

Joining Query with codeigniter Model

Please help me how can I get only response where activities.activity_id = response.activity_id? here is my CI_model My Activities table My Response Table My users table Answer Try with this: You need to add aliases to the tables in order to build a more simplified and ordered query, in this case the aliases are a, b and c. UPDATE: I

Slow SQL Query / Displaying (PHP / jQuery)

I have a request to get data in my mySQL database (36,848 entries). Then I format and append them with jQuery on my web page. These two operations take 2 minutes and 30 seconds. During this time, no other operation is possible on the page. Is there a way to optimize this to speed up the process? Like this, it’s

How can I change the grammar in mysql?

in my query result However, if you search after changing the trdDtTm format, the results will not come out. How do I fix it? no items.. how to fix it? Answer trdDtTm is a datetime column. compares a datetime with a number hence. This makes hardly sense. Maybe you hope for the DBMS to magically match the two, but you

Ajax request from PHP don’t return me an Array

I’m trying to return an array from a PHP script in Ajax, however, it seems to not work, it returns me a string rather an Array. I’m using CodeIgniter Framework, there is my .php code : And there is my Ajax request : My getAll() function just select all from the database, however i’m only using the temperature & date

Advertisement