0
votes
3answers
88 views

MySQL row count > 1 but SELECT only returns 1? [closed]

I have a simple MySQL query with PDO, which is SELECT * FROM table WHERE variable=:variable, and then I execute it. I grab the affected row count with the rowCount(); function, and that returns 20, ...
-4
votes
0answers
46 views

PHP MySQL loop with two query [closed]

I have to do a SELECT * FROM table_X , the problem is table_X is the result of another query, so I want something like this : <?php $query1 = $bdd->("SELECT * FROM table_ref"); While ($data ...
1
vote
3answers
55 views

mysql query within a mysql query

I'm trying to display information from a table in my database in a loop, but for certain information, I'm referencing other tables. When I try to get data from other tables, any data following will ...
2
votes
2answers
45 views

Multiple ORs and one AND result - Is the AND being applied to each OR?

I have a basic query I am using to do some testing, and I was hoping for some feedback on whether my results are ok. I did cross check my results from about 100 records, and all seems fine, but I am ...
2
votes
2answers
73 views

PHP: Two mysql_fetch_array in table

I'm creating a table with data from two queries and tried to connect them in a table. Tried using something like this : $counter = 1; echo '<table border="0" cellpadding="0" ...
0
votes
1answer
68 views

While loop using only mysql query language

I have some trigger to save call records as blob into database. I want to add some extra function that will execute each time with trigger and will help to keep database in some size limits: function ...
0
votes
3answers
92 views

PHP while loop not showing first item?

I'm just trying to show a basic list or items from my database but for some reason its not showing the first item so if there is only one thing in a category it doesn't show anything but if there's 2 ...
0
votes
3answers
89 views

repeating a button in a php while loop

The following is a markup I have for displaying my database: $html = ''; $database_enquiry = tep_db_query("(relevant database enquiry in here)"); while ($database = ...
1
vote
1answer
101 views

Run While Loop Through All Distinct Values of A Column

This is an example MYSQL result +----+---+ | A | B | +----+---+ | 1 | 1 | | 1 | 2 | | 2 | 3 | | 2 | 4 | | 3 | 5 | +----+---+ I would like to run through every distinct in Column A and do ...
0
votes
0answers
40 views

How do I output a .txt file based on records count limit set per file [closed]

I am outputting a .txt file based on a MySQL query. This is all working perfectly fine when I output a stand alone file, but I need to limit the amount of records per output file to 10,000. I cannot ...
0
votes
1answer
560 views

How to create PHP Mysql daily report without duplicating agent name?

Table Structure bill CREATE TABLE IF NOT EXISTS `bill` ( `id` int(11) NOT NULL AUTO_INCREMENT, `agent_id` int(11) NOT NULL, `date` date NOT NULL, `amount` int(100) NOT NULL, `cheque` ...
0
votes
1answer
48 views

mysql query ironing one search result on webpage?

My query printed on webpage SELECT * FROM products WHERE (product_name like '%meat%' OR description like '%meat%' OR ingradients like '%meat%') AND hide!=1 ORDER BY id ASC If I run the same query ...
0
votes
1answer
48 views

mysqli_fetch_array starting the query on a certain row

I am trying to create pagination on some pages that display rows from a MySQL table. Each page displays six items from the table. I am using a while loop with: $row_users = ...
0
votes
4answers
587 views

while ($row=mysql_fetch_array($result)) is not working

I'm using the below code to get some data. $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { $data[] = array( $row['Qty'], ...
0
votes
2answers
127 views

Appending MySQL Results Together in a PHP Loop

Using PHP, for-each row in a MySQL query's result set, I need to execute another MySQL query. So far, I've got $result = mysql_query("SELECT id, state FROM states WHERE region='given_region'") or ...
0
votes
2answers
58 views

Wordpress: not stops or resets query

I am adding post thumbnail jquery slider to header part but it's resulting weird issue. It is somehow not ending while or stop query and so if I will go to single post or page it is keep displaying ...
0
votes
1answer
134 views

PHP: Variable/Value only available inside loop - using it outside?

I've already asked this question on wordpress.stackexchange.com but they told me this is a plain PHP question and might have nothing to do with wordpress. I have a fairly big problem with a function ...
1
vote
1answer
114 views

List all the Community Members in PHP with MySQL Query

i want to list all the members of my website, in my index page, but i dont know how to do, i tried with while loop but it turns into infinite loop because i just tell it to while its smaller than ...
-1
votes
2answers
168 views

While loop php arrays

I have three php arrays that i am filling up with information returned from a msql query. The first two arrays fill up perfectly with the information need but the last array does not fill up. The ...
1
vote
3answers
217 views

Convert SQL columns to rows with an ID

I have data that is 192 separate columns. They are column pairs so that there is data for a 15 minute time slice and a quality control number. The way it is setup now each row represents a single ...
0
votes
2answers
90 views

My loop from mysql_fetch_array() does not output any answers. Any suggestions?

Here is the following code that I have running. The database.php contains a function called fetch_array(). fetch_array() contains mysql_fetch_array() within its function and returns the result of ...
0
votes
1answer
91 views

Combine several SQL querys to one

I know this is probably really simple but I have tried to find some similar examples and failed. The problem is that I would like to list 8 random images from a gallery in a database, sorted by ...
0
votes
1answer
206 views

Show query results in separate divs when section id changes

I have a query mysql_select_db($database_auditing, $auditing); $query_sections3 = sprintf("SELECT tblanswer.questionid AS answerqid, tblanswer.answerid AS answerid, ...
0
votes
1answer
96 views

PHP mysql_query nested loops or duplicate reference

I have a relatively simple program which displays information and activity of users which - due to the architecture of the program requires referencing lots of different data in different ways. For ...
0
votes
3answers
463 views

PHP getting variables outside while loop

earlier i posted a question about getting a single constant value from a loop and use it outside of the loop (reference : Question). now i'm facing another problem with another while loop. it goes ...
1
vote
1answer
94 views

How to prevent words from repeating in a “echo” command?

I have this weird situation that i have encountered for the first time and given my new status in PHP its even more confusing. In the query below the word "asked by" repeats more times than it ...
1
vote
4answers
109 views

PHP, While in While

I'm going to try to tell you what I'm about to do with this code. I'm creating a table with in de first column the names of the users followed by the amount of days in the current month (each day in ...
2
votes
2answers
166 views

What is the usefulness of checking num_rows before while loop after SELECT query?

In many scripts, programmers check if the SELECT query has returned any record before running the corresponding while loop as $result=mysql_query("SELECT * From table WHERE column='XX'"); ...
0
votes
2answers
393 views

PHP MYSQL - Multiple Slect Queriers returned in while loop

I have the following code which works fine however historically and again now I want to(if possible) add a third select statement to collect further information and return it in my while loop i.e. as ...
0
votes
3answers
145 views

MYSQL define certain column in mysql_query array?

When I'm selecting from multiple tables that share column names is there a way I can return both, but define which one I want to select the data from? for instance: Both tables contain "date" ...
-1
votes
1answer
382 views

while() loop array merge() accessing those values outside of the while() in array form $row['field_name']

This while parses my query. The $merge var contains the exact structure I need. What I am trying to do is take the $merge data and process it as an array and get each value in a $row[0], $row[1], ...
1
vote
1answer
129 views

PHP MYSQL loop to check if LicenseID Values are contained in mysql DB [closed]

I have some troubles to find the right loop to check if some values are contained in mysql DB. I'm making a software and i want add license ID. Each User has x keys to use. Now when the user start ...
0
votes
1answer
385 views

Running Query inside WHILE/Loop

Need help here, got a query that counts number of rows for each member and emails it to them. So right now they get a simple email telling them how many posts they have, I have searched for a way to ...
2
votes
1answer
96 views

One of my queries now only returns one record after working fine for 10 years - I did not change any code

I've had a mysql database on my website for about 10 years. I recently (5 or 6 months) ago had to upgrade to version 5.x and did so without any problems. My database uses four tables and has been ...
1
vote
1answer
162 views

PHP/MySQL Query, Count & Output problem

I have a MySQL database with a games table. I also have publishers and developers tables. Each row in the games table has publisher and developer columns, which correspond with the other two tables. ...
0
votes
1answer
699 views

can I run an sql query inside a while statement that refers to another sql query in its condition area?

My code is as follows while ($row = mysql_fetch_assoc($result)) { $active_bid_ids = array_unique($row); $item_id = $active_bid_ids['item_id']; echo $item_id; echo '<br />'; ...
-1
votes
1answer
127 views

How do I echo mySQL rows separately?

I'm pulling rows from a table in the database: title and COUNT(id) AS 'count'. There are two things that I want to accomplish. The first is being accomplished by echoing $row['title'] and ...
0
votes
1answer
548 views

Display all records for mySQL field and count how many times they appear for specific date

My desired result is to display how many times each video (title) was watched for specific dates, by grabbing all of the titles that appear in the table, and count how many times that title is ...
0
votes
2answers
87 views

How do I group rows with same time from mysql query?

I have the following code: //set $message and run database query $message .= '<body style="margin: 0;">'; $message .= '<div style="padding: 0 20px;">'; $message .= '<span ...
0
votes
2answers
1k views

How do I email results of php mysql query in while loop?

I have created a file called 'userhistoryreport.php'. It will be setup to run once a day. The purpose of the file is to gather contact information and history for users who have interacted with the ...
0
votes
6answers
402 views

MySQL SELECT w/ two AS id field names using php while mysql_fetch_array() to identify them uniquely

I am running a SELECT query and it has a.id and c.id like so: $sql = " (SELECT a.id, a.Title, a.Category, c.id, c.cateName FROM ads_list AS a LEFT JOIN ads_cate AS c ON c.id=a.Category WHERE ...
0
votes
1answer
715 views

MySQL SELECT while UPDATE

I wrote a query, and Im sure that it was right form. But I get an error. :) May I do this query else? UPDATE pages SET p_name = 'Activites', p_active = 1, p_parent = 'sport', ...
1
vote
1answer
308 views

Need help coding a loop in VB.net to create folders in windows based on usernames in remote sql db

I already have this coded out (more or less) in Java for Linux OS, however I am not familiar enough with the syntax of .net to translate my Java code into VB2010 code... So I was hoping someone here ...
2
votes
2answers
1k views

SQL Query based on a while loop

I am trying to construct an sql query using a while loop that increments a datetime by one minute each iteration and then generates a select statement based on the time: declare @dt datetime set @dt ...
0
votes
1answer
573 views

Trying to query multiple posts with WP_Query

I have a custom field in my posts so the admin can enter a list of specific post ids they want included for the related content section in the sidebar. I am trying to insert the variable into my ...
2
votes
4answers
510 views

php mysql query with a loop in it

I'm trying to retrieve the results of users in my database, and then if my checkbox is selected to retrieve only users who have photos to show those results, but I can't seem to figure out how to loop ...
1
vote
1answer
337 views

Mysql query dependant on another query vs. join

Stuck! So I've been researching how to run a query based on the result of another query and understand that it's not efficient (and I don't get the result I'd expect.) Here's the info I have: I ...
2
votes
2answers
2k views

php while() loop within if / else not seeming to work

I've been confused about why this wont work! My query executes perfectly fine in all aspects, but when I added the if check on the $row value, the echo message goes as expected (if there are no ...
0
votes
2answers
369 views

MySQL: PHP while with query and another while with query, how to improve?

Guys I have this query, that gets a keyword, and searches in DB for an array of articles to show according that keyword query results, then I need to fetch information about those articles according ...
1
vote
2answers
611 views

The results of 2 queries in one while loop

I want to plot three dataseries in jquery flot the first two series are the snowdepth in the last 10 weeks (upper and lower mountain). The last one is the snowdepth for the upper slopes one year ...

1 2
15 30 50 per page