I have a site where a user logs in and a session variable I created
is used to keep track of the fact that the user is logged in. This
various pages query a MySQL database to get information (mostly to
generate a catalogue and news page). Occasionally when loading a page I
simply get the error "No database selected" when the PHP script attempts
to run the query. Usually I can press reload in my browser (Netscape,
IE, and Opera) and the page will work. Sometimes it won't. What may be
causing this error? The header, if it helps, from most of my PHP scripts
is as follows:
<?php
require_once('C onnections/cwab.php');
include ('test-include.php');
session_cache_l imiter('nocache ');
session_name ("cwautobodyphp session");
session_start() ;
?>
Thanks for any insight as to what may be causing this.
--
- Michael J. Astrauskas 3 2088
Michael J. Astrauskas wrote: I have a site where a user logs in and a session variable I created is used to keep track of the fact that the user is logged in. This various pages query a MySQL database to get information (mostly to generate a catalogue and news page). Occasionally when loading a page I simply get the error "No database selected" when the PHP script attempts to run the query. Usually I can press reload in my browser (Netscape, IE, and Opera) and the page will work. Sometimes it won't. What may be causing this error? The header, if it helps, from most of my PHP scripts is as follows:
<?php require_once('C onnections/cwab.php'); include ('test-include.php');
session_cache_l imiter('nocache '); session_name ("cwautobodyphp session"); session_start() ; ?>
Thanks for any insight as to what may be causing this.
I would guess that you have your database name stored as a session
variable, and that you use this to read/write to your tables. I would
guess that this 'interaction' is somewhere in cwab.php or
test-include.php - Because you've not supplied to code to these
functions, I cannot be sure, nor come up with a suggestion of a fix...
however...
As a work around, you could preceed the table name with the database
name using a period where ever you perform your
select/update/insert/whatever.
Thus if your database was called thetimes and your table was called
subscriptions, and you were looking for a firstname, you might have
SELECT firstname FROM subscriptions WHERE login='randelld ' LIMIT 1;
If this was the case, I'd suggest you change it to
SELECT firstname FROM thetimes.subscr iptions WHERE login='randelld ' LIMIT 1;
Does that help any?
randelld
Reply-Via-Newsgroup Thanks wrote: Michael J. Astrauskas wrote:
I have a site where a user logs in and a session variable I created is used to keep track of the fact that the user is logged in. This various pages query a MySQL database to get information (mostly to generate a catalogue and news page). Occasionally when loading a page I simply get the error "No database selected" when the PHP script attempts to run the query. Usually I can press reload in my browser (Netscape, IE, and Opera) and the page will work. Sometimes it won't. What may be causing this error? The header, if it helps, from most of my PHP scripts is as follows:
<?php require_once('C onnections/cwab.php'); include ('test-include.php'); session_cache_l imiter('nocache '); session_name ("cwautobodyphp session"); session_start() ; ?>
Thanks for any insight as to what may be causing this.
I would guess that you have your database name stored as a session variable, and that you use this to read/write to your tables. I would guess that this 'interaction' is somewhere in cwab.php or test-include.php - Because you've not supplied to code to these functions, I cannot be sure, nor come up with a suggestion of a fix... however...
As a work around, you could preceed the table name with the database name using a period where ever you perform your select/update/insert/whatever.
Thus if your database was called thetimes and your table was called subscriptions, and you were looking for a firstname, you might have
SELECT firstname FROM subscriptions WHERE login='randelld ' LIMIT 1;
If this was the case, I'd suggest you change it to
SELECT firstname FROM thetimes.subscr iptions WHERE login='randelld ' LIMIT 1;
Does that help any? randelld
After playing with it for 15 minutes it seems to work... so far. I'll
give you an update later today if it works completely. Thank you so far!
cwab.php is a MySQL connection script written by Dreamweaver. It's as
follows (names changed to protect the innocent):
<?php
# FileName="Conne ction_php_mysql .htm"
# Type="MYSQL"
# HTTP="true"
$hostname_cwab = "localhost" ;
$database_cwab = "cwab_com";
$username_cwab = "blah";
$password_cwab = "blah";
$cwab = mysql_pconnect( $hostname_cwab, $username_cwab,
$password_cwab) or die(mysql_error ());
?>
I'm fairly certain it doesn't die at the above mysql_pconnect as the
page title appears *before* the error does, meaning a later MySQL call
had an error. I believe it's dying when I call mysql_query, but I don't
know why. And example call is below:
$parts = mysql_query($qu ery_parts, $cwab) or die(mysql_error ());
where $query_parts is some (tested) valid MySQL query.
Since the scope of require_once is that particular script, cwab.php
will be loaded every time my page is loaded for a single user, correct?
test-include.php is a series of functions I've written that don't
interact with the database or variables pointing to it at all. It's long
and uninteresting.
--
- Michael J. Astrauskas
Michael J. Astrauskas wrote: Reply-Via-Newsgroup Thanks wrote:
Michael J. Astrauskas wrote:
I have a site where a user logs in and a session variable I created is used to keep track of the fact that the user is logged in. This various pages query a MySQL database to get information (mostly to generate a catalogue and news page). Occasionally when loading a page I simply get the error "No database selected" when the PHP script attempts to run the query. Usually I can press reload in my browser (Netscape, IE, and Opera) and the page will work. Sometimes it won't. What may be causing this error? The header, if it helps, from most of my PHP scripts is as follows:
<?php require_once('C onnections/cwab.php'); include ('test-include.php'); session_cache_l imiter('nocache '); session_name ("cwautobodyphp session"); session_start() ; ?>
Thanks for any insight as to what may be causing this.
I would guess that you have your database name stored as a session variable, and that you use this to read/write to your tables. I would guess that this 'interaction' is somewhere in cwab.php or test-include.php - Because you've not supplied to code to these functions, I cannot be sure, nor come up with a suggestion of a fix... however...
As a work around, you could preceed the table name with the database name using a period where ever you perform your select/update/insert/whatever.
Thus if your database was called thetimes and your table was called subscriptions, and you were looking for a firstname, you might have
SELECT firstname FROM subscriptions WHERE login='randelld ' LIMIT 1;
If this was the case, I'd suggest you change it to
SELECT firstname FROM thetimes.subscr iptions WHERE login='randelld ' LIMIT 1;
Does that help any? randelld
After playing with it for 15 minutes it seems to work... so far. I'll give you an update later today if it works completely. Thank you so far!
cwab.php is a MySQL connection script written by Dreamweaver. It's as follows (names changed to protect the innocent):
<?php # FileName="Conne ction_php_mysql .htm" # Type="MYSQL" # HTTP="true" $hostname_cwab = "localhost" ; $database_cwab = "cwab_com"; $username_cwab = "blah"; $password_cwab = "blah"; $cwab = mysql_pconnect( $hostname_cwab, $username_cwab, $password_cwab) or die(mysql_error ()); ?>
I'm fairly certain it doesn't die at the above mysql_pconnect as the page title appears *before* the error does, meaning a later MySQL call had an error. I believe it's dying when I call mysql_query, but I don't know why. And example call is below:
$parts = mysql_query($qu ery_parts, $cwab) or die(mysql_error ());
where $query_parts is some (tested) valid MySQL query.
Since the scope of require_once is that particular script, cwab.php will be loaded every time my page is loaded for a single user, correct?
test-include.php is a series of functions I've written that don't interact with the database or variables pointing to it at all. It's long and uninteresting.
Your 'require_once' will run for very one, every time - the "_once" and
the end of the require is useful only when its possible that you might
have duplicate includes/require statements (perhaps one included file
includes another which includes another which might include the second
include file again so require_once will only include the file once and
not shout/error... Note, while include and require differ, they have
similarities hence I hope you understand that I use require/include
interchangably though in programming circles, one might not.
Do you have a mysql error log that you can browse?
What about reading the output string from mysql_error() If MySQL was to
fail on you, the mysql servers message would be written there - that
might help you.
Alas, I won't be around until Tuesday - I don't have high speed at home
just yet (will do inside the next weeks) - its a long holiday weekend
here in the UK so I hope you get things resolved by then - If not, I'll
do my best to help if you email me using the address
website 2004 at fiprojects dot com
all of the above without spaces and whatever...
anyway... all the best,
laters
randell d This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: mrbog |
last post by:
Tell me if my assertion is wrong here:
The only way to prevent session hijacking is to NEVER store
authentication information (such as name/password) in the session.
Well, to never authenticate a user from information you got from the
session. Each secure app on a site must challenge the user for name
and password, each and every time the user accesses it (not just once
and then store it in the session). If a secure app is multi-page,...
|
by: Martin |
last post by:
Hi all
As my posting title suggests I'm having problems using InProc Session
state in my ASP .NET app.
I wrote a site for a friend which uses ADO .NET to keep track of a
simple customer/purchases database. A user creates an account and a
database entry is added to a customer table. Once a user successfully
logs in with a valid Username/Password I store away the UserID (which
is the primary key of the Customers table) in the Session...
|
by: Hardik Shah |
last post by:
Hi,
I am calling an ASP.Net page from an ASP classic application but need
the .Net page to have access to ASP classic's session variables. I am
using HTTPWebRequest to call ASP classic page which could then return
the session values. But the values are always blank. If I do a
Response.Redirect() to call the ASP page, it returns the values okay.
But I cannot do a Response.Redirect() as I just need to access some
session variables and...
|
by: Mark |
last post by:
Ok, I know that .net inherently does not share session data across asp.net
projects, but is there any decent work around to this.
We already have a big chunk of our application using the asp.net session
object (using state service). I'd like to start breaking out
our functionality into component projects, but I'd like to get this session
issue worked out first.
Any ideas??
I found this article , but it sounds like kind of a pain.
|
by: bennett |
last post by:
In the web.config file for my application, in the <sessionState>
section I have set timeout="120" (in minutes), but session state
variables in my application seem to be expiring in about 5 minutes.
Any idea what could cause this?
I have the mode="InProc" attribute set for <sessionState>. I know that
some people have solved the problem of session variables timing out too
quickly by changing that attribute, but I cannot use...
| |
by: charliewest |
last post by:
Hello -
I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#) is
there any way to temporarily save an image to a session object, and after
running some other operations, later retrieve the image from the session
object, convert it back to an image, and re-save it to the database?
Thanks?
|
by: Joel Reinford |
last post by:
I am trying to build custom membership/role providers, inheriting from the
base membership/role providers because I have an existing database with user
authentication and roles. The membership part is fine but I'm not getting
something right on the roles. When the user logs in, I am getting a
delimited list of roles from the database and putting them into a Session
variable. I thought I could access that Session variable in the Role...
|
by: Michael Schwarz |
last post by:
Hi,
I have a problem where I have two requests (i.e. two different windows that
are using the same session) that are accessing the session collection. The
requests will need more time on the server, but I get the problem that the
two sessions are not getting updated values from each requests. Is this by
design or is there any solution to do this?
--
Best regards | Schöne Grüße
|
by: davidkoree |
last post by:
I mean not about cookie.
Does it have something to do with operating system or browser plugin?
I appreciate any help.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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: 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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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: 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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |