execute a query in a loop to make another loop

Ok so what i am doing is getting member id's from 1 table and looping those ID's through another table to get values to output. I had it working going through the first loop, then notice the output was all screwy, so released I needed to loop it thro

MySQL query with conditions check

I have a table where it contains user details. Now I need to execute a MySQL query which satisfies the below conditions: There are two tables 1) user table - which contains userid,name,firstname 2) category table - which containts categoryid, categor

Import a very long list of strings into the MySQL database

I have a very, very long list of words, each on a new line. Like so: abactor abaculi abaculus abacus abacuses abada ... ... ... zythum zyzzyva zyzzyvas I want to import all these words in a MySql Database. What would be the most effective method to d

Group by MySQL Query returning specific results with parameters

Before a user starts a private chat (between 2 members, not a group chat) I want to check and see if there is already a chat consisting of only these two members. In case they've deleted the chat on their end, when they go to message that same user a

Looking for help to make a dynamic select statement with mysqli

Makeing a dynamic select statement with mysqli (PHP) Hello. Iam working on a simple crud system that i can use for my exam, my problem is: I want to make a dynamic select statement that can select whatever table i ask for, same with table columns in

SELECT if 2 cells in a row are equal (MySQL)

Tried to show it as simple as possible. I want to SELECT Subject if 2 cells in a row are equal (MySQL) Table --------------------------------------------- Subject --- username --- Lastpostername --------------------------------------------- subject A

Wamp, PHP MySQL - connection error

I've installed a WAMP server. Now I want to connect to a MySQL database using php. I have one problem you need to get the username. This is the code I use. Its from php.net http://php.net/manual/en/mysqli.quickstart.connections.php <?php $db_host = &qu

Get an error with mysqli_query ()

This question already has an answer here: Warning: mysqli_query() expects parameter 1 to be mysqli, null given in 4 answers I am getting this type of error: Warning: mysqli_query() expects parameter 1 to be mysqli, null given in What i've been doing

PHP update form with mysqli

I'm new to PHP, I need some help here. I have created a form called Home.php which accepts ID,name & file upload as inputs and it adds into mysql. Its adding successfully. I want to perform update operation so that if a user wants to update any of th

Update the MySQL query based on $ _POST values

I am having trouble thinking out a good way to update my query depending on user $_POST values. Basically I have user management search button, where site administrator can search for his sites users. In my example: <div id="website_user_managemen

How to delete old records from my database using Mysqli?

I'm creating an online noticeboard and I would like to find out how to delete old notices a day after they have been put up so it doesn't clutter the noticeboard. I have no code for it atm because I don't have a clue how to do it. Any help would be a

Correct way to pass a PHP $ variable to MySQLI

This question already has an answer here: How can I prevent SQL injection in PHP? 28 answers I am wondering about the safe or correct way to pass a $variable to a query. I am new to PHP thats why I am asking such beginner question. Here is the exampl

Mysqli query and select db warnings

So I have this code and my browser is giving me warnings. The code is here: 47 mysqli_select_db($database_connHotel, $connHotel); 48 $Result1 = mysqli_query($insertSQL, $connHotel) or die(mysqli_error($connHotel)); The warnings are here: Warning: mys

php do not connect to mysql or reply

I have a php script I wrote and it will not return anything except "Hello". <?php echo "Hello"; $username = "me"; $password = "password"; $hostname = "localhost"; $dbname = "dbname"; //connect

Note: A numeric value not well formed has been encountered

This question already has an answer here: PHP: "non well formed numeric value encountered" 3 answers I have the following code and error. So please give me some suggestion how to resolve this? include('config/setup.php'); $query="select * f

Change the mysqli query by typing

I have been researching this for a while and can't seem to find any good solutions so I thought I would see if anyone here has done this before that has a simple solution. Is there a way to update the query as someone is typing in the input box? The

assign data from a table to a specific table (group)

I have a classrooms in schools and when I click on a certain classroom, I want to add students into it but my actual code is doing something stupid. It adds a student but i can see the student in all classrooms, not just in the one that i added him i

Login has suddenly stopped working

I'm working on my school project and I need a simple login functionality. It was working 20 minutes ago but then I perhaps made some mistake. It doesn't show any error message. The database seems to be alright. 'jmeno' = name, 'heslo' = password <?ph

The location of the HTTP header does not work

This question already has an answer here: header location doesn't work and still in protect page 2 answers This code use protect function . to do permission access level header location doesn't work and I look at address bar found it still in protect

PHP - redirect to another page if there is no result

I would like to redirect the user to other page if there are no results. what I meant like is, I am passing variables via url and using on the second page and if the the variables are empty I am able to redirect to another page. However when the user

MySQL: Produce a list of people who have more than one object

Say I have a table of people... person: ----------- id | person ---+------- 1 | Jim 2 | Bob 3 | Frank ...and I have a table of items... item: ---------------- id | item | type ---+------+----- 1 | 21 | 2 2 | 10 | 5 3 | 11 | 1 4 | 9 | 1 ...and I also

Check the email exists with php mysqli

I am new to mysqli i wanted to check if email already exists in database with php and mysqli Here is what i have done so far: ini.php <?php session_start(); require 'connect.php'; include 'user.func.php'; ?> connect.php <?php $con = new mysqli('h

PHP linking a wildcard

Hope Somebody will help me about how I bind a parameter in mysqli when a multiple character wildcard needs to be next to the variable value. I found that it worked for me when creating a SQL statement, like this: $sql = "SELECT item_title FROM item W

Mysqli: loop requests

I need to perform 'n' unions using mysqli (where n changes based on user input). For instance: select a from b where a=c[1] UNION select a from b where a=c[2] ... UNION select a from b where a=c[n] Is there anyway to do this iteratively? Something li

Limit the registry as ROWNUM in MS SQL Server 2000

I want to know how to limit records in SQL Server 2000. In Oracle, I already wrote a SQL query like that. <cfquery name="myQuery" datasource="myDSN"> SELECT * from tbl where rownum <= 10 </cfquery> In SQL Server 2000, I