Go Back   Computer Juice > Computer Software > Web Design & Programming
Register Members New Posts Donate Unanswered Posts Site Spy Search


Reply
 
Thread Tools
  #16  
Old 04-04-2008, 01:49 PM
No Avatar
CJ Member
 
Samantha0101 is offline
 
Join Date: Nov 2007
Last Online: 30-06-2008 12:11 PM
Posts: 21
iTrader: (0)
Samantha0101 is on a distinguished road
Default PHP mysql, creating a drop down list that takes fields from table in mysql

Right, sort of got somewhere today.
I have a simple update ..form thing but was wondering how do i do a delete query(? i think..), where the user can choose an item from a drop down and delete it. I thought i could just use the update query and change the update parts to delete but there is no delete type buttons.

Asked one of the guys in my class what his was like and he only had a few lines. Have googled but don't understand.
I want to be able to delete specific items from the items table.
Digg this postDel.icio.us this postTechnorati this postNetscape this postStumble this post
Reply With Quote
  #17  
Old 04-04-2008, 02:57 PM
spot's Avatar
spot  Wales
CJ Donator
Intel Nvidia
spot is offline
 
Join Date: Feb 2008
Last Online: 15-07-2008 10:10 PM
Posts: 523
iTrader: (0)
spot is on a distinguished road
Default PHP mysql, creating a drop down list that takes fields from table in mysql

You currently have "edit item". Make a copy of what you're doing there and label it "delete item". You had the item you wanted editing, now it's the item you want deleting.

You have code which currently does the edit. Make a copy of that and label it delete.

mysql_query("DELETE FROM tab-x WHERE item=".$item) or die(mysql_error());

(those mysql_error bits you took out need to be there really, else you'll have a database error and the code will just carry on regardless. You need to catch it when you're testing so you can make it work robustly and then the mysql_error won't ever happen in real life).

I expect I've misunderstood what you were asking. What have I assumed that's not true?

I know what I don't understand though - "but there is no delete type buttons" - you must be using a bit of software to generate your mysql syntax and I don't know what software it is. It might be a part of Dreamweaver. All I have here is a text editor with no delete type buttons so I can see why we have trouble getting ideas across.
__________________

My System: Tim

CPU(s):
Athlon 64 3500+
Motherboard:
Asus A8N-VM CSM
RAM:
Corsair PC3200 CL2 DDR-400 2GB
Graphics Card(s):
nVidia Geforce 6600 512MB
Sound Card:
Cherry RS 6000 M keyboard
Hard Drive(s):
Barracuda.7+ 2x200GB 58MB/s sustained
Optical Drive(s):
Samsung DVD-ROM TS-H352
Case / PSU:
Thermaltake Soprano
Cooling:
Stock
Network / Internet:
Telewest 2x20Mb/sec
Monitor(s):
SXGA flat panel
Operating System(s):
Slackware (2.6.24.3) (Fluxbox) (bash)

Want your system info in your signature?

Last edited by spot : 04-04-2008 at 03:01 PM.
Digg this postDel.icio.us this postTechnorati this postNetscape this postStumble this post
Reply With Quote
  #18  
Old 04-04-2008, 03:09 PM
dmdougie's Avatar
CJ Donator
 
dmdougie is offline
 
Join Date: Sep 2007
Last Online: 19-06-2008 03:11 PM
Posts: 127
iTrader: (0)
dmdougie is on a distinguished road
Default PHP mysql, creating a drop down list that takes fields from table in mysql

This sounds exactly like the coursework that I failed this time last year! Not in the same course as me are you?! I found www.w3schools.com to be a great help. You seem to have lucked out with getting the help from Spot, Im sure you will have a working site up and running before hand in date! Good luck
__________________
Last night I lay in bed looking up at the stars in the sky and I thought to myself, where the heck is the ceiling.
What if everything is an illusion and nothing exists? In that case, I definitely overpaid for my carpet.
Digg this postDel.icio.us this postTechnorati this postNetscape this postStumble this post
Reply With Quote
  #19  
Old 05-04-2008, 10:13 AM
No Avatar
CJ Member
 
Samantha0101 is offline
 
Join Date: Nov 2007
Last Online: 30-06-2008 12:11 PM
Posts: 21
iTrader: (0)
Samantha0101 is on a distinguished road
Default PHP mysql, creating a drop down list that takes fields from table in mysql

Still confused about delete, what do i need to take out of edit?


I meant the Insert>Form>Button in Dreamweaver, how there is submit and hidden etc.
Digg this postDel.icio.us this postTechnorati this postNetscape this postStumble this post
Reply With Quote
  #20  
Old 05-04-2008, 02:25 PM
spot's Avatar
spot  Wales
CJ Donator
Intel Nvidia
spot is offline
 
Join Date: Feb 2008
Last Online: 15-07-2008 10:10 PM
Posts: 523
iTrader: (0)
spot is on a distinguished road
Default PHP mysql, creating a drop down list that takes fields from table in mysql

The thing is, I've never used Dreamweaver.

What I think is that using what's effectively a program generator like Dreamweaver gives you another entire level to learn, except that some people (I'm talking generally, I'm not putting you Samantha into the picture), some people can use the generator without learning to read or write what it generates.

It's quite possible that Dreamweaver is good enough at generating systems that the Dreamweaver user doesn't need to know how to read or write mysql statements, or php syntax, or html tags. If that's so then a "learn to use Dreamweaver" course will let someone generate a site from scratch without knowing any mysql statements, or php syntax, or html tags and it could well be a quick way to become competent at writing a website.

If Dreamweaver doesn't actually do all the work, and a person does need to also know how to write and read mysql statements and php syntax and html tags, then learning Dreamweaver on top of learning mysql statements and php syntax and html tags seems a bit of an overhead to me.

Anyway, that's why if I were teaching someone to program I'd not hand them Dreamweaver at all. If, on the other hand, I were teaching a Dreamweaver course then I would. If I were teaching a "create your own website" then I might or I might not. For teaching programming it looks to me like it gets in the way.

Where I said 'You currently have "edit item"' I was talking about the command button on your html which is labelled "edit item", not any instruction in Dreamweaver. I was suggesting that a copy of the html code which makes that command button could be relabelled "delete item" and the mysql statement in my post would do the job if it were in the POST page that the command button called.

That's how I program most of the time, taking bits I've already written and tested and copying them and changing the copy to do something similar but not identical. Actually sitting down and writing totally fresh code is exciting but time-consuming. Re-using stuff known to work speeds up the process. I don't much like copying code from someone else into my own source because I have a lot of tinkering to put it into my own style where I'll feel comfortable, and it would take a while to get all the variable naming convention to match the rest of my program, but I'd still sometimes do that rather than write from nothing. The code that other people have written that I do, always, rely on is the stuff I call as routines through an API. I'm an application programmer calling up huge existing functions through whatever Application Programming Interfaces are available to me. I write 1% of what's going to actually run, my code's like a skim of jam on a thick slice of buttered toast. The 99% complexity of what the computer actually performs is already fully tested and working, my 1% is the new stuff I'm trying to get right which carries the actual design of the new system I'm implementing. That mysql_query line is an API call to someone else's code which is far more complex internally than anything I'm writing and millions of other programmers are also, like me, relying on mysql_query working faultlessly. We're all writing different screen applications though.

So - is there anyone on site who's good at using Dreamweaver who can cut in and say what to do?

I can see why you said earlier that the bits I've written about html and php are "nothing like what we've been 'taught' to do" if you've been taught how to make a website using Dreamweaver and nobody's covered html or php.

I hope I've not held you back or slowed you down in completing this bit of your course.
__________________

My System: Tim

CPU(s):
Athlon 64 3500+
Motherboard:
Asus A8N-VM CSM
RAM:
Corsair PC3200 CL2 DDR-400 2GB
Graphics Card(s):
nVidia Geforce 6600 512MB
Sound Card:
Cherry RS 6000 M keyboard
Hard Drive(s):
Barracuda.7+ 2x200GB 58MB/s sustained
Optical Drive(s):
Samsung DVD-ROM TS-H352
Case / PSU:
Thermaltake Soprano
Cooling:
Stock
Network / Internet:
Telewest 2x20Mb/sec
Monitor(s):
SXGA flat panel
Operating System(s):
Slackware (2.6.24.3) (Fluxbox) (bash)

Want your system info in your signature?

Last edited by spot : 05-04-2008 at 02:29 PM.
Digg this postDel.icio.us this postTechnorati this postNetscape this postStumble this post
Reply With Quote

Please support this forum, donate towards our running costs.


Reply


Thread Tools

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql and hosting company MySlowQuietLife Web Design & Programming 4 22-02-2008 09:25 AM
webserver help with mysql Drewski526 Web Design & Programming 1 19-11-2007 07:21 PM
Can't connect with with MYSql sever myselfsoon Web Design & Programming 1 21-10-2007 02:49 PM
What is the best Apache/PHP/Mysql package for... firesauce Windows Operating Systems 2 19-03-2007 04:06 AM
How do I upgrade CPanel, PHP, and MySQL, as... andrewwpeace Web Design & Programming 1 19-03-2007 03:22 AM


Copyright ©2006 - 2008 Computer Juice.

Powered by vBulletin® Copyright ©2000 - 2008 Jelsoft Enterprises Ltd. SEO by vBSEO ©2008, Crawlability, Inc.