vindom 0 Newbie Poster

Never mind... got that working as well...:-) (It was type mismatch in Heres.userid and u..If anyone interested - fixed by adding Cstr(Hires.UserID) and that's it) Thanks !!!

vindom 0 Newbie Poster

Thanks ... I've found easier way to get that done, but I thing something is wrong with my query...

"SELECT items.carrier, items.author, items.item_name,  Hires.when_hired FROM (Hires INNER JOIN items ON Cstr(Hires.ItemID) = Cstr(items.ItemID))WHERE Hires.UserID = 'u'"

If any one could tell what have i done wrong that would be great..
Thanks in advanced
vindom 0 Newbie Poster

Hi every one

I'm trying to retrieve UserID (which is autonumber in ms access database) using C# and assign it to string u.I'm totally new to C# and trying to get more skills....

here goes..

 string connStr, selectCmd;
                connStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=..\\library.accdb";
                selectCmd = "SELECT * FROM users WHERE First_Name ='x' AND Last_Name = 'y'";
                OleDbConnection conn;
                OleDbDataAdapter myAdapter;
                DataSet myDataSet = new DataSet();
                conn = new OleDbConnection(connStr);
                conn.Open();
                myAdapter = new OleDbDataAdapter(selectCmd, conn);
                myAdapter.Fill(myDataSet, "users");
                u = myDataSet.Tables["users"].Columns[0].ToString();

All i'm getting at the end is name of the column in that table...but not the actual value
Thanks!

vindom 0 Newbie Poster

Works like charm !!! Thanks a lot!! I was inserting label1.Text=text into public void label3_click {..} .....I'm a nooooooob! Thanks again!

vindom 0 Newbie Poster

..Oh and label on form2 always displays the same name despite different choice

vindom 0 Newbie Poster

Hi!
I'm writing little software just to get some practice in c#. I have listview in form 1 where program displays first name and last name form access database. When admin selects name/surname in listvioew and press show usercard(form2) I have a label in form2 and I want it to display name and surname in that label(as who's card is open). I'va tried different ways (all I could find using google) nothing worked for me (probably I was doing something wrong) I've managed to get that almost working at some point but label was showing name only on click.....I'm neewbe in c# so any help would be great.

Form1 code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;



namespace Library
{
    public partial class Main : Form
    {
        public Main()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'libraryDataSet.users' table. You can move, or remove it, as needed.
            //this.usersTableAdapter.Fill(this.libraryDataSet.users);

        }

        private void button14_Click(object sender, EventArgs e)
        {

        }

        private void button15_Click(object sender, EventArgs e)
        {

        }

        private void button16_Click(object sender, EventArgs e)
        {

        }

        private void button20_Click(object sender, EventArgs e)
        {

        }

        private void button13_Click(object sender, EventArgs e)
        {

        }

        private void button7_Click(object sender, EventArgs e)
        {

        }

