Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    MYSQL




Entering Session Details


I want to get the session details (username) of a person loged in. And want that details to be entered to a separate table in he same data base. how can i do that. A coding for that would e perfect.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Getting All Details For Minimum Value
I'm sure this can't be that hard, but suppose I have tables for category and product, and a link table, and I want to get the minimum priced product for each category:

select c.categoryID,c.categoryName, MIN(price) as min_price
FROM cat c
JOIN category_product cp ON c.categoryID=cp.categoryID
JOIN product p ON cp.productID=p.productID
GROUP BY c.categoryID
That's fine, but how about if I wanted to get further information about that minimum priced product? I've been doing what looks like awkward things with subqueries, like this:

SELECT cat.*,(SELECT productName FROM product WHERE product.price=cat.min_price LIMIT 1) as prodname
FROM(
select c.categoryID,c.categoryName, MIN(price) as min_price
FROM cat c
JOIN category_product cp ON c.categoryID=cp.categoryID
JOIN product p ON cp.productID=p.productID
GROUP BY c.categoryID
) as cat
or this :

SELECT cat.*,p.productID, p.productName
FROM(
select c.categoryID,c.categoryName, MIN(price) as min_price
FROM cat c
JOIN category_product cp ON c.categoryID=cp.categoryID
JOIN product p ON cp.productID=p.productID
GROUP BY c.categoryID
) as cat
LEFT JOIN product p ON cat.min_price=p.price
GROUP BY cat.categoryID

Product Details
I am currently developing an e-commerce website. Each product comes in many colours and sizes. I have therefore created the following tables:

1. product (contains basic information about each product)
2. colour (contains a list of all possible colours)
3. size (contains a list of all possible sizes)
4. product_colour (contains matching product and colours ids)
5. product_size (contains matiching product and size ids)

I now need to create a query which returns the basic information, the available colours, and the available sizes for a particular product id.

How To Add Several Details To One Field In Table?
I have been adding my info into my database so far like this:

INSERT INTO mytable SET
Name = "Harry Bucket",
Products = "chair",
Suburb = "sydney",
ResLink = "harrys_page.php";

BUT, harry has more then just a chair under his product listing... how would i add several products that relate to the 1 field?

Get Last Records Details With A Subselect?
I have a ticketsystem where each ticket belongs to an user and each user can insert a couple of messages to one ticket. Therefore I have implemented a date field (used as primary key). Now I want to get details from the last entry belongs to a ticketid.

kdn_message:
updated (date)
ticketid (int)
kdnr (int)
detail
state

select * from kdn_message t
where updated in (select max(updated) as updated from kdn_message group by ticketid where ticketid=t.ticketid order by updated desc)

what is wrong i this statement?

Concrete Data & Details
I'm reading available documentations and whitepapers, but can't reach specific answers to my questions:
1. What is the minimum requirements (cpu,memeory..) for mySql.
2. What is the advatanges in using the embedded version over the regular? And I'm looking for specific data, not 'global statements', like - how small is the embedded version's footprint?

