Mika Jaaksi wrote:
I'm trying to show picture from database. Everything works until I add
variable into where part of the query.
It works with plain number. example ...WHERE id=11... ...picture is shown
on the page.
Here's the code that retrieves the picture. show_pic.php
?php
Thanks for the quick responce...
to Valentin Nedkov:
I have session_start() on another page. Session start gets band_id as a
value when user logs in.
I've tried to echo session variable on show_pic page and it works.
And I belive that I can't set default value for band_id because the picture
I
Still fighting with it...
So, these work:
$query=SELECT * FROM pic_upload;
$query=SELECT * FROM pic_upload WHERE band_id=11;
picture is shown on the other page
but when adding variable into query it doesn't show the picture on the other
page
$query=SELECT * FROM pic_upload WHERE
I tried
$query = SELECT * FROM pic_upload WHERE band_id =
'.$_SESSION['session_var'].' ;
didn't work.
And I've tried to echo session variable and it has right data in it.
I've also tried
band_id=$band_id
band_id='$band_id'
band_id=$band_id
band_id='{$band_id}'
band_id={$band_id}
Session
Okay, I added it and got this
SELECT * FROM pic_upload WHERE band_id=11
Seems to me that it's the way i should be.
For some mystical reason it still doesn't work...
Mika,
Put the dollar sign (i.e., $) outside the curly brace.
$query=SELECT * FROM pic_upload WHERE band_id='${band_id}';
A-
-Original Message-
From: Mika Jaaksi [mailto:mika.jaa...@gmail.com]
Sent: Thursday, February 12, 2009 12:27 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Re
Sorry, but this didn't work either
$query=SELECT * FROM pic_upload WHERE band_id='${band_id}';
Thanks to everybody who has tried to help...
Don't see session_start() in your script. If you work with SESSION, you
must have it on the first lines of the file (before any output and work
with $_SESSION so it's good to put it on the first lines).
And it must be in every file which works with them (except for included
files). It should
$band_id = 11;
$query=SELECT * FROM pic_upload WHERE band_id=$band_id;
print_r($_SESSION);
gives this:
Array ( [session_var] = 11 )
and picture is shown on the page
And about the session start: I have session start on the index2.php page
when user has logged in.
Page that should show the
*Answer to Rick:
in your code below it looks like you're simply hard-coding your
$band_id value (as 11) -- so of course it's going to work.
*Yes, I did that because one of you helpers asked me to try that.
I'll try to be clearer on whom I'm answering to...
With these:
$band_id = $_SESSION['session_var'];
echo band_id: . $band_id;
$query=SELECT * FROM pic_upload WHERE band_id=$band_id;
echo query: . $query;
I get these:
band_id: 11
query: SELECT * FROM pic_upload WHERE band_id=11
SQL injections: Are these what I should use?
$db = new
On Fri, Feb 13, 2009 at 6:01 PM, Mika Jaaksi mika.jaa...@gmail.com wrote:
With these:
$band_id = $_SESSION['session_var'];
echo band_id: . $band_id;
$query=SELECT * FROM pic_upload WHERE band_id=$band_id;
echo query: . $query;
I get these:
band_id: 11
query: SELECT * FROM pic_upload
snip
Forget to tell you, that if I used http://localhost http://localhost/
, the session running well...
But if I change with http://hostname http://hostname/ , the session
wasn't running...
/snip
http://localhost and http://hostname/ are 2 COMPLETELY different things and can
reflect
And I've forgot to mention the fact that my session_set_cookie_params
(); even if I've supplies a url and a domain, e.g.
$_SESSION['username'] = 'abc123';
session_set_cookie_params (time () + 3600, /myurl/, .mydomain.com);
And with session_get_cookie_params (); I don't even get any values as
Stuart,
I am fairly new to PHP, but it is my understanding that you have to run the
session_start() command on every page that you want to be part of the
session and to access the session variables.
Here is a link of a tutorial about using sessions:
http://www.phpfreaks.com/tutorials/41/3.php
Okay, I will read the tutorial. I also want to
clarify a bit more. I guess it's my intention to not
have the form session relying on the auth session,
since I want to expire the form session , either at
the end of the transaction or if user cancel out on
the form. So either the cookie or
Jacob,
Here is my solution.
At the top, it checks to see if you are passing a new name via a querystring.
If not, it checks to see if a name is present in the session yet. If not, it
initializes the session to Jacob. It puts the session's value into the variable
$view.
If you passed a name,
Hi,
Regarding the recent thread on sessions.
If you want cookies to expire after the user leaves
the sie or closes the browser do not leave the expiry
date emty. 9 times out of 10 the cookie will remain.
All you need to do is set a date that has passed.
Like 1st Jan 2000. Most set it way
Figured it out. I was trying to use the same associative
array under the form tag as I was trying to save under
the session. Using two different variable constructs worked.
Andy Cantrell wrote:
Working with storing and reusing session variables.
If I use t1.php to generate a form, and the form
Thanks for the responses. I ended up resolving this by fixing the
form destination. I had hard coded a location in there, and did not realize
this. Once I replaced this with the PHP variable everything magically
started to work. My bad on that. Thanks again for the feedback though.
As mentioned previously in this list,
$_SESSION and session_register, session_is_register, is not compatible with
each other.
Anyway, I used your idea as inspiration for my own code.. My code works..
Try to change From:
if (!session_is_registered(valid_user)) {
To:
if
Dear Bayu,
Sunday, January 12, 2003, 10:27:50 AM, you wrote:
BS it seem to me you didn't use session at all,
BS so where is the session problem?
yup now I use seesion,here my script [hope you ca help me]
?
include common.php;
include setup.php;
global $user_name, $user_pass;
banner();
function
Don't cross post such question...
All you need to understand is how cookie is managed unless
you are passing session id via URL.
Read RFC2965 and RFC2964.
You probably want to read netscape cookie spec also.
--
Yasuo Ohgaki
Youngie wrote:
Why would my session data not be deleted after my
Hayan AL Mamoun wrote:
try this
logon.phtml:
?
session_start();
$CLIENTID=SOMEVALUE;
session_register(CLIENTID);
header(Location: clients/editclient.phtml);
?
--
clients/editclient.phtml:
?
session_start();
echo CLient ID VALUE IS : $CLIENTID;
?
the deZayner
Hi Danny, you could use a cookie to store the user's username and password
once they first successfully login the first time or even better upon
signing up to your site. Then, on the login page(or whatever page is
displayed prompting a login) you could check for the cookie at the top and
redirect
Your solution sounds good. That's what I use too.
[EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Problem: hosts http://www.; and https://secure.; of the same domain need
to work with the same browser session_id. This is a
login/authenticate/redirect
Hi Hayan
Thechnically yes - for instance you could send it as a form hidden input.
But I wonder whether there is sense in it.
regards
Ivo
Hayan Al Mamoun [EMAIL PROTECTED] wrote in message
000401c1a8a9$838d4ee0$5e00a8c0@cybernation">news:000401c1a8a9$838d4ee0$5e00a8c0@cybernation...
Dear
i did something like that once. I passed the session variables using an encrypted
query string ( could be using a hidden input, anyway i think it is a good idea to
encrypt the value).
I didnt like it because of the unnecesary use of a second server, but i'm sure
sometimes you just have to go
There is no limit AFAIK if you are using the default 'files' handling code
for sessions, however if you're writing the session data to a database,
there will be a limit depending on the type of field you use to store the
data; i.e.: mysql text fields can store up to 64K
Hayan Al Mamoun [EMAIL
I realized that I was not doing a page_close();
In the other site, there is a footer that all pages use, that automatically
does this for me. I just forgot it. It had nothing to do with frames.
Just a dumb thing that I forgot.
Tjaybelt [EMAIL PROTECTED] wrote in message
[EMAIL
session_start() must be the first line of your script.
I hope this help.
Leila
Its Me [EMAIL PROTECTED] escreveu nas notícias de
mensagem:[EMAIL PROTECTED]
Cannot send session cache limiter - headers already sent (output started
at C:\apache\htdocs\mall\menu.php:9) in
I'm still at the start of trying to get to grips with PHP so these
comments should be treated with a healthy scepticism.
Most of the examples I have seen and used involving sessions will start
the session at the start of the script. If you want to continue checking
on a particular user's name
session_start();
should do it on the second page
Steve
Koutsogiannopoulos Karolos [EMAIL PROTECTED] wrote in
message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hello all...
i have the following script which checks a username and pass from a db and
if it is correct it starts a session..
33 matches
Mail list logo