954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Php mysql image scroll script??

Hi,

I want to create script like in facebook.

When we log into facebook, go into any friend's profile

Their gift button , show gifts with pagination.
when click on image and ok button it save into database.

Any sample demo script ?
How to create script like this?

Please give me suggestions.

Aamit
Posting Whiz
342 posts since Apr 2008
Reputation Points: 3
Solved Threads: 15
 

You could do this with radio buttons or JavaScript as facebook does.

Obviously we wont write this script for you but here is how it generally works.

<?php

// Run query to retreive gifts
$get_gifts = mysql_query("SELECT * FROM `gifts`");
if( @mysql_num_rows( $get_gifts ) > 0 ) {
echo "<form method=\"submit\" action=\"#\">";
while( $row = mysql_fetch_array( $get_gifts ) ) {
echo "<img src=\"...\" alt=\"...\" />" . $row['title'] . '<input type="radio" name="gift" value="' . $row['title'] . '" />';
}
echo '<input type="submit" name="send" value="Ok" />';
echo "</form>";
}

if( isset( $_POST['send'] ) ) {
$gift = mysql_real_escape_string( $gift );
// Need the user receiving the gifts id etc.
$user_id = "...";
$query = mysql_query("INSERT INTO `received_gifts` (id, gift) VALUES ('$user_id', '$gift')");
echo "<p>Gift sent</p>";
}

?>


Something allong those general lines.

Froger93
Junior Poster in Training
74 posts since Sep 2009
Reputation Points: 11
Solved Threads: 6
 

any demo sample example or script like facebook ?

Or sample link ??

Aamit
Posting Whiz
342 posts since Apr 2008
Reputation Points: 3
Solved Threads: 15
 

Not that I know of the script above will do the same thing virtually just may need a little playing with.

Froger93
Junior Poster in Training
74 posts since Sep 2009
Reputation Points: 11
Solved Threads: 6
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You