•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 423,305 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 5,344 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 492 | Replies: 11
![]() |
I have created a image upload for the site i am working on i now want the uer to be able to click on a preview button and this takes them to a separate page where they can see the images that have been uploaded.
for this to happen would i have to send a query to the database to retrieve the information or can i simply display them using the variable name which was set for the images.
for this to happen would i have to send a query to the database to retrieve the information or can i simply display them using the variable name which was set for the images.
•
•
Join Date: Mar 2008
Location: Praha, Czech Republic, Europe
Posts: 99
Reputation:
Rep Power: 1
Solved Threads: 14
Hi Kevin,
the basic question: do you store the images in a database or as files in a file system.
Also, what should I imagine when you say "the variable name which was set for the images"?
the basic question: do you store the images in a database or as files in a file system.
Also, what should I imagine when you say "the variable name which was set for the images"?
Petr 'PePa' Pavel
The more information you give the more relevant answer you get.
Please consider using "Add to ... Reputation" and mark your thread as Solved if you found what you were looking for. By giving feedback you help others.
The more information you give the more relevant answer you get.
Please consider using "Add to ... Reputation" and mark your thread as Solved if you found what you were looking for. By giving feedback you help others.
•
•
Join Date: Jul 2007
Posts: 106
Reputation:
Rep Power: 2
Solved Threads: 2
i think what you need is this:
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$_FILES['uploadedfile']['tmp_name'];
all this does is make a variable that holds the directory (ex: "uploads/filename.extension" )
and that you can store in the database as a varchar
if you want me to make you a script just ask, np lol im bored.
hope this helps
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$_FILES['uploadedfile']['tmp_name'];
all this does is make a variable that holds the directory (ex: "uploads/filename.extension" )
and that you can store in the database as a varchar

if you want me to make you a script just ask, np lol im bored.
hope this helps
•
•
Join Date: Mar 2008
Location: Praha, Czech Republic, Europe
Posts: 99
Reputation:
Rep Power: 1
Solved Threads: 14
Hi Kevin,
there's no way we could check the problem remotely.
Either you have the login data wrong (server name, username, password, db name) or the script doesn't connect or I don't know. Can you attach both db.php and the main script?
there's no way we could check the problem remotely.
Either you have the login data wrong (server name, username, password, db name) or the script doesn't connect or I don't know. Can you attach both db.php and the main script?
Petr 'PePa' Pavel
The more information you give the more relevant answer you get.
Please consider using "Add to ... Reputation" and mark your thread as Solved if you found what you were looking for. By giving feedback you help others.
The more information you give the more relevant answer you get.
Please consider using "Add to ... Reputation" and mark your thread as Solved if you found what you were looking for. By giving feedback you help others.
here is the db.php code
<?php
$dbhost = 'www.acmeart.co.uk';
$dbusername = 'acmeart';
$dbpasswd = 'all0wn01';
$database_name = 'acmeartdb';
$sitepath = "http://www.acmeart.co.uk/mercury/";
$sitename = "Mercury Email Distribution System";
$adminemail = "mercury@acmeart.co.uk";
$connection = mysql_pconnect("$dbhost","$dbusername","$dbpasswd")
or die ("Couldn't connect to server.");
$db = mysql_select_db("$database_name", $connection)
or die("Couldn't select database.");
?>
here is the code i am using to connect to the db.
<?php
include "db.php";
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die line 168
("QUERY ERROR: ".mysql_error());
$db = mysql_select_db("$database_name", $connection)
or die("QUERY ERROR: ".mysql_error());
// Create table in my_db database
mysql_select_db("$database_name", $connection);
$sql = "CREATE TABLE images
(
imageID int NOT NULL AUTO_INCREMENT,
Broad1 varchar(50),
Broad2 varchar(50),
Broad3 varhar(50)
)";
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("$database_name", $con);
mysql_query("INSERT INTO image (Broad1)
VALUES ('$thumb_name')");
mysql_query($sql,$con);
mysql_close($con);
?>
i keep getting the error
(Using password: NO) in /home/acmeart/public_html/mercury/upload.php on line 168 QUERY ERROR: i have labelled line 168 for you
<?php
$dbhost = 'www.acmeart.co.uk';
$dbusername = 'acmeart';
$dbpasswd = 'all0wn01';
$database_name = 'acmeartdb';
$sitepath = "http://www.acmeart.co.uk/mercury/";
$sitename = "Mercury Email Distribution System";
$adminemail = "mercury@acmeart.co.uk";
$connection = mysql_pconnect("$dbhost","$dbusername","$dbpasswd")
or die ("Couldn't connect to server.");
$db = mysql_select_db("$database_name", $connection)
or die("Couldn't select database.");
?>
here is the code i am using to connect to the db.
<?php
include "db.php";
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die line 168
("QUERY ERROR: ".mysql_error());
$db = mysql_select_db("$database_name", $connection)
or die("QUERY ERROR: ".mysql_error());
// Create table in my_db database
mysql_select_db("$database_name", $connection);
$sql = "CREATE TABLE images
(
imageID int NOT NULL AUTO_INCREMENT,
Broad1 varchar(50),
Broad2 varchar(50),
Broad3 varhar(50)
)";
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("$database_name", $con);
mysql_query("INSERT INTO image (Broad1)
VALUES ('$thumb_name')");
mysql_query($sql,$con);
mysql_close($con);
?>
i keep getting the error
(Using password: NO) in /home/acmeart/public_html/mercury/upload.php on line 168 QUERY ERROR: i have labelled line 168 for you
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Displaying images from mysql database (PHP)
- Displaying Images( buffered data ) from the Database using Java (Java)
- passing values and displaying images in a GUI (Java)
- No images anymore? (DaniWeb Community Feedback)
Other Threads in the PHP Forum
- Previous Thread: datagrid working but php_self problem
- Next Thread: retrieving data from MySQL


Linear Mode