        private void usersBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.usersBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.libraryDataSet);

        }

        public void listView1_SelectedIndexChanged(object sender, EventArgs e)
        {



            // this.listView1.Focus();
         // this.listView1.Items[0].Selected = true;

            //edit.textBox1.Text = People[this.listView1.SelectedItems[0].Index].Name;
           // …
vindom 0 Newbie Poster

Never mind .. I removed delete button.. No button - no problem.. I have another menu option that allows admin to delete any comment. This one was just like a bonus function...

vindom 0 Newbie Poster

..Well I have a page that has an iframe (adminlook.php opens up in a separate window) ..
Heres the code

<body>
<img id="background-img" class="bg" src="adminbackground.jpg" alt="" />  
<?php

$imgid = $_GET['id'];

include 'ufunction.php';
include 'uthumbfunction.php';
?>
<div class="leftframe">
<div class="frame"><img src="show.php/?id=<?=$imgid?>/%<?=$image['thumb']?>.large.jpg" />



<?php
 include "file_constants.php";  
 $con = mysql_connect("$host", "$user", "$pass")or die("cannot connect"); 
    mysql_select_db("$db_name")or die("cannot select DB");
        if ($db_name)
            {
                $sql="SELECT AvrgRate FROM images WHERE id ='$imgid'";                                                                      // select name of logged in user
                $result = mysql_query($sql);
                if ($row = mysql_fetch_assoc($result)) 
                    {
                        $AvrgRate = $row['AvrgRate'] ;                                                                  
                    }
                    else $AvrgRate = 'Not rated yet';
                mysql_close($con);
            }
?>

<h3>AVERAGE RATE  OF THIS PICTURE IS </h3></p>
<h1><?=$AvrgRate?></h1>
</div>
</div>

<div class="rightframe">

<h2>Comments left by others:</h2>
<div class="iframe"><iframe style="background: rgba(255, 255,255,0.5);
"src="admincomments.php/?id=<?=$imgid?>"  frameborder="3" width="500"height="550">   

</iframe>
<input type="button"  value="Close Window" onClick= "javascript:window.close()" />
</div>
</body>
</html>

iframe content from a different page "admincomments.php" (javascript is there only for closing the whole page)
Heres the code for admincomments.php :

<?php
include'file_constants.php';

$imgid = $_GET['id'];

$con = mysql_connect($host, $user, $pass) or die("Can not connect to database: ".mysql_error());
mysql_select_db($db_name) or die("Can not select the database: ".mysql_error());

$sql = mysql_query("SELECT * FROM comments WHERE ImageID =  '$imgid' ORDER BY Date DESC");



while($comment = mysql_fetch_array($sql))
{
    echo "Comment ID -  ",$comment['CommentID'];
    echo $comment['Comment'];
echo $comment['Date'];
echo "User ID : ";
echo $comment['ComUserID'];

$commentID = $comment['ComUserID'];

?>
        <form action="deletecomment.php" target="_parent" method="post" >
        <input type="radio" name="del" /> 
        <input type="hidden" name="comid" value="<?=$commentID?>" />
        <input type="submit"  value="Delete Comment" />
        </form>
<p></p><p></p>----------------------------------------------------------<p></p><?php
}
mysql_close($con);
?>

This admincomments.php retrieves all comments for the …

vindom 0 Newbie Poster

That is strange, it should not redirect back to admincomments.php it just has to remove comment at the background and thats all....Can anyone suggest any solution for this please... ?

vindom 0 Newbie Poster

iframe is on the different page:

`

<?php



$imgid = $_GET['id'];

include 'ufunction.php';
include 'uthumbfunction.php';
?>
<br/><br/><div class="leftframe">
<div class="frame"><img src="show.php/?id=<?=$imgid?>/%<?=$image['thumb']?>.large.jpg" />
<br/><br/><br/>


<?php
 include "file_constants.php";  //include file with database details such as username\password\database name and table names
 // Connect to server and select databse.
$con = mysql_connect("$host", "$user", "$pass")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");
        if ($db_name)
            {
                $sql="SELECT AvrgRate FROM images WHERE id ='$imgid'";                                                                      // select name of logged in user
                $result = mysql_query($sql);
                if ($row = mysql_fetch_assoc($result)) 
                    {
                        $AvrgRate = $row['AvrgRate'] ;                                                                  
                    }
                    else $AvrgRate = 'Not rated yet';
                mysql_close($con);
            }
?>

<h3>
AVERAGE RATE  OF THIS PICTURE IS </h3></p>
<h1><?=$AvrgRate?></h1>
</div>
</div>

<div class="rightframe">
<h2><br/><br/>Comments left :</h2><br />

<div class="iframe"><iframe style="background: rgba(255, 255, 255, 0.5);"src="admincomments.php/?id=<?=$imgid?>"  frameborder="3" width="500" height="550">    

</iframe>
<input type="button" style="background-color:#6BC462; margin:0px 0epx;" value="Close Window" onClick= "javascript:window.close()" />
</div>
</body>
</html>

`

vindom 0 Newbie Poster

Trying to redirect from inside an iframe ... that's the code:

<?php
include'file_constants.php';
$imgid = $_GET['id'];
$con = mysql_connect($host, $user, $pass) or die("Can not connect to database: ".mysql_error());
mysql_select_db($db_name) or die("Can not select the database: ".mysql_error());

$sql = mysql_query("SELECT * FROM comments WHERE ImageID =  '$imgid' ORDER BY Date DESC");



while($comment = mysql_fetch_array($sql))
{
    echo "Comment ID -  ",$comment['CommentID'];
     ?><br/><br/><?php ;
   echo $comment['Comment'];
?><p/><p/><br/>
<?php
echo $comment['Date'];?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php
echo $comment['ComUserID'];

?>
                    <form action="deletecomment.php" target="_top" method="post" >
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                    <input type="radio" name="del" /> 
                    <input type="hidden" name="imageid" value="<?=$comment['CommentID']?>" />
                    <input type="submit" style="font-weight: bold;height: 25px; width:130;"  value="Delete Comment" />
                    </form>
<p/><p/>--------------------------------------------------------------------------------------------------------------<p/><?php
}
mysql_close($con);
?>

and thats what im getting(it opens in a separate wndow) :

Notice: Undefined index: id in P:\xampp\htdocs\admincomments.php on line 3

it suppose to redirect to another page which basically is :
`

$echo "deleting";

`

vindom 0 Newbie Poster

Thanks but either i'm doing something wrong or it just not working...Probably the first one.. Mind I've no idea about jquery....

vindom 0 Newbie Poster

Hi!
I have a form (which is in html(the rest of my coding done in PHP)) that prompts user to choose image, type in title and choose status and after pressing confirm button script uploads image and its details to MySQL database. I'm trying to fade whole screen or disable all buttons on the page or display animation or all of that together to prevent user from pressing submit button few times. Any simple fade function in Javascript, JQuery or Ajax. I know nothing about those languages and don't have much time left to learn it. I've tried for couple days to achieve that myself but unsuccessfully..
Any help would be great..
Thanks!

Here is my code:

<html>
<head>
</head>
<body>
<img id="background-img" class="bg" src="water.jpg" alt="" />    
<br/><br/><br/><br/><br/>

<div class="frame">
<p class="ridge" font size="40px";>Choose Your Image</p>
    <form enctype="multipart/form-data" action="insert.php" method="post" name="changer"> 
        <p style="text-align:center;font-weight: bold;font-size:20px;color:blue;text-shadow:5px 5px 5px grey;">
            <input name="MAX_FILE_SIZE" value="1024000" type="hidden">
<br/><br/><label>Select file</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input name="img" accept="image/jpeg" type="file">
<br/><br/><label>Title</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="title"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 <br/><br/><b>If you want your image available for public set status to PUBLIC otherwise set to PRIVATE</b> <br/><br/>
            <select style="font-weight: bold; heght: 100px; width: 130px;" name="status">
            <option >Set your status</option>
            <option value="public">Public</option>
            <option value="private">Private</option>
            </select>
<br/><br/><b>Please allow some time to upload the picture</b>
<br/><br/><input type="button" style="font-weight: bold;height: 30px; width: 100px; background-color:#125940;color:white;"  value="Cancel" onClick="location.href='usermenu.php';" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input style="font-weight: bold;height: 30px; width: 100px; background-color:#125940;color:white;"  value="Submit" type="submit" >
        </p>
    </form>
 </div>
</body>
</html>
vindom 0 Newbie Poster

Nevermind! Solved!

<?php $imgid = $image['id']; ?>

<li><img src="uploads/<?=$image['thumb']?>.large.jpg"/>
<div class="groove3">
<form action="com.php"  target="_blank" method="post"/>
<input type="hidden" name="imageid" value="<?=$imgid?>" />
<input type="submit" value="Confirm" />
</form>
</div>
vindom 0 Newbie Poster

Hi!
I have iframe with multiple images retrieved from DB. Each img have "comment" button underneath it. I need this button to redirect to the comment page where user can leave comment . Redirection function works. But at the same time I need this button to send img ID to the comment page.
Iframe is on the main page here's the code:

  <div class="transbox">
<iframe src="index.php" id = "largeimgframe" frameborder="3" width="923" height="490"></iframe>
</div>

Here's the code for index.php: (include function and thumbfunction just resize each image)

<body>
 <div class="thumb"><ul>
<?php
## includes files  
include 'function.php';
include 'thumbfunction.php';
$query = ("SELECT * FROM images WHERE Status = 'public' ORDER BY id DESC ");
$images = simple_func($query);
if(!empty($images))
{
    foreach($images as $image)
    {
         ?>
        <li><img src="uploads/<?=$image['thumb']?>.large.jpg"/>
        <div class="groove3"><input type="button" type="submit" value="Comment" onClick= "self.parent.location.href='com.php';"/>
        </div>
         </p></a></li>
        <?php    
    }
}
else
    {
     ?>
     <div class="message">There are no images to show</div>
   <?php
   }
?>
</ul>
</div>
</body>

**And here's the code for show.php (retrieves images with 'Public' status from DB) **

<?php
## filename show.php
include'file_constants.php';

$con = mysql_connect($host, $user, $pass) or die("Can not connect to database: ".mysql_error());
mysql_select_db($db_name) or die("Can not select the database: ".mysql_error());

if(isset($_GET['id']) || !empty($_GET['id']))
{
$id = $_GET['id'];
$query = mysql_query("SELECT * FROM images WHERE id=' ".$id." ' ");
$row = mysql_fetch_array($query);
$content = $row['image'];
header('Content-type: image/jpg');
echo $content;


mysql_close($con);
}
else
{
 echo "please select image";
 }
 ?>
<input type="button" type="submit" value="Comment" />

I've tried to use <form> but because it is in …

vindom 0 Newbie Poster

Now I believe in magic !!!!! Thanks a lot man !! It works like a charm!! Had to make few changes but it works !!!

vindom 0 Newbie Poster

You're a star ! I'll try it as soon as I can.... Thanks!!

vindom 0 Newbie Poster

Ok! No problem...That's gr8 .. You've helped me a lot. Thanks!

vindom 0 Newbie Poster

Ok!
Thanks!
.....I've tried that but still getting errors:

Notice: Undefined index: ImageID in C:\xampp\htdocs\gal.php on line 37
View this image.
Notice: Undefined index: ImageID in C:\xampp\htdocs\gal.php on line 37
Notice: Undefined index: ImageID in C:\xampp\htdocs\gal.php on line 37
View this image.
Notice: Undefined index: ImageID in C:\xampp\htdocs\gal.php on line 37
Notice: Undefined index: ImageID in C:\xampp\htdocs\gal.php on line 37
View this image.
Notice: Undefined index: ImageID in C:\xampp\htdocs\gal.php on line 37
Notice: Undefined index: ImageID in C:\xampp\htdocs\gal.php on line 37
View this image.
Notice: Undefined index: ImageID in C:\xampp\htdocs\gal.php on line 37
Notice: Undefined index: ImageID in C:\xampp\htdocs\gal.php on line 37
View this image.
Notice: Undefined index: ImageID in C:\xampp\htdocs\gal.php on line 37

those are like active links, but when I press on any of the id displays first image of the DB...

vindom 0 Newbie Poster

What are those id s ($images['id']) ? It tells me : Notice:undefined index: id and points to the line above....10 times..
is there any way to run the code without them?

vindom 0 Newbie Poster

Some mess on line 74 ..can't get my head round after 24 hours in front of pc..

?>
<a href="view.php?id=<?=$images['id']?">View this image.<?=$images['id']?></a>
<?php
}
vindom 0 Newbie Poster

Thats another code... when using it getting one big image ..

<?php
     include "file_constants.php";

     $link = mysql_connect("$host", "$user", "$pass")
     or die("Could not connect: " . mysql_error());

     mysql_select_db("$db_name") or die(mysql_error());

     $sql = "SELECT Image FROM images ";

     $result = mysql_query("$sql") or die("Invalid query: " . mysql_error());
     $x=array($result);

     foreach ($x as $images)
 {

     header("Content-type: image/jpeg");
     echo mysql_result($result, 0);
 }


?>
vindom 0 Newbie Poster

Tried..No luck..
I've inserted images manually....Don't know if it affects the way it works.
However I have a code that works with one image:

<?php

include "file_constants.php";

mysql_connect($host, $user, $pass, $db_name) or die("Can not connect to database: ".mysql_error());

mysql_select_db($db_name) or die("Can not select the database: ".mysql_error());



$query = mysql_query("SELECT Image FROM images ");
$row = mysql_fetch_array($query);
$content = $row['Image'];

header('Content-type: image/jpg');


     echo $content;


?>
vindom 0 Newbie Poster

I've tried this:

<?php
  function show_images($sql){
  ## define all of your database credentials below
   include "file_constants.php";
  ## let's connect to database..

  $connect =  mysql_connect("$host", "$user", "$pass")or die("cannot connect"); 
  $db = mysql_select_db("$db_name")or die("cannot select DB");
  $result = mysql_query($sql, $connect) or die(mysql_error()); 

  ## now that we are connected we can loop through the result
  while($row = mysql_fetch_array( $result )) 
  {
  $data[] = $row;
  }
  ## we return the data
  return $data;
  }  
  ## end of our little function
  ## code below is responsible for generating the actual result given by query..
  ## define the query
  $query = "SELECT Image FROM images;";

  ## call the function above
   $data = show_images($query);

    ## iterate through the results returned by the function 
   foreach($data as $images )



   {
      ?>
      <a href="location"><img src="<?=$images['imageItself']?>" width = "100" height="100"/></a>
   <?php
   }
  ?>

