Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

Hello to all I need help guys

images php coding issues or problems here.

Moderators: macek, egami, gesf

Hello to all I need help guys

Postby albin » Wed Apr 03, 2013 1:57 pm

hello to all , i need some help with my problem , I have a database and a table called "librat" i save here my books a description book title and book image as longblob , i want a function or some code to print bookimages(as longblob) book title and book author book description , also with pagination ,

Please help for this question :) i have a school project and ai want to get a good vote :)
Attachments
example.jpg
this is an example for my question
example.jpg (122.83 KiB) Viewed 1000 times
albin
New php-forum User
New php-forum User
 
Posts: 4
Joined: Wed Apr 03, 2013 1:35 pm

Re: Hello to all I need help guys

Postby seandisanti » Wed Apr 03, 2013 2:41 pm

show some code of your attempt at doing it yourself.
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: Hello to all I need help guys

Postby albin » Thu Apr 04, 2013 3:24 am

I can upload my php files for me is not a problem , its only a school project . thanks man for the response :)


this is the index where i want to print the images ,
<?php
include("databaseconfig.php");
//include("ClassLIbrat.php");

session_start();
$query = mysql_query("SELECT * FROM librat" );
$row = mysql_fetch_array($query);

$num = mysql_numrows($query);

$i=0;
while ($i < $num) {

$ida = mysql_result($query,$i,"liberID");
$title = mysql_result($query,$i,"titulli");

//echo $liberID;
echo $title;
$_SESSION['vlera_ime'] = $ida;




echo('<img src="image.php" width="320" height="240" /> </br>');

$i++;

}

Here is the Image.php file

<?php
session_start();
include("databaseconfig.php");
$id= $_SESSION['vlera_ime'];

$query = mysql_query("SELECT * FROM librat WHERE liberID= $id " );
$row = mysql_fetch_array($query);
$content = $row['Book_image'];
//$content = $_GET['Book_image'];


//echo $id;


header('Content-type: image/jpg');
echo $content;

?>



I am using Session variables to get the books id from my table in db , and the while loop to th LiberID , one by one , LiberID is the book id stored in db . thanks for your response again :)

i am uploading the image of the db table storing the data .
I am not a expert in php :(
albin
New php-forum User
New php-forum User
 
Posts: 4
Joined: Wed Apr 03, 2013 1:35 pm

Re: Hello to all I need help guys

Postby albin » Thu Apr 04, 2013 3:31 am

this is the book table in database.
Attachments
librat Table.jpg
librat Table.jpg (90.22 KiB) Viewed 985 times
albin
New php-forum User
New php-forum User
 
Posts: 4
Joined: Wed Apr 03, 2013 1:35 pm

Re: Hello to all I need help guys

Postby seandisanti » Thu Apr 04, 2013 7:30 am

albin wrote:I am not a expert in php :(

Don't worry, neither is your teacher if he's got you using mysql_ functions. Check out this video on using PDO (PHP Data Objects) which is the correct way to interact with databases, and I think it may solve all of your problems. If not check out the sessions video on the second link to cover the rest of what you're doing.
http://jream.com/learning/videos/php-oo ... o-examples

video explaining sessions a little bit:
http://jream.com/learning/videos/php-ba ... e-security

If you watch both videos, you're looking at about 20 minutes to understand the concepts at play in your project, and then maybe 10 more to actually write the code.
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm

Re: Hello to all I need help guys

Postby albin » Thu Apr 04, 2013 12:14 pm

Thanks Man thanks for this information i hope to complete my project with this tutorials :)
albin
New php-forum User
New php-forum User
 
Posts: 4
Joined: Wed Apr 03, 2013 1:35 pm

Re: Hello to all I need help guys

Postby seandisanti » Thu Apr 04, 2013 12:24 pm

I'm sure you'll get it sorted out, but if you have any issues, don't be afraid to ask for help
seandisanti
php-forum Fan User
php-forum Fan User
 
Posts: 838
Joined: Mon Oct 01, 2012 12:32 pm


Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron