Jump to content

mike16889

Members
  • Posts

    23
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

mike16889's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. thanks for that, i haven't tested it yet but that would definitely do it, knew it was a typo somewhere (copy and paste error).
  2. ok, im writing a simple CRUD application for my work and i am having trouble with the UPDATE statement in the following code, the insert statement works fine. frm_bpd_sv.php: <?php error_reporting(-1); $page['title'] = "BPD Save"; require_once('config.inc.php'); if(isset($_SESSION['jobDetailID'])){ $jobdetailid = $_SESSION['jobDetailID']; } else { header("location:index.php"); } try { $dbh = new PDO("mysql:host=$db_host;dbname=$db_name", $db_username, $db_password); } catch(PDOException $e){ echo $e->getMessage(); } if(isset($_GET['editID'])){$data['bpdID'] = $_GET['editID'];} $data['jobDetailID'] = $jobdetailid; if(isset($_POST['backflowID'])){$data['backflowID'] = $_POST['backflowID'];} else {$data['backflowID'] = null;} if(isset($_POST['bpdOnsite'])){$data['bpdOnsite'] = $_POST['bpdOnsite'];} else {$data['bpdOnsite'] = 0;} if(isset($_POST['bpdLocation'])){$data['bpdLocation'] = $_POST['bpdLocation'];} else {$data['bpdLocation'] = null;} if(isset($_POST['bpdMake'])){$data['bpdMake'] = $_POST['bpdMake'];} else {$data['bpdMake'] = null;} if(isset($_POST['bpdModel'])){$data['bpdModel'] = $_POST['bpdModel'];} else {$data['bpdModel'] = null;} if(isset($_POST['bpdSerial'])){$data['bpdSerial'] = $_POST['bpdSerial'];} else {$data['bpdSerial'] = null;} if(isset($_POST['bpdSize'])){$data['bpdSize'] = $_POST['bpdSize'];} else {$data['bpdSize'] = null;} if(isset($_POST['protectionType'])){$data['protectionType'] = $_POST['protectionType'];} else {$data['protectionType'] = null;} if(isset($_POST['bpdType'])){$data['bpdType'] = $_POST['bpdType'];} else {$data['bpdType'] = null;} if(isset($_POST['protectionLvl'])){$data['protectionLvl'] = $_POST['protectionLvl'];} else {$data['protectionLvl'] = null;} if(isset($_POST['wmNo'])){$data['wmNo'] = $_POST['wmNo'];} else {$data['wmNo'] = null;} if(isset($_POST['wmSize'])){$data['wmSize'] = $_POST['wmSize'];} else {$data['wmSize'] = null;} if(isset($_POST['wmLocation'])){$data['wmLocation'] = $_POST['wmLocation'];} else {$data['wmLocation'] = null;} if(isset($_POST['sprinklers'])){$data['sprinklers'] = $_POST['sprinklers'];} else {$data['sprinklers'] = null;} if(isset($_POST['drinkingTaps'])){$data['drinkingTaps'] = $_POST['drinkingTaps'];} else {$data['drinkingTaps'] = null;} if(isset($_POST['longitude'])){$data['longitude'] = $_POST['longitude'];} else {$data['longitude'] = null;} if(isset($_POST['latitude'])){$data['latitude'] = $_POST['latitude'];} else {$data['latitude'] = null;} if(isset($_POST['accuracy'])){$data['accuracy'] = $_POST['accuracy'];} else {$data['accuracy'] = null;} if(isset($_POST['activity'])){$data['activity'] = $_POST['activity'];} else {$data['activity'] = null;} if(isset($_POST['permisionTTOW'])){$data['permisionTTOW'] = $_POST['permisionTTOW'];} else {$data['permisionTTOW'] = null;} if(isset($_POST['comments'])){$data['comments'] = $_POST['comments'];} else {$data['comments'] = null;} if(isset($_POST['pass'])){$data['pass'] = $_POST['pass'];} else {$data['pass'] = null;} print_r($data); echo '<hr>'.$_GET['editID']; if(isset($_GET['editID'])){ $editID = $_GET['editID']; $temp = "UPDATE frm_bpd SET `backflowID` = :backflowID, `jobDetailID` = :jobDetailID, `bpdOnsite` = :bpdOnsite, `bpdLocation` = :bpdLocation, `bpdMake` = :bpdMake, `bpdModel` = :bpdModel, `bpdSerial` = :bpdSerial, `bpdSize` = :bpdSize, `protectionType` = :protectionType, `bpdType` = :bpdType, `protectionLvl` = :protectionLvl, `wmNo` = :wmNo, `wmSize` = :wmSize, `wmLocation` = :wmLocation, `sprinklers` = :sprinklers, `drinkingTaps` = :drinkingTaps, `longitude` = :longitude, `latitude` = :latitude, `accuracy` = :accuracy, `activity` = :activity, `permisionTTOW` = :permisionTTOW, `comments` = :comments, `pass` = :pass` WHERE `bpdID` = :bpdID"; } else { $editID = false; $temp = "INSERT INTO frm_bpd (`backflowID`, `jobDetailID`, `bpdOnsite`, `bpdLocation`, `bpdMake`, `bpdModel`, `bpdSerial`, `bpdSize`, `protectionType`, `bpdType`, `protectionLvl`, `wmNo`, `wmSize`, `wmLocation`, `sprinklers`, `drinkingTaps`, `longitude`, `latitude`, `accuracy`, `activity`, `permisionTTOW`, `comments`, `pass`) VALUES (:backflowID, :jobDetailID, :bpdOnsite, :bpdLocation, :bpdMake, :bpdModel, :bpdSerial, :bpdSize, :protectionType, :bpdType, :protectionLvl, :wmNo, :wmSize, :wmLocation, :sprinklers, :drinkingTaps, :longitude, :latitude, :accuracy, :activity, :permisionTTOW, :comments, :pass);"; } try { $sql = $dbh->prepare($temp); $sql->execute($data); $succsess = 1; } catch(PDOException $e) { header("location:frm_bpd.php?id=".$editID."&message=".$e->getMessage()); $succsess = 0; } if($editID == false){ $editID = $dbh->lastInsertId(); } /*if($succsess == 1){ header("location:frm_bpd.php?id=".$editID."&message=BPD%20Saved"); } else { header("location:frm_bpd.php?id=".$editID."&message=An%20Error%20Occured"); }*/ ?> frm_bpd Table: -- phpMyAdmin SQL Dump -- version 4.1.4 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Feb 10, 2014 at 01:36 AM -- Server version: 5.6.15-log -- PHP Version: 5.4.24 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; -- -- Database: `omni` -- -- -------------------------------------------------------- -- -- Table structure for table `frm_bpd` -- CREATE TABLE IF NOT EXISTS `frm_bpd` ( `bpdID` int(11) NOT NULL AUTO_INCREMENT, `backflowID` varchar(255) DEFAULT NULL, `jobDetailID` int(11) DEFAULT NULL, `bpdOnsite` tinyint(11) DEFAULT '0', `bpdLocation` varchar(255) DEFAULT NULL, `bpdMake` varchar(255) DEFAULT NULL, `bpdModel` varchar(255) DEFAULT NULL, `bpdSerial` varchar(255) DEFAULT NULL, `bpdSize` int(11) DEFAULT NULL, `protectionType` tinyint(11) DEFAULT NULL, `bpdType` tinyint(4) DEFAULT NULL, `protectionLvl` tinyint(4) DEFAULT NULL, `wmNo` varchar(255) DEFAULT NULL, `wmSize` int(11) DEFAULT NULL, `wmLocation` varchar(255) DEFAULT NULL, `sprinklers` tinyint(11) DEFAULT NULL, `drinkingTaps` tinyint(11) DEFAULT NULL, `longitude` varchar(255) DEFAULT NULL, `latitude` varchar(255) DEFAULT NULL, `accuracy` int(11) DEFAULT NULL, `activity` tinyint(11) DEFAULT NULL, `permisionTTOW` tinyint(11) DEFAULT NULL, `comments` varchar(255) DEFAULT NULL, `pass` tinyint(11) DEFAULT NULL, UNIQUE KEY `bpdID` (`bpdID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; -- -- Dumping data for table `frm_bpd` -- INSERT INTO `frm_bpd` (`bpdID`, `backflowID`, `jobDetailID`, `bpdOnsite`, `bpdLocation`, `bpdMake`, `bpdModel`, `bpdSerial`, `bpdSize`, `protectionType`, `bpdType`, `protectionLvl`, `wmNo`, `wmSize`, `wmLocation`, `sprinklers`, `drinkingTaps`, `longitude`, `latitude`, `accuracy`, `activity`, `permisionTTOW`, `comments`, `pass`) VALUES (1, NULL, 1328449, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (2, NULL, 1328449, -1, '2', '3', '4', '5', 6, 1, 2, NULL, '7', 8, '9', -1, -1, NULL, '', 0, 2, -1, 'bla', -1); output of $data with print_r(); Array ( [bpdID] => 1 [jobDetailID] => 1328449 [backflowID] => [bpdOnsite] => -1 [bpdLocation] => some [bpdMake] => [bpdModel] => [bpdSerial] => [bpdSize] => [protectionType] => 0 [bpdType] => 0 [protectionLvl] => [wmNo] => [wmSize] => [wmLocation] => [sprinklers] => [drinkingTaps] => [longitude] => [latitude] => [accuracy] => [activity] => 0 [permisionTTOW] => [comments] => [pass] => ) i know it must be a typo somewhere but i just cant spot it, as i said the insert statement works fine, and no errors are being thrown. am i just not using the UPDATE statement correctly? any help would be greatly appreciated.
  3. I just used NotePad++ find and replace on the SQL dump for column names and NotePad ++ and open office calc for the array only took about 2 mins
  4. thanx for the help, i ended up just doing this: $statement = $db->prepare("INSERT INTO job (jobDetailID,JobNo,Sequence,Initias,jobDate,ClientName,jobLocation,jobAddress,jobSuburb,jobContact,jobPhone,jobMobile,jobDescription,trafficyn,traffic,worklayoutyn,worklayout,machyn,mach,fireyn,fire,weldyn,weld,heightsyn,heights,handelingyn,hndleing,elecyn,elec,plantyn,plant,weatheryn,weather,noiseyn,noise,lightingyn,lighting,scafoldyn,saftyNetyn,handrailyn,harnessyn,PermitNo,jobComplete,startTime,endTime,travel,onSite,TotalTime,overTime,worksDescription, SequenceClose,taskOrder,clientOrderNo,appointmentTime) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); $statement->execute(array($newValue[0],$newValue[1], $newValue[2], $newValue[3], $newValue[4], $newValue[5], $newValue[6], $newValue[7], $newValue[8], $newValue[9], $newValue[10], $newValue[11], $newValue[12], $newValue[13], $newValue[14], $newValue[15], $newValue[16], $newValue[17], $newValue[18], $newValue[19], $newValue[20], $newValue[21], $newValue[22], $newValue[23], $newValue[24], $newValue[25], $newValue[26], $newValue[27], $newValue[28], $newValue[29], $newValue[30], $newValue[31], $newValue[32], $newValue[33], $newValue[34], $newValue[35], $newValue[36], $newValue[37], $newValue[38], $newValue[39], $newValue[40], $newValue[41], $newValue[42], $newValue[43], $newValue[44], $newValue[45], $newValue[46], $newValue[47], $newValue[48], $newValue[49], $newValue[50], $newValue[51], $newValue[52], $newValue[53] ));
  5. Thanx for your help so far. whats the best way for me to pull this off? am i going to have to label all the fields in the SQL statment and then take each peace of data and insert it individually or can i somehow just pass the Array to it with the 1st field being at [1] and the second at [2] and so on?
  6. i don't rly need to worry about SQL injection, this is not, nor will ever be publicly accessible. so could i do something like this? $statement->execute(array('INSERT INTO job VALUES '.$sqlString))
  7. it doesn't insert the entry to the database
  8. ok, bascly im building an app for my work for android that allows the user to download info about a job they have to go to, fill out details and submit it. but im having trouble getting the updated data back in the database. here is my table CREATE TABLE IF NOT EXISTS `job` ( `jobDetailID` int(11) NOT NULL, `JobNo` int(11) NOT NULL, `Sequence` int(11) NOT NULL, `Initias` varchar(10) NOT NULL, `jobDate` date NOT NULL, `ClientName` varchar(255) NOT NULL, `jobLocation` varchar(255) NOT NULL, `jobAddress` varchar(255) NOT NULL, `jobSuburb` varchar(255) NOT NULL, `jobContact` varchar(255) NOT NULL, `jobPhone` varchar(10) NOT NULL, `jobMobile` varchar(10) NOT NULL, `jobDescription` varchar(255) NOT NULL, `trafficyn` tinyint(1) NOT NULL, `traffic` varchar(255) NOT NULL, `worklayoutyn` tinyint(1) NOT NULL, `worklayout` varchar(255) NOT NULL, `machyn` tinyint(1) NOT NULL, `mach` varchar(255) NOT NULL, `fireyn` tinyint(1) NOT NULL, `fire` varchar(255) NOT NULL, `weldyn` tinyint(1) NOT NULL, `weld` varchar(255) NOT NULL, `heightsyn` tinyint(1) NOT NULL, `heights` varchar(255) NOT NULL, `handelingyn` tinyint(1) NOT NULL, `hndleing` varchar(255) NOT NULL, `elecyn` tinyint(1) NOT NULL, `elec` varchar(255) NOT NULL, `plantyn` tinyint(1) NOT NULL, `plant` varchar(255) NOT NULL, `weatheryn` tinyint(1) NOT NULL, `weather` varchar(255) NOT NULL, `noiseyn` tinyint(1) NOT NULL, `noise` varchar(255) NOT NULL, `lightingyn` tinyint(1) NOT NULL, `lighting` varchar(255) NOT NULL, `scafoldyn` tinyint(1) NOT NULL, `saftyNetyn` tinyint(1) NOT NULL, `handrailyn` tinyint(1) NOT NULL, `harnessyn` tinyint(1) NOT NULL, `PermitNo` int(11) NOT NULL, `jobComplete` tinyint(1) NOT NULL, `startTime` decimal(10,0) NOT NULL, `endTime` decimal(10,0) NOT NULL, `travel` decimal(10,0) NOT NULL, `onSite` decimal(10,0) NOT NULL, `TotalTime` decimal(10,0) NOT NULL, `overTime` decimal(10,0) NOT NULL, `worksDescription` longtext NOT NULL, `SequenceClose` tinyint(1) NOT NULL, `taskOrder` int(11) NOT NULL, `clientOrderNo` varchar(255) NOT NULL, `appointmentTime` varchar(255) NOT NULL, PRIMARY KEY (`jobDetailID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; and here is my PHP <?php //Temp String's $tag = 112234; $value = <<<EOD [\"112234\",\"104104\",\"0\",\"MR\",\"2012-07-09\",\"Service Stream\",\"some building\",\"1 Luck St\",\"Mowbray\",\"me\",\"0363262617\",\"0400557999\",\"Comma, FullStop. Bakcslash\\/ colan: semicolan; dblQoute\\\" Qoute\' openBracket( closeBracket) star* percent% d\",true,\"\",true,\"\",true,\"\",true,\"\",false,\"\",false,\"\",false,\"\",true,\"\",true,\"\",true,\"\",true,\"\",false,\"\",false,true,true,false,\"123456\",true,\"10\",\"11:30\",\".5\",\"1\",\"1.5\",\"0\",\"Works i completed\",true,\"0\",\"1612123456\",\"8am\"] EOD; //$tag = $_POST['tag']; //$value = $_POST['value']; $value = str_replace('\"', '&&TEMPSTRING&&', $value); $value = str_replace('"', '\"', $value); $value = str_replace('&&TEMPSTRING&&', '"', $value); $value = substr($value, 2, -1); $newValue = explode(",", $value); $host = 'localhost'; $port = 3306; $database = 'JobDispatch'; $username = 'root'; $password = ''; print_r($newValue); echo '<br />'; $newValue[1] = intval($newValue[1]); $newValue[2] = intval($newValue[2]); $newValue[3] = intval($newValue[3]); $newValue[42] = intval($newValue[42]); $newValue[52] = intval($newValue[52]); $sqlString = implode(", ", $newValue); try { $dsn = "mysql:host=$host;port=$port;dbname=$database"; $db = new PDO($dsn, $username, $password); $statement = $db->prepare("DELETE FROM job WHERE jobDetailID = ?"); $statement->execute(array($tag)); $statement = $db->prepare('INSERT INTO job VALUES (?)'); $statement->execute(array($sqlString)); } catch (PDOException $e) { echo 'Connection failed: ' . $e->getMessage(); }; echo $sqlString; ?> eventual it will be called by the app but for now i just have set the string the app submits saved to a veriable. i then manipulate the string a bit so if fits the database a bit better. but for some reason when i try to insert the data it just doesn't work and i cant figure out why. any ideas?
  9. thanx man, that stopped it from giving the that error but now its just not inserting the data, not sure why. here is the table its going into if that helps. SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; CREATE TABLE IF NOT EXISTS `eppisodes` ( `id` int(11) NOT NULL AUTO_INCREMENT, `showID` int(11) NOT NULL, `eppname` varchar(255) NOT NULL, `eppdesc` longtext NOT NULL, `airdate` date NOT NULL, `format` int(11) NOT NULL, `tvdbid` varchar(20) NOT NULL, `dohave` tinyint(1) NOT NULL, `season` varchar(2) NOT NULL, `eppisode` varchar(3) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  10. i have been trying to write a script to take an xml file from thetvdb and import the data into a mysql database, but it keeps saying: Chuck Versus the Third Dimension (2D):Chuck Versus the Third Dimension (2D):You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Versus the Third Dimension (2D):, Chuck foils a plan to kill Tyler Martin' at line 1 the sample.xml is this file http://www.thetvdb.com/api/217F7921A2EA56C0/series/80348/all/en.xml and here is my code: <?php $tvdb_mirror = "http://www.thetvdb.com/api/"; $tvdb_time = "http://www.thetvdb.com/api/Updates.php?type=none"; $dbname = "mediadb"; $dbuser = "root"; $dbpass = ""; $dbserv = "127.0.0.1"; $rss = simplexml_load_file('sample.xml'); $showName = "Show Name = ".$rss->Series->SeriesName; mysql_connect('127.0.0.1', 'root', ''); @mysql_select_db('mediadb') or die("Unable to select database"); echo ' '; foreach ($rss->Episode as $item) { $seasonnum = $item->Combined_season; $EpisodeNumber = $item->EpisodeNumber; if($EpisodeNumber < 10){ $EpisodeNumber = "0".$EpisodeNumber; }; $EpisodeName1 = $item->EpisodeName; $EpisodeName1 = str_replace($array1, $array2, $EpisodeName1 ); echo $EpisodeName1; $EpisodeName = mysql_real_escape_string($EpisodeName1); echo $EpisodeName; $Overview1 = $item->Overview; $Overview = mysql_real_escape_string($Overview1); $airdate = $item->FirstAired; $tvdbid = $item ->id; $query = "INSERT INTO eppisodes VALUES('1', ".$EpisodeName.", ".$Overview.", ".$airdate.", '1', ".$tvdbid.", '-1', ".$seasonnum.", ".$EpisodeNumber.")"; mysql_query($query) or die (mysql_error()); print "<br />".$showName." - ".$seasonnum."x".$EpisodeNumber." - ".$EpisodeName." Overview:<br />".$Overview; } mysql_close(); ?> i think its to do with the contents of the xml file, i thing there are special charictors in there breaking out of the mysql, but iv tried html entaties and mysql special escape string and nither seem to work, i even tried to use str_replace to replace all the commas and stuff with &#39; and the like. not sure were to go from here. any help? please?
  11. cool thanx man, that sorted that, there are few more issues now but ill sort em out, thanx
  12. im trying to write a script takes an xml files with tv show info, splits it into the show and the eppisode info and the place it into a table, i have got it to proccess all the info and print it out on a web page, but i cant, for the life of me, get it to insert said data into the table, it seems to be just ignoring the code and prints out the data as if nothing happens, no errors or anything. here is my code (abit messy but im only just starting and its my test.php) <?php $tvdb_mirror = "http://www.thetvdb.com/api/"; $tvdb_time = "http://www.thetvdb.com/api/Updates.php?type=none"; $dbname = "mediadb"; $dbuser = "root"; $dbpass = ""; $dbserv = "127.0.0.1"; $rss = simplexml_load_file('sample.xml'); $showName = "Show Name = ".$rss->Series->SeriesName; print $showName; print "<br />Show Discription = ".$rss->Series->Overview; print "<br />"; mysql_connect('127.0.0.1', 'root', ''); @mysql_select_db('mediadb') or die("Unable to select database"); foreach ($rss->Episode as $item) { $seasonnum = $item->Combined_season; $EpisodeNumber = $item->EpisodeNumber; if($EpisodeNumber < 10){ $EpisodeNumber = "0".$EpisodeNumber; }; $EpisodeName = $item->EpisodeName; $Overview = $item->Overview; $airdate = $item->FirstAired; $tvdbid = $item ->id; $query = "INSERT INTO eppisodes VALUES('', '1', ".$EpisodeName.", ".$Overview.", ".$airdate.", '1', ".$tvdbid.", '-1', ".$seasonnum.", ".$EpisodeNumber.")"; mysql_query($query); print "<br />".$showName." - ".$seasonnum."x".$EpisodeNumber." - ".$EpisodeName." Overview:<br />".$Overview; } mysql_close(); ?> i am a noob @ php and mysql, but i have doubke and triple checked the names of the db and table. here is an sql dump of my db -- phpMyAdmin SQL Dump -- version 3.3.5 -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 -- Generation Time: Nov 13, 2010 at 12:48 PM -- Server version: 5.1.49 -- PHP Version: 5.3.3 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `mediadb` -- -- -------------------------------------------------------- -- -- Table structure for table `eppisodes` -- CREATE TABLE IF NOT EXISTS `eppisodes` ( `id` int(11) NOT NULL AUTO_INCREMENT, `showID` int(11) NOT NULL, `eppname` varchar(255) NOT NULL, `eppdesc` longtext NOT NULL, `airdate` date NOT NULL, `format` int(11) NOT NULL, `tvdbid` varchar(20) NOT NULL, `dohave` tinyint(1) NOT NULL, `season` varchar(2) NOT NULL, `eppisode` varchar(3) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; -- -- Dumping data for table `eppisodes` -- -- -------------------------------------------------------- -- -- Table structure for table `shows` -- CREATE TABLE IF NOT EXISTS `shows` ( `id` int(100) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL, `description` longtext NOT NULL, `TVDBID` int(100) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Dumping data for table `shows` -- INSERT INTO `shows` (`id`, `name`, `description`, `TVDBID`) VALUES (1, 'higogo', 'some info', 67546); any help would be very much appericiated. fyi im running win7 with easyPHP 5.3.3 with php 5.3.3, mysql 5.1.49 apache 2.2.16
  13. @Mchl = as i said i'm adding this onto another system that allready has its usertables and stuff set up and i;m trying to keep this as small and simple as i can. @sasa = i did'nt actualy end up using your solution but it got me thinking. i have now made a small scrip that works, here it is: $fpmmG_userclass = "1,2,3"; $fpmmG_userclassarray = explode(",", $fpmmG_userclass); $fpmmG_permissions = "4,5"; $fpmmG_permissionsarray = explode(",", $fpmmG_permissions); $fpmmG_permissionsdiff = array_diff($fpmmG_permissionsarray, $fpmmG_userclassarray); if($fpmmG_permissionsarray == $fpmmG_permissionsdiff){ echo 'Sorry you can\'t'; } else { echo 'You Have Permssion'; }; thanx anyway.
  14. i'm making an image gallery for a few other cms's/forums and i want to limit certain gallery's to certain user groups. i was simply going to have some check boxes so the admin can check the boxes of the user groups and then it would be stored in a table like this: 1, 2, 5, 8 and so on, and then just use the explode function to place them into an array. then i would simply do an in_array comparing the user's class and the permissions in the gallery, but the problem is when a user is a few different userclasses there userclass number ends up like this: 1, 4, 8 excreta. is there any easy way to compare 2 array's and give a true (or similar) output if any of the array contents match? p.s. I'm still a beginner...
  15. esentualy just this http://domain.com/stuff/link1.htm http://domain.com/stuff/link2.htm http://domain.com/stuff/link3.htm http://domain.com/stuff/link4.htm http://domain.com/stuff/link5.htm
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.