Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Jay87
Starting Member
41 Posts |
Posted - 2010-03-04 : 09:11:42
|
| I have the following code in a table which i am trying to use to edit existing data i.e. a ticket is originally normal priority but we decide it needs to be changed to high:[code=text] <tr><th class='smooth'>Priority</th></tr> <tr><td class='menu_item'><select style="width:250px;" name='pri' value='<? echo $item['priority']; ?>' id='pri'> <option value='1'>High</option> <option value='2'>Normal</option> <!-- <option value='3'>Low</option> <option value='4'>Work Request</option> --> </select></td></tr>[/code]the bit in red is where i am trying to call back the priority already selected doesn't work (it always selects value 1)the query where i am originally calling the data: [code=text]$item = mssql_fetch_array(mssql_query("SELECT busphone = (case faultlog.company when 'None' then cedarlog.telephone else contact.busphone end),tickettype, queueid,CONVERT(char(10),logged,103) as logged_fmt,priority,DATEDIFF(s,notes.date,GETDATE()) AS elapsed,engineer.forename +' '+engineer.surname as engineer,faultlog.enduser,(contact.forename + ' ' + contact.surname) as contact,contact.contract,faultlog.description,faultlog.chargable,faultlog.logged,faultlog.id as id,queue.description as queue,faultlog.id_prefix,(faultlog.id_prefix + faultlog.id) as callid,faultlog.engid,faultlog.company,calltype.name AS type, callstatus.name as status FROM faultlog INNER JOIN queue ON queue.id = faultlog.queueid LEFT OUTER JOIN contact ON contact.id=faultlog.contid INNER JOIN calltype ON calltype.id=faultlog.typeid INNER JOIN callstatus ON callstatus.id=faultlog.status INNER JOIN engineer ON engineer.id=faultlog.engid LEFT OUTER JOIN cedarlog ON faultlog.id=cedarlog.id AND faultlog.id_prefix=cedarlog.id_prefix LEFT OUTER JOIN notes ON (notes.id = faultlog.id AND notes.id_prefix=faultlog.id_prefix) WHERE faultlog.id_prefix='" . $_GET['pfx'] . "' AND faultlog.id=" . $_GET['id'],$db));[/code]Help plz |
|
|
DP978
Constraint Violating Yak Guru
269 Posts |
Posted - 2010-03-04 : 09:34:27
|
| Just as a note I would 'pretty' up the sql code in your post, you are a lot more likely to get a response if it is readable. Walls of text turn people away. Plus it makes it easier to see what you are trying to do :) |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-03-04 : 09:37:52
|
Something like this:<select style="width:250px;" name='pri'><option selected value= '<? echo $item['priority']; ?>'><? echo $item['priority']; ?></option><option value='1'>High</option>...</select>That is a HTML-problem and not sql.  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Jay87
Starting Member
41 Posts |
Posted - 2010-03-04 : 09:49:08
|
| cheers fr trying mate, didnt work though :( |
 |
|
|
|
|
|
|
|