Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP Help: Passing selection/link to a page
Old 11-07-2010, 09:27 AM PHP Help: Passing selection/link to a page
Novice Talker

Posts: 14
Location: UK
Trades: 0
Hi All,

Need some help here; this should be pretty basic but it's been a while since I've done anything PHP related and I can't think how to do this!

I'm working on a personal portfolio site, and at present I have a grid that pulls data from my SQL database.

Each cell in the grid has a video thumbnail, the video title and assorted information.

What I'm looking to do is when a thumbnail or the title is clicked the page changes to a default video page which would then be passed the info of the clicked video and only pull that record from the database:

So for example, there might be video1, video2, video3 in the grid, but when the thumb is clicked it loads up a videos page containing the clicked video.

I could do this by creating a static page for each video that only pulls the record, but instead of having 5-10 different pages I'd like to only have one.

The other thing I would like to happen is that the video page be directly linkable with a particular video...

The code for my grid page is as follows:
PHP Code:
<?php
$data 
mysql_query("SELECT * FROM video WHERE type = 'Promo' ORDER BY added DESC") or die(mysql_error());
$i 0
echo 
"<table class='griddy'>"
while(
$info mysql_fetch_array$data )) {
    if(
$i === 0) echo "\n<tr>"
    echo 
"<td>";
    echo 
"<img class='still' src='../video/images/{$info['still']}' width='249px' height='148px' />";
    echo 
"<div class='title'>{$info['title']}</div>";
    echo 
"<div class='subtitle'>{$info['subtitle']}</div>";
    echo 
"</td>";
    if(
$i === 2) echo "</tr>"
    
$i++;
}
if(
$i 0) echo "</tr>";
echo 
"</table>";
Any help would be appreciated!
hj8ag is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-07-2010, 09:39 AM Re: PHP Help: Passing selection/link to a page
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Pass it as a parameter in the URI.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-07-2010, 01:17 PM Re: PHP Help: Passing selection/link to a page
Novice Talker

Posts: 14
Location: UK
Trades: 0
Ah yes, can't believe I forgot something so simple! Thanks!

Ok, so I'm doing this via $_GET... Is there any added security I should think about as the variables are being passed in the open?

Also, at the moment I'm using a javascript/jquery combo to load pages into a container div on my site - The script looks something like this:

HTML Code:
<script type="text/javascript">
function loadContent(elementSelector, sourceURL) {
$(""+elementSelector+"").load("http://www.website.com/test/"+sourceURL+"");
}
</script>
And a link looks like this:

HTML Code:
<a href="javascript:loadContent('.content', 'test3.php');">Video</a>
Now, because of the Apostrophe's in this and the Apostrophes needed in my PHP code for the database field names I'm getting syntax errors, for example:

PHP Code:
<a href="javascript:loadContent('.content', 'video.php?video={$info['title']}'');">{$info['title']}</a
Does anyone know a way I can make this work?!
hj8ag is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP Help: Passing selection/link to a page
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.20489 seconds with 12 queries