....aaaaand I'm getting 5 small icons...like RGB icons.. Looks like it can find them in DB but having problem displaying it...Faced the same result with MS Access...

vindom 0 Newbie Poster

Thanks for reply!
Let's see.....
I have login function - works fine, at leats so far :-)..
I have set up database with tables : users, images, admin and comments..
Images table has ID, Image itself, UserID(who uploaded that), Status and Date(Uploaded). I store images as BLOB
(I'd try to store as a link to the file with images but I've no idea how to do that and i've no much time left to investigate. I was trying to achive that using ASP and MS Access but just wasted huge amount of time. So I had to go for PHP + MySQL and hope for a miracle to finish in time)
...Anyway.. I've managed to retrieve and display one image. but I need them all on one page and then I will insert that page into an iframe on the main page...That's the plan..
About the thumbnails without the link... Thanks! Silly me! I should've guessed myself....

vindom 0 Newbie Poster

Hi!
Im a noob to PHP but had to use it instead of ASP because I couldn't retrieve images from database using ASP + MS Access... Anyways.. I have couple questions:

Number 1: How to retrieve and displaymultiple(!) images(jpg) from mysql DB?

NUmber 2: I have a main page that displays iframe with multiple images (they are hardcoded for now). When pressing on any image it will redirect to a page with that image and text box for a comment..(thats the plan anyway) . And is it possible to disable redirect option if the user is not logged in (based on cookie)?

<div class="img">
 <a target="_blank" href="klematis_big.htm"><img src="1.jpg" alt="Klematis" width="220" height="130" /></a>

</div>
<div class="img">
 <a target="_blank" href="klematis2_big.htm"><img src="2.jpg" alt="Klematis" width="220" height="130" /></a>
 </div>

<div class="img">
 <a target="_blank" href="klematis3_big.htm"><img src="3.jpg" alt="Klematis" width="220" height="130" /></a>
</div>
<div class="img">
 <a target="_blank" href="klematis4_big.htm"><img src="4.jpg" alt="Klematis" width="220" height="130" /></a>
</div>
<div class="img">
 <a target="_blank" href="klematis4_big.htm"><img src="5.jpg" alt="Klematis" width="220" height="130" /></a>
</div>
<div class="img">
 <a target="_blank" href="klematis4_big.htm"><img src="6.jpg" alt="Klematis" width="220" height="130" /></a>
</div>
<div class="img">
 <a target="_blank" href="klematis4_big.htm"><img src="7.jpg" alt="Klematis" width="220" height="130" /></a>
</div>
<div class="img">
 <a target="_blank" href="klematis4_big.htm"><img src="8.jpg" alt="Klematis" width="220" height="130" /></a>
</div>
<div class="img">
 <a target="_blank" href="klematis4_big.htm"><img src="9.jpg" alt="Klematis" width="220" height="130" /></a>
</div>
<div class="img">
 <a target="_blank" href="klematis4_big.htm"><img src="10.jpg" alt="Klematis" width="220" height="130" /></a>
</div>

Thanks

vindom 0 Newbie Poster

Hi!
Im a noob to PHP but had to use it instead of ASP because I couldn't retrieve images from database using ASP + MS Access... Anyways.. I have couple questions:

Number 1: How to retrieve and displaymultiple(!) images(jpg) from mysql DB?

NUmber 2: I have a main page that displays iframe with multiple images (they are hardcoded for now). When pressing on any image it will redirect to a page with that image and text box for a comment..(thats the plan anyway) . And is it possible to disable redirect option if the user is not logged in (based on cookie)?
Thanks

vindom 0 Newbie Poster

Hi
I've ms database where I've added one image(one so far for testing). Also in that DB(database) I have UserID and ItemID. Image I've added to DB (.mdb format) manually as OLE object. (It was : right click on DB field / Insert Object / from file/ picked up a picture / ok / done)
Now.. I'm trying to display that picture to a webpage using ASP code. The code I'm using to "pull" that image out is

'Declare Variables..
    Dim sql
    Dim rs
    Dim conn

    
   'Instantiate Objects
   Set conn = Server.CreateObject("ADODB.Connection")
   Set rs = Server.CreateObject("ADODB.Recordset")
   
   'Open connection
   Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ 
             "Data Source=" & Server.MapPath("GUDB.mdb")
   
   'Get the specific image based on the ID passed in a querystring
    str = "SELECT fil FROM Items"
    rs.Open str, conn,3,3
    if rs.eof then 'No records found
        Response.End
    else 'Display the contents
        Response.ContentType = "image/bmp" 
        Response.BinaryWrite(rs("fil")) 
    end if
   
   'destroy the variables.
   rs.Close
   conn.Close
   set rs = Nothing
   set conn = Nothing

to display that pulled out picture on the next page I use

<IMG SRC="gal.asp">

But nothing happens... I've tested piece of code that pulls image out from DB - it works, the code finds it, but obviously can pass that to a next page where second small part of code should handle it. The small part of the code for displaying that JPG (or BMP - I've tried both) displays tiny icon with 3 color circles in it - what suppose to be a picture I guess....
Any …

