0

i can't get my head around how i am suposed todo this really i am stuck i have looked on tons of forums mostly this forum and what i would like to do is if a person goes on this link play?p=rLoYvtMNlO then it will load the data from that row the video_id rLoYvtMNlO it will load things like title tags media links
and because alot of these video_ids are being made they need to connect to the right id and load the right page
i hope you get where i am coming from
Thank you if you can help me with this

4
Contributors
11
Replies
12
Views
6 Years
Discussion Span
Last Post by videoscape
0

Hello, maybe I didn’t understand something correctly. With $_GET["p"] you will have the video_id that you are looking for {you could check first that there is a p var in url { if(isset($_GET["p"]) } } . Then the flow is simply MySql commands that if you need help with them just publish the table structure and the logic of the query and we could help.

0

this is mysql export if you want it tell me if want anything else there is no script because i dont know whwre to start

-- phpMyAdmin SQL Dump
-- version 3.3.9
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 31, 2011 at 06:51 PM
-- Server version: 5.0.77
-- PHP Version: 5.3.2

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `beta_videos`
--

-- --------------------------------------------------------

--
-- Table structure for table `videos`
--

CREATE TABLE IF NOT EXISTS `videos` (
`video_id` varchar(20) NOT NULL,
`title` varchar(50) NOT NULL,
`description` varchar(100) NOT NULL,
`tags` varchar(50) NOT NULL,
`id` int(10) NOT NULL auto_increment,
`name` varchar(200) character set utf8 collate utf8_unicode_ci NOT NULL,
`type_src` varchar(6) character set utf8 collate utf8_unicode_ci default NULL,
`type_new` varchar(6) character set utf8 collate utf8_unicode_ci default NULL,
`date` datetime default NULL,
`number_of_images` int(3) default NULL,
`duration` varchar(10) NOT NULL default '00:00:00',
`size` decimal(10,2) default NULL,
`video_quality` varchar(16) character set utf8 collate utf8_bin NOT NULL default '0',
`audio_quality` varchar(16) character set utf8 collate utf8_bin NOT NULL default '0',
`display_size` varchar(16) character set utf8 collate utf8_bin NOT NULL default '0',
`mail` varchar(200) character set utf8 collate utf8_bin NOT NULL default '0',
`converted` varchar(25) character set utf8 collate utf8_unicode_ci NOT NULL default 'No',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=85 ;

--
-- Dumping data for table `videos`
--

0

A prepared statement query to do using PDO
Lets say that
Data Base name: $database
Host: $host (localhost)
Data Base User Name: $dbUser
DB password: $dbUserPasswod

<?php
if(isset($_GET("p"))
{
  $db = new Pwf_Data_Db('mysql:dbname=$database;host=$host,$dbUser,$dbUserPasswod');
  $query = "SELECT * FROM videos WHERE video_id = ?";
  $statement = $db->prepare($query);
  $statement->execute($_GET("p"));
  $result = $statement->fetchAll(PDO::FETCH_ASSOC);
  if(count($result)>0)
  {
    // I found the row in database , for example duration is $result[0]["duration"]
  }
  else 
  {
    // I didn't found anything with that p (video_id) in database so I should do something
  }
}
else 
{
  // Do something if there is no p in get
}
?>
0

sorry
not

$db = new Pwf_Data_Db('mysql:dbname=$database;host=$host,$dbUser,$dbUserPasswod');

but

$db = new PDO('mysql:dbname=$database;host=$host,$dbUser,$dbUserPasswod');
0

i have got an error with that code
[Mon Jan 31 19:34:39 2011] [error] [client 80.3.23.180] PHP Fatal error: Can't use function return value in write context in /var/www/html/play.php on line 7

0

I must admit that I wrote the example rather quickly , the correct example is

<?php
if(isset($_GET["p"]))
{
	$db = new PDO("mysql:host=$host;dbname=$database", $dbUser, $dbUserPasswod);
	$query = "SELECT * FROM videos WHERE video_id = ?";
	$statement = $db->prepare($query);
	$statement->execute(array($_GET["p"]));
	if($statement->errorCode()!="00000")
	{
		$error = $statement->errorInfo();
		throw new Exception($error[2],(int)$error[0]);
	}
	$result = $statement->fetchAll(PDO::FETCH_ASSOC);
	if(count($result)>0)
	{
		//I found the row in database , for example duration is $result[0]["duration"]
	}
	else
	{
		// I didn't found anything with that p (video_id) in database so I should do something
	}
}
else
{
	// Do something if there is no p in get
}
?>
0

i got another error [Tue Feb 01 09:03:21 2011] [error] [client 80.3.23.180] PHP Fatal error: Uncaught exception 'Exception' with message 'No database selected' in /var/www/html/play.php:11\nStack trace:\n#0 {main}\n thrown in /var/www/html/play.php on line 11, referer: http://www.videoscape.org/

Thank you for helping me though this

0

You must set first $database (the database name) , $host (the host , usally localhost) , $dbUser (the name of the db user that has access to that database) and $dbUserPasswod the password of the user.

0

i got another error [Tue Feb 01 09:03:21 2011] [error] [client 80.3.23.180] PHP Fatal error: Uncaught exception 'Exception' with message 'No database selected' in /var/www/html/play.php:11\nStack trace:\n#0 {main}\n thrown in /var/www/html/play.php on line 11, referer: http://www.videoscape.org/

Thank you for helping me though this

Boss...somebody can tell you and guide you how things can be done...You are looking for quick-fix solutions. If you have a video site. You must go for long-term solution. If u r an entrepreneur, you must be willing to put in hours. Without learning PHP how r u expecting the others to write code for u.

The vision you have for your site nobody else has. I would advise learn some PHP.

From the thread I can make out you are not even able to debug the basic errors that are coming through.

0

i fixed it and the site is running well i just got the hardware needed and the convertions done

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.