Current location: Hot Scripts Forums » Programming Languages » PHP » Problem with custom php script


Problem with custom php script

Reply
  #1 (permalink)  
Old 04-20-04, 05:45 PM
Reload Reload is offline
New Member
 
Join Date: Apr 2004
Location: Lancashire, UK
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Problem with custom php script

Howdy,

First off, i must admit that i have an EXTREMLEY limited knowledge of PHP, and with the help of a couple of people, i have just managed to knock together a PHP script for a new site im developing.

The problem is, ive got everything done, bar one part, that im truly stuck on:

PHP Code:

// update DB 

$sql  "UPDATE radioshows "
$sql .= "SET show_name = '{$_POST['show_name']}', show_day = '{$_POST['show_day']}', show_time = '{$_POST['show_time']}', dj_name = '{$_POST['dj_name']}', dj_picture = '{$_POST['dj_picture']}' "
$sql .= "WHERE show_id = '{$_GET['show_id']}'"
if (
mysql_query($sql)) { 
    
// DB updated correctly 
    
... 
} else { 
    
// DB not updated - an error has occurred 
    
... 

?> 
Basically, i need to fill in the dots. When the process has completed, i need it to forward to a page with a success or error message. Any ideas?

Cheers,

Lee
Reply With Quote
  #2 (permalink)  
Old 04-20-04, 08:52 PM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
Try this...

if (mysql_query($sql)) {
// DB updated correctly
echo "Update Successful";
} else {
// DB not updated - an error has occurred
echo "Update Unsucsessful";
}



Or try...


if (mysql_query($sql)) {
// DB updated correctly
header ("location: success.php");
} else {
// DB not updated - an error has occurred
header ("location: failure.php");
}


Success.php & failure.php would be new pages to redirect to.

Reply With Quote
  #3 (permalink)  
Old 04-20-04, 09:07 PM
Reload Reload is offline
New Member
 
Join Date: Apr 2004
Location: Lancashire, UK
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Hmmm, dosent seem to be working.

http://www.reloaddesigns.co.uk/kewli....php?show_id=5

The 'Update Unsuccesful' shows up straight away for some reason.

Any ideas?

Cheers, Lee
Reply With Quote
  #4 (permalink)  
Old 04-20-04, 09:12 PM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
I noticed in some areas of your update, you use $_POST, but for the last item you use $_GET. Not sure if it makes a difference.
Reply With Quote
  #5 (permalink)  
Old 04-20-04, 09:20 PM
Reload Reload is offline
New Member
 
Join Date: Apr 2004
Location: Lancashire, UK
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
I had to use the $_GET function, as the page is generated from a row ID in the previous page. I have no idea how to get around this :S

Cheers, Lee
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with PHP/.htaccess script, when using Internet Explorer digioz PHP 7 07-26-07 11:17 PM
problem with php script kappler0 PHP 3 05-04-04 11:07 AM
problem with php script Z-Paul PHP 4 04-10-04 04:03 AM
problem with PHP script on qmail server localrec PHP 2 03-25-04 01:49 PM
PHP Search script problem vispa PHP 1 11-22-03 12:22 PM


All times are GMT -5. The time now is 10:27 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.