Last active
December 25, 2015 11:39
-
-
Save ricardosiri68/6970709 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Database: `images` | |
-- | |
-- -------------------------------------------------------- | |
-- | |
-- Table structure for table `imagenes` | |
-- | |
CREATE TABLE IF NOT EXISTS `positions` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`cat` varchar(70) NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=MyISAM DEFAULT CHARSET=utf8; | |
-- | |
-- Dumping data for table `positions` | |
-- | |
INSERT INTO `positions` (`id`, `cat`) VALUES | |
(1, 'page1' ), | |
(2, 'page2'), | |
(3, 'page3'), | |
(4, 'page4'), | |
(5, 'page5'), | |
(6, 'page6'), | |
(7, 'page7'); | |
-- | |
-- Constraints for dumped tables | |
-- | |
-- | |
-- Constraints for table `positions` | |
-- | |
CREATE TABLE IF NOT EXISTS `imagenes` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`name` varchar(36) NOT NULL, | |
`position_id` int(11) NOT NULL REFERENCES positions (id), | |
`ruta` varchar(54) NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; | |
-- | |
-- Dumping data for table `imagenes` | |
-- | |
-- -------------------------------------------------------- | |
-- | |
-- Table structure for table `positions` | |
-- | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$query = "SELECT * FROM imagenes WHERE name='$name'"; | |
$query_scan = $conections->query($query); | |
$num_regs = $query_scan->num_rows; | |
//si no existe el video se da de alta | |
if ( $num_regs == 0) | |
//insertion | |
{ | |
$query = "INSERT INTO imagenes (name,position_id,ruta) VALUES | |
('$name',$categoria,'$ruta')"; | |
echo $query; | |
$query_scan = $conections->query(utf8_encode($query)); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment