
Bartman
Members-
Posts
27 -
Joined
-
Last visited
Never
Everything posted by Bartman
-
Thank Joel24 for let me know I am in the right direction. Any idea how I would get it working with my form? <form id="websubmission" name="websubmission" method="post" action="index.php?action=submit"> <? if(!empty($_SESSION['websubmissionstatus'])){ echo $_SESSION['websubmissionstatus']."<br/>"; $_SESSION['websubmissionstatus']="";}?> <input name="title" type="text" id="title" style="font-family: Tahoma; border: 1px solid #184A7B; background-color: #FFFFFF" size="24" maxlength="75" value="Title"> <input name="url" type="text" id="url" style="font-family: Tahoma; border: 1px solid #184A7B; background-color: #FFFFFF" value="http://" size="50"> <select name="category" style="font-family: Arial; font-size: 10px; color: #000000; padding: 2px; border: 1px solid #666666; background-color: #FFFFFF"> <option value="0" selected>Select Type</option> <? echo submit_category_list();?> </select> <input name="Submit" type="submit" id="Submit" style="font-family: Arial; font-size: 10px; color: #000000; border: 1px solid #C0C0C0; background-color: #FFFFFF" value="Submit" /> </form> This part: <? if(!empty($_SESSION['websubmissionstatus'])){ echo $_SESSION['websubmissionstatus']."<br/>"; $_SESSION['websubmissionstatus']="";}?> shows the errors for when they do not add a proper Title, URL or don't choose a category. I would like the code in this post to work for my form so that it checks if the user has added a back link on their site already before they can submit my form. If they did not have a backlink the error would show up on the page where websubmission errors show or maybe a popup window that says No backlink found. Do you understand what I am trying to do? Can you point me in the right direction?
-
Can someone please point me in the right direction on finding a script that will check for a back link before allowing the submission of a form? Maybe it is onclick or something to that nature. Thanks, I have been searching for days
-
Will this work on a submission form? I just want the form to check for a back link before allowing the submission to be added to the mysql.
-
Bump....Does anyone know of any other forums that have more javascript coders that might know how to get this working?
-
Here is what I have if anyone can help me get it working. When I click on the Close [X] it does nothing. It just waits and after the seconds the IMAGE1 appears and IMAGE2 disappears. <table border="0" width="650" id="table1" cellspacing="0" cellpadding="0" bgcolor="#000000" height="350"> <tr> <td align="center"> <script type="text/javascript"> window.onload = function () { var tim = setTimeout(function () { var div = document.getElementById('hideOverlay'); div.innerHTML = 'IMAGE1 GOES HERE'; }, 6000);} </script> <div id="hideOverlay"> <table border="0" width="650" id="table1" cellspacing="0" cellpadding="0" height="350"> <tr> <td align="center" width="650" height="350"><a style="text-decoration: none" href="javascript:void(0)" onclick="javascript:window.clearTimeout('tim')"/>Close [x]</a><br>IMAGE2 GOES HERE</td> </tr> </table> </td> </tr> </table> </div> Any ideas why it will not work? Anyone?
-
Can someone tell me how to make a close button for this? The close button I currently have here makes the IMAGE2 disappear but I cannot see IMAGE1 until the time runs out on the setTmeout. I want to be able to click the closeX and close out the whole script leaving IMAGE1 showing. Here is what I have: <table border="0" width="650" id="table1" cellspacing="0" cellpadding="0" bgcolor="#000000" height="350"> <tr> <td align="center"> <script type="text/javascript"> window.onload = function () { setTimeout(function () { var div = document.getElementById('hideOverlay'); div.innerHTML = '[b]IMAGE1 GOES HERE[/b]'; }, 6000);} </script> <div id="hideOverlay"> <table border="0" width="650" id="table1" cellspacing="0" cellpadding="0" height="350"> <tr> <td align="center" width="650" height="350"><a style="text-decoration: none" href="javascript:void(0)" onclick="var lyr =document.getElementById('hideOverlay'); lyr.innerHTML='';"/><font color="#666666" size="2">Close [x]</font></a>[b]IMAGE2 GOES HERE[/b]</td> </tr> </table></div> </td> </tr> </table> </div>
-
the adss.js just has the ad network code with a close button... the ad.js has it appear for x amount of seconds before either closing or disappearing Don't I display this from the getElementById in a div? like <div id="Something Here"> Video </div>
-
it is not an ad network. I want to put an ad in that code. I know how to do that...just want to know how to make that code appear on me site.. must be a div
-
I have a javascript file called ad.js inside looks like this var ADPLACER_PATH = "http://www.mywebsite.com/"; var PREROLL_ENABLED = 1; var MIDROLL_ENABLED = 0; var PREROLL_ZONE_ID = 0; var MIDROLL_ZONE_ID = 0; var PREROLL_TIMEOUT_IN = 0; var PREROLL_TIMEOUT_OUT = 35000; var PREROLLCLOSEBUTTON_TIMEIN = 0; var MIDROLL_TIMEOUT_IN = 0; var MIDROLL_TIMEOUT_OUT = 3000000; var PREROLL_ONSHOW = function(C){ setTimeout(function(){document.getElementById('adplacer_prerollClose'+C).onclick()}, PREROLL_TIMEOUT_OUT); } var PREROLL_ONHIDE = function(){} document.write ("<scr"+"ipt type='text/javascript' src='"+ADPLACER_PATH+"adss.js'><\/scr"+"ipt>"); It places an ad over a video on my site. I know I can add the .js to my site by adding this <script type="text/javascript" src="ad.js"></script> to my head But what do I need to add to my page to make it appear? Do I have to put the video between a DIV? Can someone let me know what I need to do to make it appear? thanks
-
OK Thanks for everyone's help I really, really appreciate it. Ok here exactly what it is I am trying to accomplish. I have 2 tables (listings & listimages) that I need to extract data from and display. There are a couple extra columns that I don't need to pull data from like price, date etc listings ------------------------------------------------------------------------------------------------------------------------------------------------------------------- id make model vehicle_type doors color mileage year listing_condition engine trans drive_train fuel_type adddesc stock ------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1 make1 model1 vehicle_type1 doors1 color1 mileage1 year1 listing_condition1 engine1 trans1 drive_train1 fuel_type1 adddesc1 stock1 2 make2 model2 vehicle_type2 doors2 color2 mileage2 year2 listing_condition2 engine2 trans2 drive_train2 fuel_type2 adddesc2 stock2 3 make3 model3 vehicle_type3 doors3 color3 mileage3 year3 listing_condition3 engine3 trans3 drive_train3 fuel_type3 adddesc3 stock3 4 make4 model4 vehicle_type3 doors4 color4 mileage4 year4 listing_condition4 engine4 trans4 drive_train4 fuel_type4 adddesc4 stock4 listimages ---------------------------------------------------- id imagepath mainimage listingid ---------------------------------------------------- 1 images/listings/a1.jpg 1 1 2 images/listings/a2.jpg 0 1 3 images/listings/a3.jpg 0 1 4 images/listings/a4.jpg 0 1 5 images/listings/a5.jpg 0 1 6 images/listings/a6.jpg 0 1 7 images/listings/b1.jpg 1 2 8 images/listings/b2.jpg 0 2 9 images/listings/b3.jpg 0 2 10 images/listings/b4.jpg 0 2 11 images/listings/b5.jpg 0 2 12 images/listings/b6.jpg 0 2 13 images/listings/c1.jpg 1 4 Ok I need a php to display all the above information in simple rows on a page. So the 4 listings.id rows above will look like this on a page (I don't need the auto_increment number to shwo) make1,model1,vehicle_type1,doors1,color1,mileage1,year1,listing_condition1,engine1,trans1,drive_train1,fuel_type1,"adddesc1",stock1,"a1.jpg,a2.jpg,a3.jpg,a4.jpg,a5.jpg,a6.jpg" make2,model2,vehicle_type2,doors2,color2,mileage2,year2,listing_condition2,engine2,trans2,drive_train2,fuel_type2,"adddesc2",stock2,"b1.jpg,b2.jpg,b3.jpg,b4.jpg,b5.jpg,b6.jpg" make3,model3,vehicle_type3,doors3,color3,mileage3,year3,listing_condition3,engine3,trans3,drive_train3,fuel_type3,"adddesc3",stock3,"" make4,model4,vehicle_type4,doors4,color4,mileage4,year4,listing_condition4,engine4,trans4,drive_train4,fuel_type4,"adddesc4",stock4,"c1.jpg" right now when I use this code: <?php // Make a MySQL Connection mysql_connect("localhost", "XXXXXXXX", "XXXXXXXX") or die(mysql_error()); mysql_select_db("XXXXXXXX") or die(mysql_error()); $result = mysql_query("SELECT * FROM listings l LEFT JOIN listimages li ON l.id = li.listingid ORDER BY l.id DESC") or die(mysql_error()); $last_listingid = null; $curRow = array(); while($row = mysql_fetch_array($result)) { // Check for a difference in listing ID - and if it is, then we should show the previous row first if ($last_listingid != $row['listingid'] && $last_listingid !== null) { // Implode the array with quotes around it echo $row['year']; echo ","; echo $row['make']; echo ","; echo $row['model']; echo ","; echo $row['vehicle_type']; echo ","; echo $row['doors']; echo ","; echo $row['color']; echo ","; echo $row['mileage']; echo ","; echo $row['listing_condition']; echo ","; echo $row['engine']; echo ","; echo $row['trans']; echo ","; echo $row['drive_train']; echo ","; echo $row['fuel_type']; echo ","; echo "Please contact"; echo ",\""; echo $row['adddesc']; echo "\","; echo $row['stock']; echo ","; echo '"http://www.website.com/' . implode(',http://www.website.com/', $curRow) . '"<br />'; // And start fresh $curRow = array(); } // Now we can save it to the array $curRow[] = $row['imagepath']; // And set the new ID $last_listingid = $row['listingid']; } // Finally, we'll need to implode it one last time since there should always be at least one value in the array echo '"http://www.website.com/' . implode(',', $curRow) . '"'; ?> I get this outcome. (Notice the row that was blank for images is now replaced with the next image down? (c1.jpg should have stayed on 4) all the images from that point move up so no rows from 3 down match the rest of the content for the images. make1,model1,vehicle_type1,doors1,color1,mileage1,year1,listing_condition1,engine1,trans1,drive_train1,fuel_type1,"adddesc1",stock1,"a1.jpg,a2.jpg,a3.jpg,a4.jpg,a5.jpg,a6.jpg" make2,model2,vehicle_type2,doors2,color2,mileage2,year2,listing_condition2,engine2,trans2,drive_train2,fuel_type2,"adddesc2",stock2,"b1.jpg,b2.jpg,b3.jpg,b4.jpg,b5.jpg,b6.jpg" make3,model3,vehicle_type3,doors3,color3,mileage3,year3,listing_condition3,engine3,trans3,drive_train3,fuel_type3,"adddesc3",stock3,"c1.jpg" make4,model4,vehicle_type4,doors4,color4,mileage4,year4,listing_condition4,engine4,trans4,drive_train4,fuel_type4,"adddesc4",stock4,"d1.jpg,d2.jpg,d3.jpg"
-
Hi scootstah, isn't my column listingid the image id column? There is both a auto_increment column and a listingid column. The listingid column numbers correspond with the auto_increment column from the Listings Table Duraso, the LEFT JOIN just outputs the same thing. I see where the error start. right after the row that does not have an image. So lets say the the ID number 5 has no images. All are fine up until 5 then ID number 6 images move up and are displayed with Number 5's info. Understand? Maybe there is a way to put something like if there is no images then display Default/images/no_image.gif Is that possible? I would rather have that row just display no images but if it is not possible then how about the Default/images/no_image.gif approach? Anyone?
-
Wondering if someone could help me. What I am trying to do is display the information from each row. I am trying to read from 2 tables and display them on a page. I want them to show like this name,make,type, price,"images/listings/a1.jpg,images/listings/a2.jpg,images/listings/a3.jpg,images/listings/a4.jpg,images/listings/a5.jpg,images/listings/a5.jpg" name,make,type, price,"images/listings/b1.jpg,images/listings/b2.jpg,images/listings/b3.jpg,images/listings/b4.jpg,images/listings/b5.jpg,images/listings/b5.jpg" Example. the table structures are as so: listings -------------------------------- id name make type price (then a couple more columns I dont need data from) -------------------------------- 1 name1 make1 type1 price1 2 name2 make2 type2 price2 3 name3 make3 type3 price3 listimages ---------------------------------------------------- id imagepath mainimage listingid ---------------------------------------------------- 1 images/listings/a1.jpg 1 1 2 images/listings/a2.jpg 0 1 3 images/listings/a3.jpg 0 1 4 images/listings/a4.jpg 0 1 5 images/listings/a5.jpg 0 1 6 images/listings/a6.jpg 0 1 7 images/listings/b1.jpg 1 2 8 images/listings/b2.jpg 0 2 9 images/listings/b3.jpg 0 2 10 images/listings/b4.jpg 0 2 11 images/listings/b5.jpg 0 2 12 images/listings/b6.jpg 0 2 13 images/listings/c1.jpg 1 3 etc Here is the code I am using. Everything works except some of the listing images don't match up to the names. I think when certain names don't have pictures it just moves up the images to the next person. I need to somehow associate the listingid column from listimages table with the id column from the listings table. The mainimage column tells what image of the group of images is default for that name. 1 being the default 0 not the default Here is the code I am using. <?php // Make a MySQL Connection mysql_connect("localhost", "xxxxxx", "xxxxxx") or die(mysql_error()); mysql_select_db("xxxxxx") or die(mysql_error()); $result = mysql_query("SELECT * FROM listings l JOIN listimages li ON l.id = li.listingid ORDER BY l.id DESC") or die(mysql_error()); $last_listingid = null; $curRow = array(); while($row = mysql_fetch_array($result)) { // Check for a difference in listing ID - and if it is, then we should show the previous row first if ($last_listingid != $row['listingid'] && $last_listingid !== null) { // Implode the array with quotes around it echo $row['name']; echo ","; echo $row['make']; echo ","; echo $row['model']; echo ","; echo $row['type']; echo ","; echo $row['price']; echo ","; echo '"' . implode(',', $curRow) . '"<br />'; // And start fresh $curRow = array(); } // Now we can save it to the array $curRow[] = $row['imagepath']; // And set the new ID $last_listingid = $row['listingid']; } // Finally, we'll need to implode it one last time since there should always be at least one value in the array echo '"' . implode(',', $curRow) . '"'; ?> Please let me know what I am doing wrong Anyone Thanks
-
Please does anyone know?
-
Thanks for your help. here exactly is is what I am trying to do. I am trying to display the information from each row. I am trying to read from 2 tables and display them on a page. I want them to show like this name,make,type, price,"images/listings/a1.jpg,images/listings/a2.jpg,images/listings/a3.jpg,images/listings/a4.jpg,images/listings/a5.jpg,images/listings/a5.jpg" name,make,type, price,"images/listings/b1.jpg,images/listings/b2.jpg,images/listings/b3.jpg,images/listings/b4.jpg,images/listings/b5.jpg,images/listings/b5.jpg" Example. the table structures are as so: listings -------------------------------- id name make type price (then a couple more columns I dont need data from) -------------------------------- 1 name1 make1 type1 price1 2 name2 make2 type2 price2 3 name3 make3 type3 price3 listimages ---------------------------------------------------- id imagepath mainimage listingid ---------------------------------------------------- 1 images/listings/a1.jpg 1 1 2 images/listings/a2.jpg 0 1 3 images/listings/a3.jpg 0 1 4 images/listings/a4.jpg 0 1 5 images/listings/a5.jpg 0 1 6 images/listings/a6.jpg 0 1 7 images/listings/b1.jpg 1 2 8 images/listings/b2.jpg 0 2 9 images/listings/b3.jpg 0 2 10 images/listings/b4.jpg 0 2 11 images/listings/b5.jpg 0 2 12 images/listings/b6.jpg 0 2 13 images/listings/c1.jpg 1 3 etc Here is the code I am using. Everything works except some of the listing images don't match up to the names. I think when names don't have pictures it just moves up the images to the next person. I need to somehow associate the listingid column from listimages table with the id column from the listings table. The mainimage column tells what image of the group of images is default for that name. 1 being the default 0 not the default Here is the code I am using. <?php // Make a MySQL Connection mysql_connect("localhost", "xxxxxx", "xxxxxx") or die(mysql_error()); mysql_select_db("xxxxxx") or die(mysql_error()); $result = mysql_query("SELECT * FROM listings l JOIN listimages li ON l.id = li.listingid ORDER BY l.id DESC") or die(mysql_error()); $last_listingid = null; $curRow = array(); while($row = mysql_fetch_array($result)) { // Check for a difference in listing ID - and if it is, then we should show the previous row first if ($last_listingid != $row['listingid'] && $last_listingid !== null) { // Implode the array with quotes around it echo $row['name']; echo ","; echo $row['make']; echo ","; echo $row['model']; echo ","; echo $row['type']; echo ","; echo $row['price']; echo ","; echo '"' . implode(',', $curRow) . '"<br />'; // And start fresh $curRow = array(); } // Now we can save it to the array $curRow[] = $row['imagepath']; // And set the new ID $last_listingid = $row['listingid']; } // Finally, we'll need to implode it one last time since there should always be at least one value in the array echo '"' . implode(',', $curRow) . '"'; ?> Please let me know what I am doing wrong thanks.
-
ok King I joined like you said...everything comes up like I wanted except the first row (which is actual the last item ID number because it is DESC). Every row appears except the last entry at the end is missing so row 102 is not showing...any ideas? I changed the mysql_query to this: $result = mysql_query("SELECT * FROM listings l JOIN listimages li ON l.id = li.listingid ORDER BY l.id DESC") I used * because I wanted to add like 14 other columns to it.
-
WOW KingPhilip that worked....all is listed exactly how I wanted. Thank you so much. Could I bother you with one more question? If I want to add another Echo item such as $row['name'] or $row['price"] that matches up with the group of 6 images from one other table called "listings" how can I add that? I tried adding the $row['name'] and adding the listing to the mysql_query("SELECT * FROM listing, listimages ORDER BY listimages.listingid DESC ') But it made like 2 copies of the same thing repeating. that is awesome thanks King
-
That moved it up but the break is still there on the first one. Now it looks like this: "images/listings/listing_848813453A-1.jpg,''' "images/listings/listing_664613453A-2.jpg,'''images/listings/listing_520313453A-3.jpg,'''images/listings/listing_690513453A-4.jpg,'''images/listings/listing_125113453A-5.jpg,'''images/listings/listing_641013453A-6.jpg,''"images/listings/listing_390313190A-1.jpg," "images/listings/listing_286713190A-2.jpg,""images/listings/listing_265013190A-3.jpg,""images/listings/listing_620513190A-4.jpg,""images/listings/listing_337713190A-5.jpg,""images/listings/listing_317013190A-6.jpg,""images/listings/listing_555213016A-1.jpg," Notice the 1.jpg image is always appearing at the end of the 6. like 2,3,4,5,6 then 1 but the 1 is the image for the next row
-
Sorry I mean the images look like this: "images/listings/listing_848813453A-1.jpg", "images/listings/listing_664613453A-2.jpg","images/listings/listing_520313453A-3.jpg","images/listings/listing_690513453A-4.jpg,images/listings/listing_125113453A-5.jpg","images/listings/listing_641013453A-6.jpg,"
-
Oh you the man...that almost did it. Thanks so much. The only thing now is the first image is there then it breaks and then shows the next five in a row. If I can just get those five up one line that would be it. it looks like this now: "images/listings/listing_516013019A-only.jpg," "images/listings/listing_848813453A-1.jpg","images/listings/listing_664613453A-2.jpg","images/listings/listing_520313453A-3.jpg","images/listings/listing_690513453A-4.jpg,images/listings/listing_125113453A-5.jpg","images/listings/listing_641013453A-6.jpg," Also how can I get the quotations " one at the begging and one at the last image....not inbetween like above...I just need the comma separating them. You have help me tremendously. Thank you
-
Thanks thorpe for the help, but that just lists them all one after another without a break. I need it to break after all the images for that listingid number. So 6 images all have listingid 1 to correspond with the auto_increment id from another table to show that user uploaded 6 images. Can it be done?
-
I am looking to display image paths in a row separated by commas. There are 6 images that goes to each user and I would like only the 6 images at be in each " " Like this: "images/listings/listing_516013019A-only.jpg,images/listings/listing_848813453A-1.jpg,images/listings/listing_664613453A-2.jpg,images/listings/listing_520313453A-3.jpg,images/listings/listing_690513453A-4.jpg,images/listings/listing_125113453A-5.jpg,images/listings/listing_641013453A-6.jpg," "images/listings/listing_736913186A-1.jpg,images/listings/listing_822713186A-2.jpg,images/listings/listing_136513186A-3.jpg,images/listings/listing_700313186A-4.jpg,images/listings/listing_716013186A-5.jpg,images/listings/listing_213113186A-6.jpg," "images/listings/listing_292113254A..-1.jpg,images/listings/listing_854413254A..-2.jpg,images/listings/listing_446013254A..-3.jpg,images/listings/listing_676313254A..-4.jpg,images/listings/listing_563413254A..-5.jpg,images/listings/listing_341513254A..-6.jpg," Right now it is displaying them like this "images/listings/listing_516013019A-only.jpg," "images/listings/listing_848813453A-1.jpg," "images/listings/listing_664613453A-2.jpg," "images/listings/listing_520313453A-3.jpg," "images/listings/listing_690513453A-4.jpg," "images/listings/listing_125113453A-5.jpg," "images/listings/listing_641013453A-6.jpg," "images/listings/listing_736913186A-1.jpg," "images/listings/listing_822713186A-2.jpg," "images/listings/listing_136513186A-3.jpg," "images/listings/listing_700313186A-4.jpg," "images/listings/listing_716013186A-5.jpg," "images/listings/listing_213113186A-6.jpg," "images/listings/listing_292113254A..-1.jpg," "images/listings/listing_854413254A..-2.jpg," "images/listings/listing_446013254A..-3.jpg," "images/listings/listing_676313254A..-4.jpg," "images/listings/listing_563413254A..-5.jpg," "images/listings/listing_341513254A..-6.jpg," Here is the code I have: <?php // Make a MySQL Connection mysql_connect("localhost", "xxxxxxxx", "xxxxxxxx") or die(mysql_error()); mysql_select_db("xxxxxxxx") or die(mysql_error()); $result = mysql_query("SELECT * FROM listimages ORDER BY listimages.listingid DESC ") or die(mysql_error()); while($row = mysql_fetch_array($result)) { echo "\""; echo "$row[imagepath],"; echo "\""; echo "<br>"; } ?> My tables for the images is "listimages" and the columns are: id (which are the auto_increments) imagepath (which shows the path/image1.jpg) mainimage (which just shows 0 or 1 depending on the picture that is the default for that listing, 1 being default) listingid (shows numbers 1 2 3 etc corresponding to the Id in the listings table to show what images go with what listing) There are up to 6 images for each listing. Any idea how to fix this?
-
Hi mjdamato thanks again for your help...I checked for duplicates and nothing. Here is exactly what I am trying to do. I have everything working. My site runs fine. all displays perfect. I need to make a CSV of my listings table to import somewhere else. I am simply using this PHP code to display the data so I can cut and paste it to a notepad and make it a CSV file. All the columns I need are displaying properly now. Here is what I have and its probably all wrong but it is showing me what I need except the images at the end it shows all 6 images I need for each row. but it duplicates everything else. Like this: bob,sony,cdplayer,"image1.jpg" bob,sony,cdplayer,"image2.jpg" bob,sony,cdplayer,"image3.jpg" bob,sony,cdplayer,"image4.jpg" bob,sony,cdplayer,"image5.jpg" bob,sony,cdplayer,"image6.jpg" But I want it to look like this: bob,sony,cdplayer,"image1.jpg,image1=2.jpg,image3.jpg,image4.jpg,image5.jpg,image6.jpg" Here is the code <?php $result = mysql_query("SELECT * FROM listings, listimages WHERE listings.id = listimages.listingid ORDER BY listings.id DESC ") or die(mysql_error()); echo "name,product,features,photo<br>"; // keeps getting the next row until there are no more to get while ($row = mysql_fetch_assoc($result)) { $imagepath = explode(",",$row['imagepath']); foreach ($imagepath as $path) { // Print out the contents of each row into a table echo $row['name']; echo ","; echo $row['product']; echo ","; echo $row['features']; echo ",\""; echo "$path"; echo "\""; echo "<br>"; } } ?> "name", "product" and "features" columns are from the "listings" table and the images come from the "listimages". So they are like this: listings | id | name | products | features | listimages | id | imagepath | mainimage | listingid | id (which are the auto_increments) imagepath (which shows the path/image1.jpg) mainimage (which just shows 0 or 1 depending on the picture that is the default for that listing, 1 being default) listingid (shows numbers 1 2 3 etc corresponding to the Id in the listings table to show what images go with what listing) There are up to 6 images for each listing. Does that help at all?
-
Hi mjdamato thanks for your help...that did not work though When I put <?php in front and ?> at the end and add my DB info, I loaded the file and it came up Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in blah/blah/pic.php on line 19 Warning: implode() [function.implode]: Invalid arguments passed in blah/blah on line 9 I did notice you had imagespath with an s which I mistakenly put one in the post. I changed them but still nothing. BUT when i change the code and put it to this: <?php // Make a MySQL Connection mysql_connect(REMOVED HERE) mysql_select_db(REMOVED HERE) function listingImagesOutput($listingName, $imageList) { return "$listingName " . implode(', ', $imageList) . "<br>\n"; } $query = "SELECT l.listingid, li.imagepath FROM listimages AS l JOIN listimages AS li ON l.listingid = li.listingid ORDER BY l.listingid"; $result = mysql_query($query); $current_listing = false; while($row = mysql_fetch_assoc($result)) { if($current_listing != $row['listingid']) { if($current_listing != false) { //Output listing and images echo listingImagesOutput($current_listing, $imagesAry); } //Create temp array for images of this listing $imagesAry = array(); //Set flag to check for change in listing $current_listing = $row['listingid']; } //Add image path to temp array for current listing $imagesAry[] = $row['imagepath']; } //Output last listing and images echo listingImagesOutput($current_listing, $imagesAry); ?> All the images appear, they are separated by commas but are duplicated. like this. stereo1.jpg,stereo1.jpg,stereo1.jpg,stereo2.jpg,stereo2.jpg,stereo2.jpg,stereo3.jpg,,stereo4.jpg,stereo3.jpg,,stereo4.jpg,stereo3.jpg,,stereo4.jpg,stereo3.jpg,,stereo4.jpg,stereo5.jpg,,stereo5.jpg,stereo5.jpg,stereo5.jpg,stereo5.jpg,stereo5.jpg,stereo5.jpg,stereo5.jpg It is random. it duplicated them first 3 pics are the same then next 3 same, then 1 then next to 4 then back to 1 then 6 of the same...lol strange. Each listing has 6 images. I just want it to display the 6 images separated by commas then <br> to show the next 6. Cant I group the 6 images from the listingid together. Let me know if I am doing something wrong it the code. Thanks again
-
Thanks for you help mjdamato I will try and redo it. But I do have one more question if you could help I have another Table called "listimages" with 2 columns one being "imagepath" other being "listingid" imagepath has all the images for each listing. and listingid shows the number that goes with the table Listing Auto increment number SO: imagespath | listingid ----------------------------------- stereo1.jpg | 1 stereo1a.jpg | 1 stereo1b.jpg | 1 stereo2.jpg | 2 stereo2a.jpg | 2 stereo2b.jpg | 2 And so on. How can I display them in a row like stereo1.jpg, stereo1a.jpg, stereo1b.jpg When I tried it one way it would only show the first image. when I tried it a different way it showed them all but repeated other items I added over and over like this for example lets say I added another $row to display say Name, then it cam up like this sony stereo1.jpg sony stereo1a.jpg sony stereo1b.jpg jvc stereo2.jpg jvc stereo2a.jpg jvc stereo2b.jpg I want them to show like this: sony stereo1.jpg, stereo1a.jpg, stereo1b.jpg jvc stereo2.jpg, stereo2a.jpg, stereo2b.jpg thanks alot mjdamato