Sharing Login Details
There is no decent image gallery that can be put with Joomla or Mambo CMS so I am wanting to add a separate pop up page to use a 4images (http://4homepages.de) image gallery.

HOWEVER,

I don't want my users to log in twice to two different databases!

I'm sure there is a way of doing this. (both the CMS and the Gallery are on the same server, and they can both use the same Database.

Sharing Login Details
There is no decent image gallery that can be put with Joomla or Mambo CMS so I am wanting to add a separate pop up page to use a 4images (http://4homepages.de) image gallery.
I don't want my users to log in twice to two different databases!
I'm sure there is a way of doing this. (both the CMS and the Gallery are on the same server, and they can both use the same Database. )

Deciphering Connection Details From PhpMyAdmin
I have no details as to how to connect to my database although I am able to create one through phpmyadmin. While I twiddle my thumbs waiting for my host to send me some connection details is it possible to maybe work out what they are? I'd guess my username and password are ones I chose and are the same for the whole kaboodle so it's the address of the db I'm looking for, any clues?

How To Save People's Details Using MySQL?
Basically i want people to enter in there name and contact details and an answer to a simple question. I then want that information to be stored somewhere, so i can retrieve it once a month. Do i use Microsoft access?

Finding User Details Inside UDF
i heared that its possible to get user details inside
the UDf by adding the mysql_priv.h header file.

But where will this file be available.
i am using MySql 3.23.52 on linux8.0

when i try to compile it says :"mysql_priv" file not
found.

If i can include this file, i can get the thread
constructor called...

Can MySQL Return Details On What Specifically Trigged A Match?
Can MySQL return details on what specifically matched in each row for a FULLTEXT search or WHERE clause?

Say the query "SELECT id FROM users WHERE (name LIKE '%Sarah%') AND (age BETWEEN 19 AND 29)" returns 12 rows. Is there a way for mysql to tell me whether name or age triggered the match?

Entering And Recalling
I have been running my site forever with just regular html, and I want to make a page where I can enter a title, a date, and then the content, and then I want to be able to display each entry on seprate pages.

Entering Information
I have looked threw many books and the nety but cant find how I would enter more attributes into a table that already exists in a database in MySql

All I seem to find is for to insert values into a table.

Entering Datas
I done a little bit of sql a while back and now I need to start up again.
I have got to grip with most of the commands again and managed to create
tables etc.
One thing I can't remember how to do or find on the web is how to read from
a text file.
I have a text file with a load of sql command in it and data to populate my
tables etc but I thought there was a command which basically says run this
file.
something like open "myfile.sql"

Entering New Data
Let's say I have this:


Code:


$save_entry= mysql_query("INSERT INTO clients (Name, Telephone, Email) VALUES ('$name','$telephone','$email')") or die(mysql_error());

What if I want to EDIT this data (through an online form), how do I save the changes (let's say the name can't be changed but the phone number and the email can) to the existing data that is already in the database, without creating a new entry.

Something like this makes sense to me, but that's not correct syntax according to MYSQL.


Code:


$save_entry= mysql_query("INSERT INTO clients WHERE Name = '$name' (Name, Telephone, Email) VALUES ('$name','$telephone','$email')") or die(mysql_error());

Query Using Session Name?
How can I make a query which searces using the name of the session currently open.

i.e

$query = "SELECT * FROM users WHERE username = '$_SESSION[name]'";

thats the idea but it doesn't work?

Suggest About Session
am new to mysql.
what`s the use of session?
plz explain with program

Addslashes And Entering Data
I am trying to enter last names into my mysql database.

I used addslashes before entering the data to the table

$last = addslashes($_POST['last']);

Trying to have some protection against sql injection I think.

Here's my problem. When I enter the name O'Reilly it puts in O'Reilly.

When I display the last names how do I drop the so I can see O'Reilly instead of O'Reilly.

Also do I even need addslashes?

Read Primary Key While Entering A New Row
I have a website with a form on it.  Upon pressing submit, the information gets entered into the database on a new row.  Each row is numbered with auto_increment (it's the Primary key).  The auto_incremented field is called the ID.

When the user submits his information, I would like an automatic email to get sent to his email with his unique ID number and a recap of this information.  How can I do this?

Basically it seems to me that all I need to know is the command to be able to read information off of the row that you're currently putting information on.  The only way I can think of to do this is to have the form input all the information, then close that connection and start a new one in which it searches for the row that contains all that information and that way I can get it to read the ID then.  Is there a shorter way?

Entering Recurring Events
I have a events table with a date column and I was wondering if there is a way of inserting recurring events (monthly, weekly) without having to enter each event on its own.

Entering Japanese Characters
Edit: Inserting it into the database manually works, so its entirely possible this is just a problem with php reading it and inserting it wrong. I'm just going to post this in the php section,

Open Session From Client
I have Mysql running fine on a Linux box. From host I can run mysql and mysqladmin without problems (MySql root user hasn't password yet).

Now I would like to execute some sql commands from MySql administrator running on a windows PC. but when I tried to open the connection the error 1130 appears. What can I do to do SQL queries from Windows (or any other supported OS) to MySql server?

Host server has firewall disables (to avoid any problem).

Global Vs. Session Variables
I have a question regarding setting my session variable. I want to set the wait_timeout value to 600 for both global and session variables.

I put this in my my.cnf file:
wait_timeout = 600

bounced mysql and then logged back into a new session. The 600 value is set for global wait_timeout:

mysql> show GLOBAL VARIABLES LIKE 'wait%';
+---------------+----------+
| Variable_name | Value |
+---------------+----------+
| wait_timeout | 600 |
+---------------+----------+

BUT the session variable is still set to :

mysql> show VARIABLES LIKE 'wait%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout | 28800 |
+---------------+-------+

How can i get the session variable to take the global value as the default??? I don't want to have to issue the 'set session variable' command in each session.

Session Timeout Issue
I'm trying to import several million records into MySQL but the darn thing keeps going to timeout before all of the records are imported. How do I change this setting? I'm using the command line and am very confused.

Tracing An Application Session
I have an asp application talking to mysql database. I want to trace what sql is being fired by this application against mysql...is there someway to do it?

Session Vs. Global Variables
I have a question regarding setting my session variable. I want to set the wait_timeout value to 600 for both global and session variables.

I put this in my my.cnf file:
wait_timeout = 600

bounced mysql and then logged back into a new session. The 600 value is set for global wait_timeout:

mysql> show GLOBAL VARIABLES LIKE 'wait%';
+---------------+----------+
| Variable_name | Value |
+---------------+----------+
| wait_timeout | 600 |
+---------------+----------+

BUT the session variable is still set to :

mysql> show VARIABLES LIKE 'wait%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout | 28800 |
+---------------+-------+

How can i get the session variable to take the global value as the default??? I don't want to have to issue the 'set session variable' command in each session.

Change Session Date
How do I change the date of a session within MySQL? I would like to change the session date format of my current session.

Change Session Date
How do I change the date of a session within MySQL?
I would like to change the session date format of my current session.

Set The Default Session Variable
In mysql command, there is session variables. I know it could be set dynamically by SET command. But where could i set the default value for session variables? I do not want to change it every time i enter in a session.

How To Lock Records After Entering Data
I have several tables in my databases, and in one of them i want to lock the data after they enter it. for some reason, my users are telling me that the data is 'disappearing', but i think they are just deleting it by accident.

Speed Comparison Between Entering Entries By PHP And Using Another Tbl
I have a table with 100,000 address entries associated with other info, such as resident names, and I have a text file with the lat/long coordinates for those addresses.

So I want to put that lat/long data into the address table. Is it faster to create a table using the text file, then running an update query using those two tables...Or is it quicker to write a php script that enters the lat/long data?

Entering Data Into Db With Hard Returns
I have a html textarea where user submit text and it gets stored in a db. For example:

This is a test. Here is my list...
one
two
three

See, the text has hard returns in it, but when i output it back on the page with php, it all goes into a continuous line.

How can i have the hard returns in the output. Like I have the '' included.

Entering Data Into A Bridge Table
To make a simple music database, I've made a table of songs and a table
of players joined by a bridge table (song_play) to allow many-to-many
relationships...eg:

create table song
(song_id int primary key,
name char(30));

create table player
(player_id int primary key,
name char(30));

create table song_play
(song_id int not null,
player_id int not null,
primary key(song_id, player_id));

Once the names of songs and players are entered into their respective
tables, is there an easier way to enter data into the join table other
than looking up the id's from song and player and entering those into
song_play?

Entering Dynamic Values Into Rows?
Is it possible when entering values into a table, to enter a string value from one column into another column in the same row in the same insert command?

Is it possible in the insert command, to call some predefined function to get the appropriate value for the 3rd column? In calling this function, i would use the value from the 2nd column as the argument.

this (theoretically), could look somthing like this:

INSERT into IMAGES values
(NULL, 'images/image_01.jpg', 'func(col2.value)');

the function would be somthing like:
(excuse syntax, i haven't learned MySQL functions yet, but just to give an idea)

function func(string s) {
select str = s
select str = SELECT REPLACE(str, '.jpg', '');
select str = SELECT SUBSTRING(str, 8);
return str;
}

The resulting inputted values would then be:

(NULL, 'images/image_01.jpg', 'image_01');

If this were possible, it would save me a LOT of uneccesary typing, as for each insert command, i'd only have to change the path name for col 2 and not type the name for col 3.

Mysql Sql History(cross Session)
I have found many docs to see is there any way to figure out how can
mysql store the typed words or sql(whatever it is a valid sql or not)
so that we can just use "arrow up" or "arrow down"
easily to move to the previous sql or even some sqls typed yesterday or
in different sessions(such as by putty/konsole) that is already logged
out ?

Does anyone have any clues about this ? I think that it should be done
by setting some mysql server vairables but i didn't see any mentioned in the mysql
docs.

Update A Field Using Session Variable
I am trying to update a field for a spacific row using a session
variable from a previous page

sql = "SELECT p.`P_Visible` FROM mysqlreddot.p_heading p WHERE
p.`P_HeadingID`=Session(ewSessionSysAdmin) ");"

but i am getting errors

If hard code a row id then it work fine


sql = "SELECT p.`P_Visible` FROM mysqlreddot.p_heading p WHERE
p.`P_HeadingID`=25");"

Mysql.user.password In Session
I have set up a few users in the mysql Privileges and with my php pages I have them log in with a form (login.php) to access the next page (mainpage1.php) that generates info from the mysql db.I know it is not really secure to just have the plain text password stored as a $_SESSION['pw'] as I have now. but how should I store it in a Session to be used in other pages without the user having to enter it in each time the page wants to go to the db? Or can we store the $Link in a session? or somehow have it remember that the user is connected?as if I sha1() the password how do I get it back into a format that mysql recognizes?What is the best way of doing this?

Making A Mistake When Entering Mysql Command
Just wondering I'm going through the book "build your own database driven website using mysql and php.

While I was typing in a joke to enter into the database I messed up and don't know how to fix it


mysql>INSERT INTO joke SET
->joketext = "This is the joke I was entering",
->jokedate = 2004-03- 02";
->;
->c;
->/c;
As you can see I tried to get out of it but didn't know what to use so I just closed the command promp screen and began again. There has to be a better way.


Syntax Error On Entering Tables Into Database
As a total newbie, got a problem. I was supplied with a set of tables for a database to enter/import. On doing so, the phpmyadmin returns the following error message:

MySQL said:

#1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT CHARSET=latin1 AUTO_INCREMENT=106' at line 17 .....

DOS Window Beeps And Closes After Entering Password
I am running MYSQL on the command line and it is working fine and continues to work until I shut down my computer. However, when I start up my computer and bring up the command line and enter my password, it beeps and closes. The only solution I have found is running a "repair" routine. Does anyone know why this happens and if it can be avoided?

How To Display User Variable Created During Session?
I have created some "@named" user variables during a query session using the MySQL console.

Typing in the queries works just fine. So does the setting of the various user variables.

Yet, there doesn't seem to be simple way to see a list of the user variables I have created.

"show variables" does not include them.

How to view these user-created variables all at once?

Storing Values Of Session Variables Into MySQL Database
I'm creating an online survey with about 100 questions. To make it more user-friendly, I have broken them down to "bite-size" pieces of 10 questions per page. On clicking the "next page" button, the responses get stored in session variables. At the end of the questionnaire, when they click the submit button, I'd like the session variables to be stored in the database and the session will be destroyed. Code:

Pull Info From One Database To Save In A Session To Push To A Different DB
I'm building a dynamic site that has 3 data bases. One DB contains all
of my store info ID#, Name, Address, Phone. Another DB contains member
info ID, Name, address, email,phone,etc...
The 3rd DB Tracks when a user logs in and logs out at a store. This DB
has the following columns Store ID, Member ID, log in time,log out
time, time in store.

The stores log in in the morning that starts a session-I need the
session to pull the store's info ID#, Name,etc... so when a user logs
in, in the store. The login page inserts the store ID, Store name, and
user ID into the 3rd DB.

There are a lot of stores how do I get the store variables to be
inserted into the DB?

Killing One Virtual Console Process From Another (IE, Killing Console Session ALT-F1 From ALT-F4)
On the subject of switching between virtual consoles to get
out of a 'hung' situation in the primary console...

What I have been doing is pressing LEFTALT-F4 to bring up
a 2nd virtual console, logging in as root and running poweroff
to close EVERYTHING down. All I really wanna do is terminate
the hung console session. Can I do that from the 2nd virtual
console without having to power down & reboot linux? Code:


Copyright © 2005-08 www.BigResource.com, All rights reserved