473,569 Members | 2,692 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

This query returns BLANK with PHP!

ifedi
60 New Member
I've a project (medical stuff based on PHP/apache) where I need to run this query:
Expand|Select|Wrap|Line Numbers
  1. SELECT CONCAT_WS(" ", CONCAT(pregNo,':'),  del_year, MONTHNAME(CONCAT('2000-',del_month,'-01')), concat('@',ga,'wk'), CONCAT('in', UCWORDS(place)), IF(fetal_no = 1, "Singleton", IF(fetal_no=2, 'Twins', IF(fetal_no > 2, 'Multiple' , '')) ) , CONCAT(labour_length, 'hrs'), CONCAT('Onset: ',onset), CONCAT('Complications: ',an_complications), CONCAT('lasted: ',labour_length), CONCAT('Third Stage:',third_stage), IF(bld_trans, 'Transfused', ''), CONCAT('Perineum:',perineum), CONCAT('Hospitalized for: ', hosp_duration, 'days')) phrase FROM hx_obsdetails WHERE hx_id=2
  2.  
Problem is this query returns blank; absolutely nothing in the result set. No error message or number.
To crosscheck, I pasted this in phpmyadmin query window, no problem. I pasted this in MySQL Command Line Client, no problem. Back to PHP, my script just went blank from that point down. No message from either MySql or PHP.
I need serious help, please.
Ifedi.
Feb 23 '10 #1
1 2322
ifedi
60 New Member
The problem was the double quotes!
I just realized that the double-quotes within CONCAT_WS(" " and that enclosing "Singleton" were conflicting with the double-quotes enclosing the entire query statement. They needed to be either escaped or converted to single quotes. I did the latter.
Thanks anyway.
Feb 23 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
5380
by: joemyre | last post by:
Hi everyone, What I'm trying to do is take php variables i got from user input, and pass them as the MySQL query terms. $query = "select * from ident where ".$searchtype1."=".$searchterm1.""; ERROR: Invalid query: You have an error in your SQL syntax near '=' at line 1
14
4837
by: Justin Kozuch | last post by:
Hi All, I have created the beginnings of an RSVP script so that people can confirm/decline an invitation I send via email. When they go to the RSVP script, (www.site.com/rsvp.php), they enter their email address in the textfield (called email). The email entered is validated against the email address in the database. If the validation...
3
4398
by: 'bonehead | last post by:
Greetings, I'd like to figure out some syntax for retrieving the data from a table when I don't know all the of field names. What I do know are, the name of the table, the names of the primary key fields, and the names of the fields I want to use in the "where" clause of the SELECT statement. All of the examples I've seen in my books only...
5
4614
by: Phillip T. Murphy | last post by:
Well, after half pulling my hair out messing with this, I am thinking it is not possible. I did research and found references to "sub-queries" not possible in MySQL (I am using 4.0.18-32 with PHP 4). But, not sure if I am breaking that rule or not. Psuedo code of what I am trying to do... <?php $sql = "select * from table1";
3
4587
by: Tom Mitchell | last post by:
All: I'm stumped on a query. How do I find duplicates in a table where one of the duplicates has values is a certain field and the other doesn't. For example, I have the following table: tblItems ItemID ItemLabel
4
1563
by: svein.tjonndal | last post by:
I have the following query: select DATE_FORMAT(accountingdate,"%c") as month,sum(totalprice - freightcost - insurancecost - vat2 - vat3 - vat4) as totalprice from invoice where cancelled=0 and deliveryagentid=0 and (employeeid=0 or employeeid=37 or employeeid=53 or employeeid=50) and DATE_FORMAT(accountingdate,"%Y")="2005" group by month...
6
4854
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of the html page controls the form fields that are required. It doesn't function like it's supposed to and I can leave all the fields blank and it still...
1
4202
by: Jimbo | last post by:
I have a query..if you look at the bottom of the where clause you'll see an "NOT IN" statement that is really hanging up the query..i'm trying to replace with a "NOT EXISTS" but it isnt appearing to work...I need to get a result set where the email address of the outter most query is not in that sub query...thanks: -->Code Begins Here ...
8
2337
by: kumarboston | last post by:
Hi All, I have a mysql database and 3 pages which queries and returns the data. 1st page(main.html) is just a form in html which takes query from the user and is connected to "form action="index.php"". 2nd page(index.php) has the mysql queries and gives a brief information(one line) about the user query. Now the index.php has a hyperlink to the...
1
1444
by: helraizer1 | last post by:
Hi folks, I am making a solution to a problem using access, I have a query that is SELECT * FROM tblMembers WHERE (((tblMembers.CustomerID)=Forms!frmLogin!)); I have then got a form (frmMembers) that loads the data from it.
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7673
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1213
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.