vindom 0 Newbie Poster

Thanks every one !!

vindom 0 Newbie Poster

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA!!!!!!!!!!!!!!!!!! Solved!!!
In the line :

cout<<(*iter)->getStockID() << endl;

All I did was :

cout<<"Stock ID is : "<<(*iter)->getStockID() << endl;

And it worked!!! No idea what was it, probably some bug...4 days cause of that bug!!! Argh..

vindom 0 Newbie Poster

..Right..I got rid of those errors..But still can't get getStockID() working..

vindom 0 Newbie Poster

..I'm not sure I understand what you mean...Mind I'm a newbie.. :)

vindom 0 Newbie Poster

it points to each line in BuildStockVector function that contains book details..

vindom 0 Newbie Poster

..and that's for each line containing book details in the vector. 4 errors in total.

vindom 0 Newbie Poster

I've removed all repetitive attributes from publication and Book.. Now I'm getting errors error C2661: 'Book::Book' : no overloaded function takes 8 arguments. I've tried to make "few" more changes but.. no idea where to look for solution..

vindom 0 Newbie Poster

and here stdafx.h just incase

#pragma once

#include "targetver.h"
#include<sstream>
#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

#include "person.h"
#include "admin.h"
#include "user.h"
#include "customer.h"
#include "stock.h"
#include "Item.h"
#include "publication.h"
#include "av.h"
#include "Book.h"
#include "Journal.h"
#include "Video.h"
#include "MusicCD.h"
vindom 0 Newbie Poster

Oh sorry , and vector..

void manager::BuildStockVector()
{
	theStock.push_back(new Book("SBK010","978-0-307-47427-8","A Tale of Two Cities","Penguin Classics","General","345","12"));
	theStock.push_back(new Book("SBK020","325-0-412-45527-4","The Da Vinci Code","Random House","General","237","14.25"));
	theStock.push_back(new Book("SBK011","978-0-307-47427-3","Copy of the book 'A Tale of Two Cities'","Penguin Classics","General","340","12"));	
	theStock.push_back(new Journal("SJN010","0811-8203","Desire Journal","8","01.04.2012","History","Chronicle Books","144","10.75"));	
	theStock.push_back(new Video("SVD010","The Squid and the Whale","Drama","1:45:22","AVI","Keep Case","Sony Pictures Home Entertainment","20"));		
	theStock.push_back(new Video("SVD020","High Fidelity","Comedy","1:37:44","DVD","Keep Case","Dogstar Films","17.50"));	
	theStock.push_back(new MusicCD("SCD010","Chris Rea","The Best Of Chris Rea","0:45:22","Tyvek Sleeve","CD","16","East/West Records","6.50"));	
	theStock.push_back(new MusicCD("SCD020","Smokie","The Best Of Smokie","0:48:12","Paper Sleeve","CD-R","17","Paradiso","4.75"));	
	theStock.push_back(new Journal("SJN010","0811-8204","Copy of 'Desire Journal'","8","01.04.2012","History","Chronicle Books","144","10.75"));
	theStock.push_back(new Book("SBK021","325-0-412-45527-2","Copy of the book 'The Da Vinci Code'","Random House","General","235","14.25"));
	theStock.push_back(new Journal("SJN020","0577-2173","CSC Journal","3","01.08.2011","IT","CSC Journals","87","4.25"));
	theStock.push_back(new Journal("SJN021","0577-2175","Copy of the 'CSC Journal'","3","01.08.2011","IT","CSC Journals","87","4.25"));
}
vindom 0 Newbie Poster

Right..Here's what I'll do (because my brain is stalled and I've already made some modifications trying to solve it )... I'll upload most of it so it is easier to trace the process..Here goes...

Manager.cpp(NOT the whole code just one of the functions that is "malfunctioning")

#include "StdAfx.h"
#include "manager.h"
manager::manager(void)       //Constructor
{
	BuildStockVector();
	BuildCustomerVector();
	Login();
	ShowUserMenu();
	ShowAdminMenu();
	
}
manager::~manager(void)
{
}void manager::ListStock() 
{
	system("cls");
	cout << endl << "Stock Items" << endl << "<=====================>" << endl;	
	vector <Item*>::iterator iter = theStock.begin();
	for(iter = theStock.begin();iter != theStock.end();++iter)
	{   
		cout<<(*iter)->getStockID() << endl;
		(*iter)->getAllDetails();
		cout << endl << "==================" << endl;
	}
	cout << endl << "End of List" << endl;
}

Manager.h

#pragma once
#include <vector>
using std::vector;
class manager
{
private:
	string CurrentUserID;
	vector <customer*> theCus;
	vector <Item*> theStock;
	void BuildCustomerVector();
	void BuildStockVector();
	void BuildAdminVector();
    void Login();
	void aLogin();
	void uLogin();
	void AddUser();
	void AddAdmin();
	void AddCustomer();
	void ListUsers();
	void EditUser();
	void ListStock();
	void ChangePass();
	void AddStock();
	void AddBook();
	void AddJournal();
	void AddVideo();
	void AddMusicCD();
	void EditStockItem();
	void HireInfo();
	

public:
	manager(void);
	~manager(void);
	void ShowUserMenu();
	void ShowAdminMenu();

};

Stock.cpp

#include "StdAfx.h"
#include "stock.h"

stock::stock(void)
{

}
stock::~stock(void)
{
}

Stock.h

#pragma once

class stock
{
public:
	stock(void);
	~stock(void);
};

Item.cpp

#include "StdAfx.h"
#include "Item.h"

Item::Item(void)
{
}


Item::Item(string newStockID, string newTitle, string newPublisher, string newPrice, string newSubjectArea, string newNumberPages, string newISBN,string newISSN,string newIssueNo, string newIssueDate, string newRunningTime,string newStorageCase,string newCDType,string newTrackNo,string newArtist,string newFormat, string newGenre)
{
	StockID=newStockID;
	Title=newTitle;
	Publisher=newPublisher;
	SubjectArea = newSubjectArea;
	NumberPages = newNumberPages;
	ISBN …
vindom 0 Newbie Poster

Just to remind it goes :manager/Stock(abstract)/Item/publication/book .
There's nothin in Stock.cpp and I'm not sure if I need this at all..But it's there and it works.

This is header file for book.cpp

#pragma once
#include "publication.h"

class Book:
	public publication
{
public:
	Book(void);
	Book(string SID, string ISBN, string Title, string Publisher, string SubjectArea, string NumberPages,string Price);
	~Book(void);
	void getAllDetails();
	
	
};

This is header file for Item.cpp

#pragma once
#include <string>
using namespace std;

class Item:
	public stock
{
protected:
	string StockID;
	string ISBN;
	string ISSN;
	string Title;
	string IssueNo;
	string IssueDate;
	string Publisher;
	string SubjectArea;
	string NumberPages;
	string RunningTime;
	string StorageCase;
	string CDType;
	string TrackNo;
	string Artist;
	string Format;
	string Genre;
	string Price;
	
	
public:
	Item(void);
	Item(string StockID, string Title, string Publisher, string Price, string SubjectArea, string NumberPages, string ISBN, string ISSN,string IssueNo,string IssueDate,string RunningTime,string StorageCase,string CDType, string TracNo,string Artist,string Format, string Genre);
	~Item(void);
	string getStockID();
	string getPrice();
	string getTitle();
	string getPublisher();
	string getNP();
	string getSA();
	string getISBN();
	string getISSN();
	string getIssueNo();
	string getIssueDate();
	string getRunningTime();
	string getStorageCase();
	string getCDType();
	string getTrackNo();
	string getArtist();
	string getFormat();
	string getGenre();

	void setStockID(string newStockID);
	void setTitle(string newTitle);
	void setPublisher(string newPublisher);
	void setPrice(string newPrice);
	void setISBN(string newISBN);
	void setISSN(string newISSN);
	void setIssueNo(string newIssueNo);
	void setIssueDate(string newIssueDate);
	void setNumberPages(string newNumberPages);
	void setSubjectArea(string newSubjectArea);
	void setRunningTime(string newRu8nningTime);
	void setStorageCase(string newStorageCase);
	void setCDType(string newCDType);
	void setTrackNo(string newTrackNo);
	void setArtist(string newArtist);
	void setFormat(string newFormat);
	void setGenre(string newGenre);
	virtual void getAllDetails();
	
};

This is Item.cpp with getStockID() in it:

#include "StdAfx.h"
#include "Item.h"

Item::Item(void)
{ …
vindom 0 Newbie Poster

This simple function returns all details apart from ID ....

void manager::ListStock() 
{
	system("cls");
	cout << endl << "Stock Items" << endl << "<=====================>" << endl;	
	vector <Item*>::iterator iter = theStock.begin();
	for(iter = theStock.begin();iter != theStock.end();++iter)
	{   
		cout<<(*iter)->getStockID() << endl;
		(*iter)->getAllDetails();
		cout << endl << "==================" << endl;
	}
	cout << endl << "End of List" << endl;
}
vindom 0 Newbie Poster

I use getAllDetails() to display The Stock and if I add new item befor this function I can see that in a list..here's the code

#pragma once
#include <vector>
using std::vector;
class manager
{
private:
	string CurrentUserID;
	vector <customer*> theCus;
	vector <Item*> theStock;
	void BuildCustomerVector();
	void BuildStockVector();
	void BuildAdminVector();
    void Login();
	void aLogin();
	void uLogin();
	void AddUser();
	void AddAdmin();
	void AddCustomer();
	void ListUsers();
	void EditUser();
	void ListStock();
	void ChangePass();
	void AddStock();
	void AddBook();
	void AddJournal();
	void AddVideo();
	void AddMusicCD();
	void EditStockItem();
	void HireInfo();
	

public:
	manager(void);
	~manager(void);
	void ShowUserMenu();
	void ShowAdminMenu();

};
vindom 0 Newbie Poster

I can add stock and display it back no problem

vindom 0 Newbie Poster

You're right Z is fine but (*iter)->getStockID() displays nothing...absolutely nothing..I'm thinking about earlier stage and ....Be4 classes were controller/stock/item/book and it was working fine.. But later I've added another class so now I have like controller/stock/item/publication/book, but I still can't imagine where the problem might be...

vindom 0 Newbie Poster

As far as I understand getStockID() is not working..

vindom 0 Newbie Poster

Oh another thing .. The classes are (controller/Stock/Item/Publication/Books) ( controller/Stock/Item/Publication/Journals) ( controller/Stock/Item/av/Video) and ( controller/Stock/Item/av/MusicCD)

vindom 0 Newbie Poster

It's askin to enter ID of the item to edit but when I do so it returns NOT FOUND...I'm newbie to C++ so not sure if I have to upload any other files for a full picture...

vindom 0 Newbie Poster

Hi every1!
Thats my code that used to work before I've added some attributes to my items.

void manager::EditStockItem()
{
  ListStock();
		{
			string z;
			bool found;

			cout<< endl<<"<===================================================>"<<endl<<endl;
			cout << "Enter ID of the Stock Item you want to edit" << endl<<endl;
			cin>>z;

			found = false;
	          vector <Item*>::iterator iter = theStock.begin();
	          for(iter = theStock.begin();iter != theStock.end();++iter)
				{
				
					if (z == ((*iter)->getStockID()))
					  {
						 found = true;
						 break;
					  }
			    }

			if(found)
				{
					system("cls");
					char choice;
					bool valid = false;
					for(;;) 
					{
						system("cls");
						do 
						  {
							cout << " Edit details of "<<z<<endl;
							cout << "		1. To edit ID\n";
							cout << "		2. To edit Title\n";
							cout << "		3. To edit Publisher\n";
							cout << "		4. To edit Price\n";
							cout << "		5. To Cancel\n";
							cin >> choice;
							if(choice == '5') 
								{
									ShowAdminMenu();
								}

							else if(choice < '1' || choice > '4')
								{		
									cout << "\nNot a valid char!\n\n";
									char aChar;
									cout << endl << "Enter any character to continue .. " << endl;	
									cin >> aChar;
									system("cls");
								}
							else
							    {
								    valid = true;
							    }
						}
					  while(!valid);
					  cout << "\n";
					  switch(choice) 
						{
						  char aChar;
						  case '1':
							 {
								cout << "Enter new ID" << endl;
								string newStockID;
								cin.sync();
								getline(cin,newStockID);
								(*iter)->setStockID(newStockID);
								ListStock();
							 }
							cout << endl << "Enter any character to continue .. " << endl;	
							cin >> aChar;
							break;
					      case '2':
							 {
								cout << "Enter new Title: " << endl;
								string newTitle;
								cin.sync();
								getline(cin,newTitle);
								(*iter)-> setTitle(newTitle);
								ListStock();
							 }
					       cout << endl << "Enter any character to continue .. " << endl; …