the issue I am having is when a client logs into the system we want all their info to show up (from the nocsis table) then match the last name to the image table. All is working well with my select statement the only problem is the image doesn't show up. I believe what is diplayed is MIME. How do I get the actually image to display. Thanks in advance -
<?
-
include_once('../sql_connect.php');
-
-
-
-
$result = mysql_query("SELECT A.LastName, A.FirstName, A.Server, A.TimeIn, A.TimeOut, B.image FROM nocsis A, image B WHERE A.LastName = B.LastName AND A.TimeOut IS NULL ORDER BY A.TimeIn ASC");
-
-
-
-
while($myrow = mysql_fetch_array($result))
-
-
-
-
-
{//begin of loop
-
-
//now print the results:
-
-
echo "<b><u> Guest:</b></u> ";
-
-
echo "<br>Last Name: ";
-
-
echo $myrow['LastName'];
-
-
echo "<br>First Name: ";
-
-
echo $myrow['FirstName'];
-
-
echo "<br>Image: ";
-
-
echo $myrow['image'];
-
-
-
-
-
-
-
-
-
-
}//end of loop
-
-
-
?>
-
- posted this in the wrong area before, sorry
15 3531
You will have to show the content of image, like this[php]echo "<img src =\"" . $myrow['image']."\">"; [/php]Ronald
You will have to show the content of image, like this[php]echo "<img src =\"" . $myrow['image']."\">"; [/php]Ronald
thanks, when i add that line i get the 'X' like the link is gone and then the mime result again, has to be something i am missing???
thanks, when i add that line i get the 'X' like the link is gone and then the mime result again, has to be something i am missing???
Another way is[php]$image = $myrow['image'];
header("Content-type: image/jpeg");
print $image;[/php]Ronald
Another way is[php]$image = $myrow['image'];
header("Content-type: image/jpeg");
print $image;[/php]Ronald
your first way actually worked after i set the image as a link in mysql image field instead of the actual file. think i will leave it like that. Thanks alot.
how about another issue on this subject. how would i get a default image to show up if the person signing is not in my database
I'll put it inside the total code in the ELSE branch:[php]
<?php
include_once('../sql_connect.php');
$result = mysql_query("SELECT A.LastName, A.FirstName, A.Server, A.TimeIn, A.TimeOut, B.image FROM nocsis A, image B WHERE A.LastName = B.LastName AND A.TimeOut IS NULL ORDER BY A.TimeIn ASC");
if (mysql_num_rows($result) > 0) {
while($myrow = mysql_fetch_array($result)) {//begin of loop
//now print the results:
echo "<b><u> Guest:</b></u> ";
echo "<br>Last Name: ";
echo $myrow['LastName'];
echo "<br>First Name: ";
echo $myrow['FirstName'];
echo "<br>Image: ";
echo "<img src =\"" . $myrow['image']."\">";
} //end of loop
} // End IF
else {
echo "<img src ='default.jpg'>";
}
?>
[/php]Ronald
I'll put it inside the total code in the ELSE branch:[php]
<?php
include_once('../sql_connect.php');
$result = mysql_query("SELECT A.LastName, A.FirstName, A.Server, A.TimeIn, A.TimeOut, B.image FROM nocsis A, image B WHERE A.LastName = B.LastName AND A.TimeOut IS NULL ORDER BY A.TimeIn ASC");
if (mysql_num_rows($result) > 0) {
while($myrow = mysql_fetch_array($result)) {//begin of loop
//now print the results:
echo "<b><u> Guest:</b></u> ";
echo "<br>Last Name: ";
echo $myrow['LastName'];
echo "<br>First Name: ";
echo $myrow['FirstName'];
echo "<br>Image: ";
echo "<img src =\"" . $myrow['image']."\">";
} //end of loop
} // End IF
else {
echo "<img src ='default.jpg'>";
}
?>
[/php]Ronald
You have been a great help. appreciate it
hmmm kinda works just no image (i did add a default image) is displayed when the LastName does not match in the table.
also if you're in the mood how would i get the images to show up next to each other rather than in a column
also if you're in the mood how would i get the images to show up next to each other rather than in a column
You might want to check this thread for a neat little work around!
Yes, that is a neat piece of code. I couldn't do it better! Justr replace the url's with the images and their text.
Ronald
You have been a great help. appreciate it
hmmm kinda works just no image (i did add a default image) is displayed when the LastName does not match in the table.
also if you're in the mood how would i get the images to show up next to each other rather than in a column
in the if statement would there be a way to state that if lastname not in table nocsis to display a default image
in the if statement would there be a way to state that if lastname not in table nocsis to display a default image
But that is already in the code, you just have to replace the image name with the path/name of the one you want to display.[php] else {
echo "<img src ='your_image_name'>";[/php]Ronald
But that is already in the code, you just have to replace the image name with the path/name of the one you want to display.[php] else {
echo "<img src ='your_image_name'>";[/php]Ronald
the problem with that is it is searching for a 0 result. when someone signs in whether they have an image or not they still get logged in thus the result not being 0. only time the image appears is when no one is signed in.
So in the ELSE branch you need this statement: - "SELECT A.LastName, A.FirstName, A.Server, A.TimeIn, A.TimeOut, FROM nocsis A WHERE A.TimeOut IS NULL ORDER BY A.TimeIn ASC");
Ronald
So in the ELSE branch you need this statement: - "SELECT A.LastName, A.FirstName, A.Server, A.TimeIn, A.TimeOut, FROM nocsis A WHERE A.TimeOut IS NULL ORDER BY A.TimeIn ASC");
Ronald
wouldnt the select statement need to compare the 2 tables somehow and select the LastName in one and not the other
I don't know from which of the two tables you select or what table indicates that he has an image I just wanted to point out that you had to do a new select in case the result of the first select was 0.
Ronald
I don't know from which of the two tables you select or what table indicates that he has an image I just wanted to point out that you had to do a new select in case the result of the first select was 0. .
Ronald
Think I am on the right track. my query works with mysql when i do the else select i get the user that does not have a picture, i just cant seem to figure out how to display it or could it be that my if statement is jacked up. this code is got me going in circles. i didnt think it would be that hard to say if user signs in this table1 and has photo in this table2 display picture from table2 else if user signs in table1 and has no image in table2 show default image. any ideas?? -
<?
-
include_once('../sql_connect.php');
-
$result = mysql_query("SELECT A.LastName, A.TimeOut, B.image, B.LastName FROM nocsis A, image B WHERE A.LastName = B.LastName AND A.TimeOut IS NULL ORDER BY A.TimeIn DESC");
-
-
if (mysql_num_rows($result) <> B.LastName ) {
-
-
-
-
{//begin of loop
-
-
//now print the results:
-
-
-
-
echo '<table>'; // start the table.
-
-
-
-
$_counter = -1; // We start 'outside' the Matrix. Unlike Neo.
-
$_cols = 4; // 4 columns. Of the Ionic variety.
-
while($myrow = mysql_fetch_array($result)){ //get array of table.
-
-
// Advance the counter and determine our 'position';
-
-
$_pos = ( ++$_counter % $_cols );
-
-
// Should we output a '<tr>'?
-
-
if( $_pos === 0 )
-
{
-
echo '<tr>';
-
}
-
-
-
/// This will create link on picture to search for user on inside.spherion.com ////
-
/// Still working on how to simply put 5-2 and pull image from inside.spherion.com at the myrow[image] call ////
-
-
echo "
-
<td>
-
<a href=\"http://inside.spherion.com/Search.aspx?k={$myrow['LastName']}&s=Search%20People\" target=\"_blank\">
-
<img src=\"" . $myrow['image']."\" /></a>
-
<b><br>Last Name:</b>
-
{$myrow['LastName']}
-
-
</td>"; // echoing out the image
-
-
-
// Should we output a '</tr>'?
-
if( $_pos === $_cols - 1 )
-
{
-
echo '</tr>';
-
}
-
}
-
if( $_counter % $_cols !== $_cols - 1 )
-
{
-
do
-
{
-
echo '<td style="visibility: hidden"> </td>';
-
}
-
while( ++$_counter % $_cols !== $_cols - 1 );
-
-
echo '</tr>';
-
}
-
-
echo '
-
</table>';
-
} //end of loop
-
-
-
} // End IF
-
else {
-
("SELECT LastName FROM nocsis WHERE LastName NOT IN (Select LastName FROM image) AND TimeOut IS NULL ORDER BY TimeIn DESC");
-
-
-
}
-
-
-
-
?>
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Dirk Goossens |
last post by:
Hi!
I stored the file name and path of photos in a table with data from students
and teachers.
Is there a way to show the photos in a report or form?
Thanks!
Dirk Goossens
Vrij Instituut...
|
by: bessington |
last post by:
hey all,
i'm having a rather bizarre problem.. the image tag i have declared in
my xhtml is not showing in safari / konqueror but showing just fine in
Firefox, IE, Opera... this is a complete...
|
by: needin4mation |
last post by:
Hi, I have an Access 2002 - 2003 database. I am using Access 2003.
Whenever I link an image all it shows is the filename. Not the image.
Other versions of Access can link the image just fine. ...
|
by: Gabriella |
last post by:
Hi,
I have the CSS class below, and the image (pro.gif) is not showing on
my page.
It is showing ONLY where's some text in the div, but all I need is the
image itself.
..pro {background-image:...
|
by: Sandeep Singh Sekhon |
last post by:
I am developing an application in ASP.NET 1.1. on one page I allow the
user to upload and delete the files to the server.
When I delete the file, I physically delete the file from the location....
|
by: Milsnips |
last post by:
hi there,
i've a function that reads image filenames from database, and displays into
a repeater control, but what i'm trying to acheive is as i loop through each
filename, i want to resize it...
|
by: Iain |
last post by:
Hi
I am using Borland Developer 2006, C# web application. Fairly new to
the .net platform and very new to repeaters.
I have 2 repeaters on a page, both of which are filled from a
database....
|
by: painkiller |
last post by:
language: vb.net
environment: windows forms
.net : v1.1
i am having a checkedlistbox control that display document category such as text, image, video, audio etc. these values are coming from...
|
by: mikek12004 |
last post by:
I am using this code to produce an xml file, do not pay any attetion to the queries the thing is that even if I put the UTF-8 encoding when I try to run the xml file I get the greek characters as...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |