Código MySQL :
CREATE TABLE IF NOT EXISTS `surf` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user` int(11) NOT NULL DEFAULT '0', `url` varchar(255) NOT NULL, `title` varchar(255) NOT NULL, `clicks` int(11) NOT NULL DEFAULT '0', `today_clicks` int(11) NOT NULL DEFAULT '0', `max_clicks` int(11) NOT NULL DEFAULT '0', `daily_clicks` int(11) NOT NULL DEFAULT '0', `active` smallint(2) NOT NULL DEFAULT '0', `cpc` int(11) NOT NULL DEFAULT '2', `country` varchar(64) NOT NULL DEFAULT '0', `sex` smallint(2) NOT NULL DEFAULT '0', `noref` smallint(1) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ; -- -- Volcado de datos para la tabla `surf` -- INSERT INTO `surf` (`id`, `user`, `url`, `title`, `clicks`, `today_clicks`, `max_clicks`, `daily_clicks`, `active`, `cpc`, `country`, `sex`, `noref`) VALUES (3, 1, 'http://appmarino.com', 'redddd', 0, 0, 0, 0, 0, 5, '0', 0, 0), (2, 2, 'http://www.esmas.com', 'esmas', 1, 1, 0, 0, 0, 5, '0', 0, 0), (4, 1, 'http://google.com', 'google', 0, 0, 0, 0, 0, 5, '0', 0, 0);
donde ocupo que cada "user" tenga una pagina "url" y que si no lo tenga la url agregada oculte un contenido y muestre un mensaje de error
tengo algo asi pero no logro hacer que funciene necesito algo mas sencillo
Código PHP :
<?php } } elseif($surfType == 0 && $site['surf_system'] == 0){ if($site['target_system'] != 2){ $dbt_value = " AND (a.country = '0' OR FIND_IN_SET('".$data['country']."', a.country)) AND (a.sex = '".$data['sex']."' OR a.sex = '0')"; } $sites = $db->QueryFetchArrayAll("SELECT a.id, a.url, a.title, a.cpc, b.premium FROM surf a LEFT JOIN users b ON b.id = a.user LEFT JOIN surfed c ON c.user_id = '".$data['id']."' AND c.site_id = a.id WHERE a.active = '0' AND (a.max_clicks > a.clicks OR a.max_clicks = '0') AND (a.daily_clicks > a.today_clicks OR a.daily_clicks = '0') AND (b.coins >= a.cpc AND a.cpc >= '2') AND (c.site_id IS NULL AND a.user !='".$data['id']."')".$dbt_value." ORDER BY a.cpc DESC, b.premium DESC LIMIT 15"); $total_pages = count($sites); if($total_pages == 0){ echo '<div class="msg"><div class="error">'.$lang['b_163'].'</div><div class="info"><a href="buy.php"><b>'.$lang['b_164'].'</b></a></div></div>'; }else{ ?>