ccrevcypsys Posted September 13, 2007 Share Posted September 13, 2007 Hello everyone i have made my first php code. (instead of just editing a bunch of other codes). well anyway the point of this code that i am about to post is to be able to get the artists on the web site to upload images and information about their band members. Well i tried to use it but it just didnt work. It says MySQL Error Occured n1065: Query was empty n n And i dont think i have the code right... so can someone help me please. if($ccUserData[0]['customer_id']>0){ $query="SELECT * FROM ".$glob['dbprefix']."CubeCart_band_Members WHERE customer_id=".$ccUserData[0]['customer_id']; $members = $db->select($members); if($ccUserData[0]['customer_id']>0 && (isset($_POST['firstName']) || isset($_POST['lastName']) || isset($_POST['instrument']) || isset($_POST['influences']) || isset($_POST['info']) || isset($_POST['image']))){ $record["firstName"] = $db->mySQLSafe($_POST['firstName']); $record["lastName"] = $db->mySQLSafe($_POST['lastName']); $record["instrument"] = $db->mySQLSafe($_POST['instrument']); $record["influences"] = $db->mySQLSafe($_POST['influences']); $record["info"] = $db->mySQLSafe($_POST['info']); $record["customer_id"]=$ccUserData[0]['customer_id']; for($i=0;$i<6; $i++){ if(is_array($_FILES['image'.$i])){ $date_str=date('Ymd'); $imageFormat = strtoupper(ereg_replace(".*\.(.*)$","\\1",$_FILES['image'.$i]['name'])); if($imageFormat == "JPG" || $imageFormat == "JPEG" || $imageFormat == "PNG" || ($imageFormat == "GIF" && $config['gdGifSupport']==1)){ if(file_exists($GLOBALS['rootDir']."/".$members[0]['image'.$i])){ @chmod($GLOBALS['songURL']."/images/uploads/artist/bandmembers", 0775); @unlink($GLOBALS['songURL']."/".$members[0]['image'.$i]); } copy($_FILES['image'.$i]['tmp_name'],"images/uploads/artist/members/".$date_str."_".str_replace('-','_',str_replace(' ','_',$_FILES['image'.i]['name']))); $record["image".$i] = $db->mySQLSafe("images/uploads/artist/members/".$date_str."_".str_replace('-','_',str_replace(' ','_',$_FILES['image'.$i]['name']))); } } $members["firstName".$i] = $db->mySQLSafe($_POST['firstName'.$i]); $members["lastName".$i] = $db->mySQLSafe($_POST['lastName'.$i]); $members["instrument".$i] = $db->mySQLSafe($_POST['instrument'.$i]); $members["info".$i] = $db->mySQLSafe($_POST['info'.$i]); $artist_console->assign("VAL_MEMBER_IMAGE","image".$i); $artist_console->assign("VAL_MEMBER_FIRST_NAME","firstName".$i); $artist_console->assign("VAL_MEMBER_LAST_NAME","lastName".$i); $artist_console->assign("VAL_MEMBER_INSTRUMENT","instrument".$i); $artist_console->assign("VAL_MEMBER_INFLUENCE","influence".$i); $artist_console->assign("VAL_MEMBER_BACKGROUND","info".$i); if(file_exists($bioArray[0]['image'])) $artist_console->assign("VAL_IMAGE","<img src='".$members[0]['image'].$i."'>"); } if($members == TRUE){ // update $where = "customer_id = ".$ccUserData[0]['customer_id']; $update = $db->update($glob['dbprefix']."StreamRush_band_Members", $record, $where); } else { $insert = $db->insert($glob['dbprefix']."StreamRush_band_Members", $record); } } } And here is the mysql database table code -- phpMyAdmin SQL Dump -- version 2.10.0.2 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Sep 13, 2007 at 11:21 AM -- Server version: 5.0.27 -- PHP Version: 4.4.4 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Database: `streamru_streamrush` -- -- -------------------------------------------------------- -- -- Table structure for table `cc_CubeCart_band_Members` -- CREATE TABLE `cc_CubeCart_band_Members` ( `image` varchar(50) default NULL, `firstName` varchar(255) default NULL, `lastName` varchar(255) default NULL, `location` varchar(100) default NULL, `info` varchar(255) default NULL, `influences` char(3) default NULL, `customer_id` int(11) NOT NULL default '0', `instrument` varchar(255) default NULL, PRIMARY KEY (`customer_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `cc_CubeCart_band_Members` -- Quote Link to comment https://forums.phpfreaks.com/topic/69210-empty-query/ Share on other sites More sharing options...
GingerRobot Posted September 13, 2007 Share Posted September 13, 2007 I would assume that this line: $members = $db->select($members); Is supposed to be: $members = $db->select($query); Quote Link to comment https://forums.phpfreaks.com/topic/69210-empty-query/#findComment-347839 Share on other sites More sharing options...
ccrevcypsys Posted September 13, 2007 Author Share Posted September 13, 2007 lol im really dumb haha Quote Link to comment https://forums.phpfreaks.com/topic/69210-empty-query/#findComment-347841 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.