$dbname = 'videor'; url: http://www.website.com/?videoVID=2 ----------------------------------------------------------------------------------------------------------- MySql DB Videor: VID____Active____Title_____Weburl___________AddDate_____ViewNumber_____UserIp 1______0________Dogs____http://web.com____2010-06-01___2____________________ 2______0________Cat_____http://web2.com___2010-06-01___3____________________ ----------------------------------------------------------------------------------------------------------- how i can show if videoVID=2 | echo from dbname Title | what Title = Cat hope someone can help me with this, im new on this and im tryng to learn
Im not sure I follow what you are trying to do - can you explain it a bit more? Do you mean something like; <?php if(!empty($_GET['videoVID'])) { # if its user inputted values, make sure you validate it properly $value = $_GET['videoVID']; if(!is_numeric($value)) $value = "'" . mysql_real_escape_string($value) . "'"; $query = mysql_query("SELECT title FROM videor WHERE VID = $value"); $result = mysql_fetch_array($query) or die (mysql_error()); print_r($result); } ?> PHP:
thanks lukeg32 that im tryng to make but i still have one problem $dbname = 'videor'; $db_conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); $db_found = mysql_select_db($dbname); if(!empty($_GET['videoVID'])) { # if its user inputted values, make sure you validate it properly $value = $_GET['videoVID']; if(!is_numeric($value)) $value = "'" . mysql_real_escape_string($value) . "'"; $query = mysql_query("SELECT Title FROM web_video WHERE VID = $value"); $result = mysql_fetch_array($query) or die (mysql_error()); print_r($result); } PHP: i add this code but is show me on the page " Array ( [0] => Cute Girl Lost In The Wood [Title] => Cute Girl Lost In The Wood ) " how i can make to show just " Cute Girl Lost In The Wood "
Change this line - this is just dumping the entire record set; print_r($result); PHP: to this; print $result['title']; PHP: