PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > With Stored Procedure
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
With Stored Procedure

Réponse
 
LinkBack Outils de la discussion
Vieux 15/10/2007, 22h42   #1
Smitty
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut With Stored Procedure

Hello everyone. I am new to mySQL, so I am hoping someone might be
able to me. We have a table in our database, which has a table
Ticket Priorities, which only contains 3 columns...User_ID, Ticket_ID
and Priority. This table basically houses all support personnel and
the support tickets assigned to each, and the priority of each
ticket. Example:

USER_ID Ticket_ID Priority
12345 006234 1
12345 006266 5
12345 006523 2
12345 006258 3
..
..
..
The application has a Priority screen, displaying the tickets for each
user in a list, ordered by priority. Our manager can log into the
tool, and reorganize the priority's by moving the ticket number up or
down using an up/down arrow. Every time the priority is moved, I need
a stored procedure to change the Priority number in the database. For
example, if a ticket with priority 5 is moved up 2 places in the list,
I need the procedure to change the 5 to a 3, and shift the rest of the
numbers down. Not sure if I explained this properly or not. Any
ideas? Thanks everyone

  Réponse avec citation
Vieux 16/10/2007, 20h49   #2
lark
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: With Stored Procedure

== Quote from Smitty (marksmithy69@hotmail.com)'s article
> Hello everyone. I am new to mySQL, so I am hoping someone might be
> able to me. We have a table in our database, which has a table
> Ticket Priorities, which only contains 3 columns...User_ID, Ticket_ID
> and Priority. This table basically houses all support personnel and
> the support tickets assigned to each, and the priority of each
> ticket. Example:
> USER_ID Ticket_ID Priority
> 12345 006234 1
> 12345 006266 5
> 12345 006523 2
> 12345 006258 3
> .
> .
> .
> The application has a Priority screen, displaying the tickets for each
> user in a list, ordered by priority. Our manager can log into the
> tool, and reorganize the priority's by moving the ticket number up or
> down using an up/down arrow. Every time the priority is moved, I need
> a stored procedure to change the Priority number in the database. For
> example, if a ticket with priority 5 is moved up 2 places in the list,
> I need the procedure to change the 5 to a 3, and shift the rest of the
> numbers down. Not sure if I explained this properly or not. Any
> ideas? Thanks everyone


you explained it ok.

you need an sp that takes in as input parameters 3 values:
user_id
ticket_id
changed_priority_orig
changed_priority_new

you can lookup the basics of stored procedures on mysql's website; however, this
is what it should do
1-it takes the values mentioned above
2-it updates the record that has changed to changed_priority_new based on
changed_priority_orig
3-if the new priority is already existing in the dataset for that user_id, it then
needs to be updated to changed_priority_orig

i believe this should do it.
--
POST BY: lark with PHP News Reader
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 00h49.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,08966 seconds with 10 queries