Forum Moderators: coopster
this is coding for my add form
<?php
error_reporting(E_ALL);
require '../main.inc.php';
$ACTION = @$_REQUEST['action'];
if(!$ACTION) $ACTION = 'index';
if($ACTION == 'index') {
$profile_id = $_GET['profile_id'];
$contact = mysql_query("SELECT profile_id FROM profiles WHERE $profile_id = profile_id");
}
elseif($ACTION == 'post_mix') {
$dj_name = $_GET['dj_name'];
$profile_id = $_GET['profile_id'];
// add the mix entry to the database
// fields are:
$infields = array('mix_id','dj_name','mix_name','mix_date','mix_style','mix_tracklist', 'mix_size', 'mix_duration','mix_bitrate', 'mix_comments', 'mix_url','cue_url','stream_url','stats_url','active');
// the id's are in the format of '002' etc
list($lastid) = mysql_fetch_row(mysql_query("SELECT mix_id FROM mixes ORDER BY mix_id DESC LIMIT 1"));
$thisid = '0' . sprintf("%02d", intval(substr($lastid,1)) + 1);
// insert into the mixes table
$res = mysql_query("INSERT INTO mixes VALUES('$thisid', '".addslashes($dj_name)."','". addslashes($mix_name). "','".addslashes($mix_date)."','".addslashes($mix_style) ."','".addslashes($mix_tracklist)."','". addslashes($mix_size). "','".addslashes($mix_duration). "','".addslashes($mix_bitrate). "','".addslashes($mix_comments). "','".addslashes($mix_url)."','". addslashes($cue_url)."','". addslashes($stream_url)."','". addslashes($stats_url)."','". addslashes($active)."')");
if(!$res) die(mysql_error());
//done, go back to the index
header("Location: saved_mix.php?profile_id=$profile_id");
exit;
}
?>
would appreciate anyone's help/. thnx in advance
[edited by: jatar_k at 4:53 pm (utc) on Aug. 10, 2005]
[edit reason] fixed sidescroll [/edit]
i kinda got it sorted. the page pulls the data from db correctly & when i make changesto the data & click submit it goes to my saved changes page except it doesnt actually update the data. i must have missed something. code is below
<?php
error_reporting(E_ALL);
require '../main.inc.php';
$ACTION = @$_REQUEST['action'];
if(!$ACTION) $ACTION = 'index';
if($ACTION == 'index') {
$profile_id = $_GET['profile_id'];
$menu_breadcrumb = mysql_query("SELECT profile_id FROM profiles WHERE $profile_id = profile_id");
$edit_mix = mysql_query("SELECT * FROM mixes WHERE mix_id = $mix_id");
}
elseif($ACTION == 'post_mix') {
$dj_name = $_GET['dj_name'];
$profile_id = $_GET['profile_id'];
$mix_id = $_GET['mix_id'];
// add the mix entry to the database
// fields are:
$infields = array('mix_id','dj_name','mix_name','mix_date','mix_style','mix_tracklist', 'mix_size', 'mix_duration','mix_bitrate', 'mix_comments');
// update the mixes table
$res = mysql_query("UPDATE mixes SET dj_name='$dj_name', mix_name='$mix_name', mix_date='$mix_date', mix_style='$mix_style', mix_tracklist='$mix_tracklist', mix_size='$mix_size', mix_duration='$mix_duration', mix_bitrate='$mix_bitrate', mix_comments='$mix_comments' WHERE $mix_id = 'mix_id'");
if(!$res) die(mysql_error());
//done, go back to the index
header("Location: saved_mix.php?profile_id=$profile_id");
exit;
}
?>