Hi,
i am building a small forum site as my final year project & stuck in a very trivial problem.
I have a table which are varchar type of data & i am trying to fetch data from table based on some condition.
$query = 'select reply_Id, post_Id, replied_by, reply, date_of_reply from reply_info where reply_info.post _Id ='. $x;
as $x='pi_1';
here $x has string value & post_Id in table has varchar value & has the same value (for that column in table) as given to $x, but still this query execution is failing. it returns false for result.
Now if i dont give any where clause query fetches all the rows of table. I tried this to confirm if connection to data base is working fine.
this is really urgent..i have already wasted an hour in this :-(
thanks in advance.
1 1919 Markus 6,050
Recognized Expert Expert
There's nothing that sticks out at me, other than that IDs are generally stored as integers. Are you positive it's a VARCHAR?
When you're developing something, you should be debugging it. So, use mysql_error() if a query fails, to see why it failed. -
$query = "SELECT * FROM `tbl1` WHERE 1";
-
$query_result = mysql_query( $query ) or die ( mysql_error() );
-
As soon as the query is stored in $query_result, if there's an error, your page will die with the cause of the error displayed, e.g. 'tbl1 doesn't exist'.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Mike |
last post by:
Hello,
I have a few rather urgent questions that I hope someone can help with (I
need to figure this out prior to a meeting tomorrow.) First, a bit of
background: The company I work for is developing a web-based application,
one part of which involves allowing the user the ability to page through
transaction "history" information.
The _summary_ history table will have the following fields: ServiceName,
Date, User-Ref1, User-Ref2,...
|
by: Evan Smith |
last post by:
During a routine performance check using an event monitor, I
discovered a class of query whose performance has me baffled.
The monitor captured:
SELECT * FROM EWM_CASE fetch first 1 rows only
It took 14 seconds of CPU time to execute. After looking up the
documentation on the FETCH FIRST notation I find "Limiting the result
table to the first integer rows can improve performance. The database
|
by: Marc Mones |
last post by:
Hello,
I'working with IBM DB2 V8.1 and CLI/ODBC. I've got a problem with the
following
statement:
********************************************************************************
SELECT S_ART, S_SPRACHE, S_MANDANT, S_NR, S_SUB, S_OWNER, S_SATZ
FROM SY0001_00005
WHERE S_ART = ? AND S_SPRACHE = ? AND S_MANDANT = ? AND S_NR = ? AND
|
by: Peter Wang |
last post by:
I have a function and am using cursor. All the columns I select in the cursor clause are BYTEA datatype.
I need to compare the after-fetch-value for two BYTEA columns which is temp2 and temp3 shown as below.
I don't think I can compare it because there is no record in temp table which I use for debug purpose.
Does anyone know how to compare the after-fetched-value for two BYTEA datatype in pgsql's function?
CREATE OR REPLACE...
|
by: Acupuncture |
last post by:
Hi,
I am developing a JDBC application and I encountered this problem (DB2
for ISeries).
I want to do a select for update and also use the fetch first rows clause.
This is my sql statement:
SELECT UsrNbr, UsrPwd, UsrPwdChgD, UsrEmail, UsrChgUsrI, UsrChgDte FROM
USERS WHERE UsrNbr = ? FETCH FIRST 1 ROWS ONLY FOR UPDATE
This runs fine (the cursor gets this name 'P00022'), but when I execute the
| |
by: Mike Charney |
last post by:
I have a two part question:
First I want to insert data into a table and I am using the following
command:
INSERT INTO tblmain
SELECT field1, field2, etc...
FROM tblimport
WHERE ??????
The where clause is the part I am having trouble with. I want to only insert
|
by: Jane T |
last post by:
I appreciate how difficult it is to resolve a problem without all the
information but maybe someone has come across a similar problem.
I have an 'extract' table which has 1853 rows when I ask for all rows where
period_ = 3. The allocation table for info has 210 rows.
I have two scripts below. The first script where I specify a period on a
join, brings back 1853 lines and works. The second script where I specify
the period in the...
|
by: pks83 |
last post by:
Hi
I am relatively new to MSSQL.... when i am trying to fetch the data from table using this query.
update ticket set escalation=activity where escalation like '2008%31'
escalation and activity are both of datetime data type
Values in escalation column
|
by: arnuld |
last post by:
This program follows from the section 6.5 of K&R2 where authors created a
doubly-linked list using a binary-tree based approach. The only thing I
have rewritten myself is the getword function. I am using it because there
are many concepts involved in this program that I want to understand like:
1.) degree of efficiency of this program as compared to sort using hash-table
based approach.
2.) Keeping the program well structured so...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |