Current location: Hot Scripts Forums » Programming Languages » PHP » Default Picture


Default Picture

Reply
  #1 (permalink)  
Old 05-29-05, 01:02 PM
FalconFX's Avatar
FalconFX FalconFX is offline
Newbie Coder
 
Join Date: May 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Picture

Hello there.

I need to put in a Defaul picture defined per MYSQL.
So i set it up that the Default is the path to the picture in my MYSQL Table.

Now i try to get it displayed with the following command :
Code:
<br><img scr="'.$info[categorypic].'"><br>
But it doesnt Display the picture. Anything you see what i did wrong ?
Thanks

BTW i am PHP Ultra newbie.
Reply With Quote
  #2 (permalink)  
Old 05-29-05, 01:59 PM
alabaster_lynch alabaster_lynch is offline
Wannabe Coder
 
Join Date: Mar 2005
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by FalconFX
Hello there.

I need to put in a Defaul picture defined per MYSQL.
So i set it up that the Default is the path to the picture in my MYSQL Table.

Now i try to get it displayed with the following command :
Code:
<br><img scr="'.$info[categorypic].'"><br>
But it doesnt Display the picture. Anything you see what i did wrong ?
Thanks

BTW i am PHP Ultra newbie.
You didn't really give us anything to work with...so the only thing I can think of is did you echo that statement like this

Code:
echo '<br><img scr="'.$info[categorypic].'"><br>';
if you did, try to give some more information like your query or something else. Its hard to help otherwise.

Hope this helps.....Jose
Reply With Quote
  #3 (permalink)  
Old 05-29-05, 02:22 PM
FalconFX's Avatar
FalconFX FalconFX is offline
Newbie Coder
 
Join Date: May 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
The picture "nanews.gif" is defined as default picture under "categorypic" in the MYSQl Database. So if the user doesnt give a link to a category picture this picture should be displayed.

the code for the coulmn is : category VCHAR (50) NOT NULL DEFAULT "nanews.gif",

Now i try to get the picture Path out of the MYSQL database and then the picture displayed. Hard to explain sorry. I give you a link whats happeining right now :

http://zas.za.funpic.de/zwnews/newsview2.php

Thanks for any help

Heres a Code Segment :
Code:
	while($info = mysql_fetch_assoc($select)){         //holt info von Database
   		echo'<table width="73%" border="1">
  <tr>
    <td width="50%" align="left">'.$info[newstitle].'</td>
    <td width="21%">'.$info[newscategory].'</td>
  </tr>
  <tr>
    <td align="left" valign="top">'.$info[newscontent].'
	</td>
    <td height="100%" align="center" valign="top">	
	<br><img scr="'.$info[categorypic].'"><br>
	<br>ID : '.$info[newsid].'<br>
	<br>USER :'.$info[user].'<br>
	</td>
  </tr>
  <tr>
    <td align="left">&nbsp;</td>

Last edited by FalconFX; 05-29-05 at 02:30 PM.
Reply With Quote
  #4 (permalink)  
Old 05-29-05, 02:46 PM
alabaster_lynch alabaster_lynch is offline
Wannabe Coder
 
Join Date: Mar 2005
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by FalconFX
The picture "nanews.gif" is defined as default picture under "categorypic" in the MYSQl Database. So if the user doesnt give a link to a category picture this picture should be displayed.

the code for the coulmn is : category VCHAR (50) NOT NULL DEFAULT "nanews.gif",

Now i try to get the picture Path out of the MYSQL database and then the picture displayed. Hard to explain sorry. I give you a link whats happeining right now :

http://zas.za.funpic.de/zwnews/newsview2.php

Thanks for any help

Heres a Code Segment :
Code:
	while($info = mysql_fetch_assoc($select)){         //holt info von Database
   		echo'<table width="73%" border="1">
  <tr>
    <td width="50%" align="left">'.$info[newstitle].'</td>
    <td width="21%">'.$info[newscategory].'</td>
  </tr>
  <tr>
    <td align="left" valign="top">'.$info[newscontent].'
	</td>
    <td height="100%" align="center" valign="top">	
	<br><img scr="'.$info[categorypic].'"><br>
	<br>ID : '.$info[newsid].'<br>
	<br>USER :'.$info[user].'<br>
	</td>
  </tr>
  <tr>
    <td align="left">&nbsp;</td>
Two things one, you have this:
Code:
<br><img scr="'.$info[categorypic].'"><br>
but at the top of this post, you say the column is name just category, not categorypic.

Also, where is the pic located, is it in the same directory as this script or in a subdirectory.

Hope this helps....Jose O. Estrada
Reply With Quote
  #5 (permalink)  
Old 05-29-05, 02:50 PM
FalconFX's Avatar
FalconFX FalconFX is offline
Newbie Coder
 
Join Date: May 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Nah sorry for that.
The pic is in the same path as the script is and categorypic is the right name

So any further ideas ?
Reply With Quote
  #6 (permalink)  
Old 05-29-05, 03:10 PM
Jaffizzle Jaffizzle is offline
Newbie Coder
 
Join Date: May 2005
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
ur going to laugh cuz its just a simple typo

scr = src
Reply With Quote
  #7 (permalink)  
Old 05-29-05, 03:23 PM
FalconFX's Avatar
FalconFX FalconFX is offline
Newbie Coder
 
Join Date: May 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
hmmm that didnt work either....
How would you do it ?

Lets say someone stores a path to a image in your database and you want your webpage to display this image. What would be your code for displaying it ?
Reply With Quote
  #8 (permalink)  
Old 05-29-05, 03:46 PM
alabaster_lynch alabaster_lynch is offline
Wannabe Coder
 
Join Date: Mar 2005
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by FalconFX
Nah sorry for that.
The pic is in the same path as the script is and categorypic is the right name

So any further ideas ?
Are you sure that your db connection and query is correct, I just don't see anything else that would be the problem.

Jose
Reply With Quote
  #9 (permalink)  
Old 05-29-05, 03:49 PM
alabaster_lynch alabaster_lynch is offline
Wannabe Coder
 
Join Date: Mar 2005
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
you could check your query by simply adding this after completing it

[code]
If(!$query)
echo 'query wasn't sucessful';

that will tell you if the query is ok.

Jose
Reply With Quote
  #10 (permalink)  
Old 05-29-05, 04:10 PM
Jaffizzle Jaffizzle is offline
Newbie Coder
 
Join Date: May 2005
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
i mean you have <img sCR=...>

when it should be <img sRC=...>

your PHP code is totally fine, its ur HTML
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
need some help with this code buzzby PHP 0 06-20-04 03:07 AM
Newbie MySQL fccolon PHP 2 03-16-04 10:54 AM
Declared Functions skipper23 PHP 4 12-17-03 10:06 AM
index page not showing up skipper23 PHP 3 12-15-03 01:10 PM
Help with making a installer config script dazz Job Offers & Assistance 3 09-29-03 02:51 AM


All times are GMT -5. The time now is 06:48 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.