General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 12th, 2002, 03:34 PM
DivaX007 DivaX007 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 23 DivaX007 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Do you know this?

running win98, abyss web server, php, mysql.
i've attempted to save images in a file folder and the link in mysql:
|id|0
|name|<IMG SRC=http://localhost/UploadPics/car2.gif WIDTH= "160" HEIGHT= "160" BORDER="0">
|rating|
|rates|
1.is this correct?
2.Specifically, how do i get the image to display using php?

all help would be appreciated.
thanks in advance

Reply With Quote
  #2  
Old November 14th, 2002, 09:16 AM
crazytrain81 crazytrain81 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 232 crazytrain81 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
If your image location is being stored correctly in the database, once you retrieve it. you just echo the value containing the img location. Since you're storing it in the form of an html tag, all you have to do is output it. For example.
PHP Code:
 mysql_connect('localhost','root','');
mysql_select_db('myDb');
$result=mysql_query("SELECT * FROM table WHERE id=0;");
if (
mysql_num_rows($result)) {
   
$row mysql_fetch_array($result);
   echo 
$row['name']; // this will display the image


Reply With Quote
  #3  
Old November 14th, 2002, 03:32 PM
DivaX007 DivaX007 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 23 DivaX007 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i know i'm missing something

[not the real user name/password/dbname]
<?php
//connect to mysql database
$dbcnx=@mysql_connect("localhost","clifford","bigreddog");
if (!$dbcnx) {
echo ("Could not connect to mysql server");
exit();
}
//select the Pictures database
if (! @mysql_select_db ("Pictures") ) {
echo ("Could not connect to Pictures database");
exit();
}
//request all images
$result=@mysql_query("SELECT * FROM Pictures WHERE id=0");
if (mysql_num_rows($result)) {
$row = mysql_fetch_array($result);

echo $row['name']; // this will display the image
}
?>

when i run this script, i get this error:
Could not connect to mysql server

Reply With Quote
  #4  
Old November 15th, 2002, 11:53 AM
crazytrain81 crazytrain81 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 232 crazytrain81 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
your code to connect is fine (assuming you are using the correct credentials in your test script). check your mysql set up and php.ini

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Do you know this?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway