|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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:
|
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Do you know this? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|