« first day    last day (30 days later) » 

1:24 AM
@echo
are you there
 
@meda shoot sorry yeah I'm here
I was wondering if you could take a look at this question for me. @meda
I got a couple answers, but was wondering if you might know a better way I could go about it.
 
 
1 hour later…
3:00 AM
@echo
did I misunderstood it>
 
yeah
oh wait
no you didn't misunderstand I think I get it now
@meda not sure how to make the album_id on the gallery table a foreign key linked to the albums table.
I'm researching it though
 
Its just a relationship
 
Do I need to do anything special in the database
using phpMYAdmin
 
Oh thank you. Going to watch now
 
3:06 AM
ALTER TABLE gallery
ADD FOREIGN KEY (album_id)
REFERENCES albums(album_id)
if you prefer sql ...
 
oh awesome even better!
tried the sql and got this error..
Cannot add or update a child row: a foreign key constraint fails (villas.#sql-ab4_2a3, CONSTRAINT #sql-ab4_2a3_ibfk_1 FOREIGN KEY (album_id) REFERENCES albums (album_id))
 
3:45 AM
@meda hmm... I tried your php query and when I click the archived albums, i.e link "Test Album 1" I works, but all the images show up instead of the 4 images I have in that album.
 
are your table linked
@echo
    SELECT  gallery.id,
    		gallery.added,
    		gallery.album,
    		gallery.title,
    		gallery.description,
    		gallery.file_name
    FROM gallery
    INNER JOIN albums
    ON gallery.album_id = albums.album_id
    WHERE gallery.album = :album_id
    ORDER BY gallery.id DESC LIMIT :start, :limit
oops I forgot the where clause
 
No I don't think so I tried the foreign key, but can't seem to figure it out.
 
@echo try this new query above
 
Okay they must not be linked. I just entered that query and none of the images show up now. Just a bunch of Invalid parameter number Warning. But at least you got me on the right track
Be right back
 
4:00 AM
   SELECT  gallery.id,
    		gallery.added,
    		gallery.album,
    		gallery.title,
    		gallery.description,
    		gallery.file_name
    FROM gallery
    INNER JOIN albums
    ON gallery.album_id = albums.album_id
    WHERE gallery.album = $album_id
    ORDER BY gallery.id DESC LIMIT $start, $limit
use variables if you want to
 
 
11 hours later…
2:34 PM
@meda hey I got the foreign key figured out but now I can't upload images to my gallery table..?
here is the sql
ALTER TABLE gallery
ADD FOREIGN KEY (album_id)
REFERENCES albums(album_id)
ON DELETE RESTRICT ON UPDATE RESTRICT ;
So in my gallery table I have it setup like this:
Here is the Foreign key setup in the gallery table:
@meda Thanks for your help I'll be here, if you get a chance to take a look.
 
3:02 PM
Good @echo
then you dont need the JOIN, you have integirty in your data
a simple WHERE clause will do it
 
So what about the issue with not being able to upload images after I created the Foreign Key? @meda
 
oh
why it is not uploading
 
I'm not sure? If I remove the key it uploaded if I add it it doesn't upload...?
@meda here is the code if you have time to take a look. Much of it is file resizing stuff. There is two areas where you can see the queries. At the top and towards the bottom.
I actually think you helped me right this. lol
 
3:19 PM
                                                        $insertdata = DB::getInstance()->insert('gallery', array(
                                                                'album_id'               => $album_id,
                                                                'added'                  => $added,
                                                                'title'                  => $title,
                                                                'album'                  => $album,
this is the part that insert reight
 
correct
I think I would have to get that album_id from the albums table, so it can be inserted into the gallery table, just not sure how to do that. OR should the album_id of the gallery table already be generated to the correct album number
 
but how does a user upload the picture
does he need to be inside of an album
 
Yes if you look at the bottom of the page there is a select menu that allows the user to add images into the album they just create previously.
`<form action="" method="post" enctype="multipart/form-data">

Choose an album*:<br>


<?php
$db = DB::getInstance();
$album = "SELECT `album_id`,`album_date`, `album_title` FROM `albums` ORDER BY `album_date` DESC";
$query = $db->query($album);
?>
<select name="album">
<option selected="selected" value="" disabled>Please Choose</option>
    <?php foreach($query->results() as $alb): ?>
        <option value="<?php echo escape($alb->album_title); ?>"><?php echo escape($alb->album_title); ?></option>
 
this line
<option value="<?php echo escape($alb->album_title); ?>">
 
yes that allows them to select the album
 
3:32 PM
<option value="<?php echo escape($alb->album_id); ?>">
the value should be the album id
because title is not relevant
This means $_POST['album'] gives you the album id value
 
where would I need to place $_POST['album'] ?
 
You seem to have a custom function for this
$album_id = Input::get('album_id');
should be
    $album_id   =   Input::get('album');
because thats what you called it in the dropdown
<select name="album">
 
Awesome that worked. Thank you so much! @meda
No let me check if the album archive is working
*Now
@meda thats not working correctly, but I need to change the query now. I'm going to try and figure that out. Mind if I hollar at you if I get stuck again?
 
no problem Im here hanging
 
3:51 PM
@meda I would just have to call my query from the gallery table, correct?
Like this.
SELECT
	id,
	album_id,
        added,
        album,
        title,
        description,
        file_name
FROM gallery WHERE id = album_id
ORDER BY id DESC LIMIT $start, $limit
 
no
 
oh
 
SELECT
	id,
	album_id,
        added,
        album,
        title,
        description,
        file_name
FROM gallery WHERE album_id = $album_id
ORDER BY id DESC LIMIT $start, $limit
 
I get a Undefined variable: album_id when I do it like that? Where do I define it?
 
4:08 PM
where do you run this query
you need to grab the album id and pass it to this query
You have this in your question
<a href="../gallery/album.php?=<?php echo escape ($ga->album_id);?>">
in album.php you grab album id
 
So should I make the link like this
<a href="../gallery/album.php?=<?php echo escape ($ga->$album_id);?>">
($ga->$album_id);?>">
 
"../gallery/album.php?id=<?php echo escape ($ga->$album_id);?>"
then you can read $album_id = $_GET['id'];
 
4:32 PM
@meda Sorry for my ignorance here.
Okay if I want the link to display
album.php?id=<?php echo escape ($ga->$album_id);?>"
Would I set my variable up like this: $album_id = ['album_id'];
here is a link to the Album archive side bar. If you want to check out the code.
http://pastebin.com/Aai5ZkVr
 
$album_id = $_GET['id'];
because its a query string
@echo
 
yes
okay let me try that out
when I add that to the album-archive.php page it gives me an Undefined index: id Notice..?
 
4:50 PM
where
 
On my album archive side bar link.

Here are my pages if you want to take a look.
1. album.php http://pastebin.com/VLpTyPne (this is where the album pages are created.
2. pagination-album-gallery.php (this goes along with album.php
3. album-archive.php this contains the link to the albums in the side bar.
http://pastebin.com/Aai5ZkVr
@meda if you help me get this all working I'll pay you. Just send me your paypal details.
 
lets do it step by step
which code populate the albums
 
album.php, but pagination-album-gallery.php is included and calls the query for the images / album
 
5:06 PM
okay so which part is broken
 
I guess I would start off with the link. In album-archive.php it gives me an Undefined index: id Notice
line 80 &81
 
ok show me the code for that
 
Full code: http://pastebin.com/Aai5ZkVr
80 and 81
       <?php $album_id = $_GET['id'];?>
<a href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/gallery/album.php?id=<?php echo escape ($ga->$album_id);?>">
I have team viewer installed If you want to remote in. Just throwing that out there.
 
5:22 PM
<?php foreach ($ga as $ga): ?>
this is an odd loop,
I dont think yoou needed 4 loops, to achieve this
@echo
 
You are probably right, I wrote it quite some time ago. Its a hole Year date title toggle menu.
 
you have a screen shot of the result
?
 
for this page remove
<?php foreach ($ga as $ga): ?>
	<li>
	<?php $album_id = $_GET['id'];?>
	<a href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/gallery/album.php?id=<?php echo escape ($ga->$album_id);?>">
	<?php //echo escape (date("M. d, Y", strtotime ($ga->album_date))); ?> <!-----> <?php echo escape ($ga->album_title); ?>
	</a>
	</li>
<?php endforeach ?>
<li>
	<a href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/gallery/album.php?id=<?php echo escape ($ga->$album_id);?>"></a>
</li>
just keep that
<li>
	<a href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/gallery/album.php?id=<?php echo escape ($ga->$album_id);?>"></a>
</li>
 
okay all still works exept the link does not show anymore.
 
5:37 PM
<ul>
	<li>
	<a href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/gallery/album.php?id=<?php echo escape ($ga->$album_id);?>">
	<?php echo escape ($ga->album_title); ?>
	</a>
	</li>
</ul>
opps I forgot the title
 
Now i get this
Here is what the source code says.
<ul>
	<li>
	<a href="http://dev.villasatgg.com/gallery/album.php?id=<br />
<b>Notice</b>:  Undefined variable: album_id in <b>D:\htdocs\villasatgg.com\gallery\album-archive.php</b> on line <b>77</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>D:\htdocs\villasatgg.com\gallery\album-archive.php</b> on line <b>77</b><br />
">
	<br />
<b>Notice</b>:  Trying to get property of non-object in <b>D:\htdocs\villasatgg.com\gallery\album-archive.php</b> on line <b>78</b><br />
	</a>
 
6:01 PM
Ok
can you go back to the code that was working
I hope you keep copies
@echo
 
I do and I already went back to it =)
 
lol
 
This works and grabs the album id
<ul>

<?php foreach ($ga as $ga): ?>

<li>

<a href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/gallery/album.php?=<?php echo escape ($ga->album_id);?>">

<?php //echo escape (date("M. d, Y", strtotime ($ga->album_date))); ?> <!-----> <?php echo escape ($ga->album_title); ?>

</a>

</li>

<?php endforeach ?>

</ul>
 
perfect
dont touch this no more
now look into album.php
 
Okay just notice there is no $album_id
in the link
this is where it takes me though
.com/gallery/album.php?=16
which works for me
@meda is that cool, ready to move on or do we need to address the no $album_id variable
 
6:08 PM
what you mean no albumid
I m not sure
 
in your code you said add this to my link.
 
/gallery/album.php?id=<?
 
album.php?id=<?php echo escape ($ga->$album_id);?>">
 
yes simpley add id
yes like this exactly
 
that doesn't work though.
This works
album.php?=<?php echo escape ($ga->album_id);?>">
 
6:11 PM
doesnt not work how come
 
lol because $album_id is not defined and I don't know how to get it defined
 
oh
remove the dollar sign bro
 
notice the $ in your link and
no $ in mine
 
yes sometimes I mess up
sorry
 
I removed it
okay cool
 
6:13 PM
is that working
 
album.php?id=<?php echo escape ($ga->album_id);?>">
This is working
 
ok
 
okay now album.php
 
next do this
if(isset($_GET['id']){
 
on album.php
 
6:16 PM
if(isset($_GET['id']){
 $album_id = $_GET['id'];
 echo "album_id = ".$album_id;
}
 
ok I'm sorry where exactly does that need to go?
 
Album.php
 
When I place it I get a syntax error on the IF line
@meda should I place it maybe in the pagination-album-gallery.php since that is calling in the images?
It's working now!!!
Just needed to add $album_id = $_GET['id']; to the top of pagination-album-gallery.php @meda
album 1:
album 2:
main gallery:
 
6:44 PM
Great!!!
 
Can I bother you for one last thing?
I also have a page that uploaded more than 1 image. and can't seem to get it to work correctly after the Foreign Key
Never mind just figured it all out.
@meda I said I would pay you. I can't afford much but I'll send you some $$ if you send me your paypal info. I'm going to lunch right now. Be back in a bit. daugaard47@gmail.com is my email
 
7:13 PM
You know what @echo , its fine. If we ever meet you owe me a beer ;)
 
7:34 PM
@meda You're to cool man. If we ever meet, drinks are on me all night, buddy. Wait, if I remember correctly you once told me your from New York. Drinks are probably a little more expensive there than in Missouri. So... Drink on me a 1/4 of the night. LOL! Unless you find yourself in Missouri. =) Thanks again for the help. I appreciate it.
 
8:19 PM
lol you are funny, ping me anytime cheers @echo
 

« first day    last day (30 days later) »