473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Building queries with session variables

I'm quite new to PHP so apologies if this is a really simple problem.
I'm using a session variable to store a userID after login and trying
to build a query using this variable. I have session_start() at the top
of each page and have registered the variable like so ($username is an
e-mail address taken from some user input)...

$user=$username;
session_register("user");

By echoing it on each page I can see that the $user session variable is
correctly passed through several pages (where it doesn't get used), but
when I come to actually use it to build a query using the following
line of code...

$getmovlist="SELECT movTitle, movYear FROM movie WHERE movID=(SELECT
movID FROM fMovie WHERE uID='" .$user ."')";

.... the query which is constructed is...

SELECT movTitle, movYear FROM movie WHERE movID=(SELECT movID FROM
fMovie WHERE uID='cxi03u')

which returns nothing as the end of the email address (@cs.nott.ac.uk)
has been cut off. If I echo the variable before inserting it into the
query it outputs the variable correctly (cx****@cs.nott.ac.uk)
alongside the incorrect query, but then if I refresh the page the value
of the variable has changed to cxi03u.

Feb 13 '06 #1
0 1041

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bernd Kohler | last post by:
Hello, some little questions relating LAMP (PHP 4.3.4, MySQL 3.x, Apache): I'm trying to build a community website which needs many db-querys for lots of concurrent users. Therefore I'm always...
6
by: Al Jones | last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate group would you point me toward one that is. Basically, I seem to be losing session data part way though preparing an...
10
by: tshad | last post by:
I have been using the default session state (InProc) and have found that I have been loosing my information after a period of time (normally 20 minutes). Is there anyway to find out how much...
1
by: Řyvind Isaksen | last post by:
When I build my project/solution all session-variables is deleted. This will be a problem for all users that currently is logged in because my solution show data for the spesific user based on the...
18
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that...
6
by: ARC | last post by:
I'm almost ready to build an upgrade routine for a commercial app that will need to import data from an existing Access 97 back-end database to an Access 2007 back-end blank database. Ideally, it...
10
by: marting | last post by:
Before I throw my new expensive laptop out of the window! I'm stuck on getting my joins right with the correct amount in a column count. After speaking with someone a few weeks back, they...
6
by: thenagus | last post by:
I am working on a youth rights website, and while working on the membership application, I receive an datatype mismatch error. I have pinpointed the error to be related to checkbox values. All...
8
by: Brett | last post by:
I wrote an ASP.NET application that queries a SQL Server database (on a different box from the web server) and displays the result in a GridView. The datasource for the GridView is a SQLDataSource....
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
tracyyun
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...
0
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,...

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.