Jump to content

Guber-X

Members
  • Posts

    127
  • Joined

  • Last visited

Everything posted by Guber-X

  1. i have no idea what ajax is... lol
  2. this is one thing im pretty stumped on, i have done searches and tried a few different banner rotators, but they all rotate on page reload. im looking for time based rotator that doesnt require a page reload. as far as it goes, i have nothing thats working the way im looking for. I have a database table called "featurebox" and the colums are "id", "imgsrc", "imgurl". the other tough part is that i need it to switch with a background image of a table. my layout for this would not work if it was just a image in a table :/ I have a rotator working for it at this moment. but its in java, and i want to get rid of the java cuz it dont work to well with php or at least not well for me. this is the page that im working on. www.fightingforyesterday.com/index.php that spot where u see some images changes in the box where "feature" is titled. thats just java and they have no links to click on. and i want to change it so each image has its own URL to goto. it is the same idea as a banner rotator, but of course its not for ads to other sites. i dont really have any code that would be usefull to show you to help out. but if you want to see something just let me know
  3. As far as it goes for me I have the switch() working, but not to what im trying to do. This is for a "media" page where I have 3 different categories "Music", "Videos" and "Photos". I'm trying to get it so when you goto the "Media" page it will show just the 3 categories, that section works but it is also showing the sub categories for all them categories. So for what im trying to do is when viewing the "media" page, it will display the 3 categories, then when selecting the category it will display the "sub categories". and then when you select the "sub category" it will display the contents of that "sub category" should i be trying to do this a different way? or do i have something wrong here? lol here is my switch() code <?php $cat = (isset($_GET["m_cat"])) ? (intval($_GET["m_cat"])) : 0; switch($_GET["b"]=="true") { default : if("/ffy/media.php"==$_SERVER['PHP_SELF']) { echo "Select a Category"; } case "false": if($_GET["m_cat"]==$cat) { echo "<font size='3'>"; $dcat = mysql_query("SELECT * FROM media_sub_cat WHERE m_cat=$cat") or die("mySQL Query Failed: " .mysql_error()); while($catrow = mysql_fetch_array($dcat)) { list($id, $m_sub_cat, $m_cat) = $catrow; echo ": <font class='myFont'><a href='media.php?b=true&cat=".$m_cat."&subcat=".$m_sub_cat."'>".$m_sub_cat."</a></font> "; } echo ":</font>"; echo "Work Damb You"; } break; case "true": if($_GET["cat"]==$cat && $_GET["subcat"]==$m_sub_cat) { echo "Weird..."; } break; } ?>
  4. okay, well i think i got it figured out. i just made my SELECT grab from the same amount of fields for both and it finally displays my query. now just modify the layout $query = "(SELECT id, header, date, news FROM news) UNION ALL (SELECT eventdate, date, header, description FROM event) ORDER by date"; $result = mysql_query($query) or die("Query Failed: ".mysql_error()); while ($row = mysql_fetch_array($result)) { print_r($row); }
  5. well, im not new to mysql and php... ive been using it for many years. but just simple uses... okay so i did some more research and adjusted my code to the code quote and now i get this error... Query Failed: The used SELECT statements have a different number of columns $query = "(SELECT * FROM news) UNION (SELECT * FROM event)"; $result = mysql_query($query) or die("Query Failed: ".mysql_error()); while ($row = mysql_fetch_array($result)) { print_r($row); }
  6. anything i try i get this error report Fatal error: Call to undefined function msql_error() in C:\xampp\htdocs\FFY\contact.php on line 29 and line 29 in my code is: 26|| <?php 27|| 28|| $result = mysql_query("'SELECT * FROM news' UNION 'SELECT * FROM event' ORDER by date") 29|| or die("query failed: " . msql_error());
  7. for some reason, it does not like the UNION query... i have tried it many different ways after doing some research on the mysql_query union. am i doing something wrong? ill list the ways ive tried with the Union query $result = mysql_query("SELECT * FROM news UNION SELECT * FROM event ORDER by date"); if(!$result){ die("query failed: " . msql_error()); } $sql = "SELECT * FROM news UNION SELECT * FROM event"; $result = mysql_query($sql); if(!$result){ die("query failed: " . msql_error()); } $sql = "(SELECT * FROM 'news') UNION (SELECT * FROM 'event')"; $result = mysql_query($sql); if(!$result){ die("query failed: " . msql_error()); }
  8. well, i dont know if i explained what im trying to do the very well.. so ill try this again lol okay so what i need is to "Display" two different tables in the same section by date. So if i have a "News" post thats newer than an "Event" post the "News" post will be first in line to be displayed. But for laying out the details for each table needs to be different. Somethin like this if order or recent dates go News, Event, Event, News ====Featured============================================ || || || || || || News header || Event Header || Event Header || News Header || || Date || Date || Date || Date || || Details up to || image || image || Details up to || || 96 char || || || 96 char || || || || || || ======================================================
  9. yeah im back again with yet another thing i need some help lol. what im trying to do is set up a "Feature" box that will pull data from multiple tables by date. as of right now i would like to pull data from my "news" table and my "event" table. both need to be displayed differently. table contents: News ------- id date header news edate Event ------- id eventdate cdate header description image location so now I would like to make the mysql_query to get the info from both tables and list them by recent date. "date" and "cdate" are the dates i want the query to read from and of course display from most recent.
  10. well im just an idiot.... of course i bump this post and then did some testing and got it to work... needed to put this in my query <?php $result = mysql_query("SELECT * FROM event WHERE eventdate >= CURDATE() ORDER by eventdate DESC"); ?> looks like my problem was that i put the "WHERE" after the "ORDER by"
  11. What I am trying to do is I am making a Event page and I would like to have it list the events in 2 sections. One being "On" or "Before" current date and the next being "Past" current date so I can list the events in "Upcoming Events" and "Past Events" the code im showing here is for the listing of my event page I just need help turning this query into two separate querys with the date function im looking for. <?php $result = mysql_query("SELECT * FROM event ORDER by eventdate DESC"); if (!$result) { die("query failed: " . msql_error()); } while ($row = mysql_fetch_array($result)) { list($id, $eventdate, $header, $description, $image, $location) = $row; $description = nl2br($description); $eventdate = date("M j, Y",strtotime("$eventdate")); print(' <table width="680" border="0" cellpadding="14" cellspacing="0"> <tr> <td> <div class="myFont"><font size="+1" color="#4e8baf">'.$eventdate.' - </font><font size="+1"><b>'.$header.'</b></font></div> <font size="+1"><a href="event.php?list=true&eventid='.$id.'">Details</a></font><br /> <hr color="#FFFFFF" width="100" align="left" size="1"> </td> </tr> </table> '); } ?>
  12. well i got her figured out after a bunch of trial and error lol i had to change this line for the detail area <?php $id = $_GET["eventid"]; $result = mysql_query("SELECT * FROM event WHERE id=$id LIMIT 1"); ?>
  13. This is for band website for its event listings. The main event page list everything fine, but once selecting the "Details" link which activates the switch event. Its no longer showing anything. When I had one event in the data base it worked fine, but now I have 3 events in the database and now its not working. Page can be viewed here: http://184.66.66.169/ffy/event.php <?php //Event Code Here $eventid = (isset($_GET["id"])) ? intval($_GET["id"]) : 0; switch($_GET["list"]=='true') { case "0": if($_GET["id"]== $eventid) { $result = mysql_query("SELECT * FROM event ORDER by eventdate DESC"); if (!$result) { die("query failed: " . msql_error()); } while ($row = mysql_fetch_array($result)) { list($id, $eventdate, $header, $description, $image, $location) = $row; $description = nl2br($description); $eventdate = date("M j, Y",strtotime("$eventdate")); print(' <table width="680" border="0" cellpadding="14" cellspacing="0"> <tr> <td> <div class="myFont"><font size="+1" color="#4e8baf">'.$eventdate.' - </font><font size="+1"><b>'.$header.'</b></font></div> <font size="-2" color="#CCCCCC"><a href="event.php?list=true&eventid='.$id.'">Details</a></font><br /> <hr color="#FFFFFF" width="100" align="left" size="1"> </td> </tr> </table> '); }} break; case "true": if($_GET["id"]==$eventid) { $resultd = mysql_query("SELECT * FROM event WHERE id=$eventid LIMIT 1"); if (!$resultd) { die("query failed: " . msql_error()); } while ($row = mysql_fetch_array($resultd)) { list($id, $eventdate, $header, $description, $image, $location) = $row; $description = nl2br($description); $eventdate = date("M j, Y",strtotime("$eventdate")); print(' <table width="680" border="0" cellpadding="14" cellspacing="0"> <tr> <td> <div class="myFont"><font size="+1" color="#4e8baf">'.$eventdate.' - </font><font size="+1"><b>'.$header.'</b></font></div> '.$description.'<br /> <hr color="#FFFFFF" width="100" align="left" size="1"> <center> '.$location.' </center> </td> </tr> </table> '); } break; }} ?>
  14. okay, so I ended up using a image file upload script i found on the net, made sure it worked then started to modify it. so far the image upload works, but only about have the info is being put into the database. in my database: id (auto increments) pic_id (not working) file_name (works) cat_id (not working) comment (works) ive been trying to get this to work for the past 5 hours and ive had no luck so far upload.php page <form enctype="multipart/form-data" action="add.php" method="POST"> Category: <select name="cat_id"> <?php mysql_connect("localhost", "root", "") or die(mysql_error()) ; mysql_select_db("test") or die(mysql_error()) ; $result = mysql_query("SELECT * FROM photo_cat ORDER by id"); if (!$result) { die("query failed: " . msql_error()); } while ($row = mysql_fetch_array($result)) { list($id, $cat_name, $cat_id, $location) = $row; print('<OPTION VALUE="'.$cat_id.'">'.$cat_name); } ?> </select><br /> Photo: <input type="file" name="file_name"><br> Comment:<br /> <textarea name="comment" cols="30" rows="10"></textarea><br> <input type="submit" value="Add"> </form> add.php page <?php mysql_connect("localhost", "root", "") or die(mysql_error()) ; mysql_select_db("test") or die(mysql_error()) ; $result = mysql_query("SELECT * FROM photo_img ORDER by id"); if (!$result) { die("query failed: " . msql_error()); } $pic_id = mysql_num_rows($result) + 1; //This is the directory where images will be saved $target = "images/"; $target = $target . basename( $_FILES['file_name']['name']); //This gets all the other information from the form $pic_id=$_POST['pic_id']; $cat_id=$_POST['cat_id']; $comment=$_POST['comment']; $file_name=($_FILES['file_name']['name']); // Connects to your Database mysql_connect("localhost", "root", "") or die(mysql_error()) ; mysql_select_db("test") or die(mysql_error()) ; //Writes the information to the database $query = "INSERT INTO photo_img (pic_id, cat_id, comment, file_name) VALUES ('$pic_id', '$cat_id', '$comment', '$file_name')"; mysql_query($query) or die('Error, insert query failed: '.mysql_error()); //Writes the photo to the server if(move_uploaded_file($_FILES['file_name']['tmp_name'], $target)) { //Tells you if its all ok echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?>
  15. whoa!... sweet that totally worked. i was gonna try and write that out a totally different way and it probably wouldnt have worked. thank you so much
  16. okay, thnx. but sorry, i need someone to spell it out for me on this one i dont really know how its done?
  17. okay so basicly it works but the problem is that when you try to view that last image, it doesnt load. and im lost in how to write the code. if anyone could help me out that would be great link to page to see whats up lol http://70.66.201.161/timeless/photos.php?cat_id=2&page=1 <?php echo "<br /><br />"; $result3 = mysql_query("SELECT * FROM photo_img WHERE pic_id=$pic_id LIMIT 1"); if (!$result3) { die("query failed: " . msql_error()); } $result4 = mysql_query("SELECT * FROM photo_cat WHERE cat_id=$category ORDER by id LIMIT 1"); if (!$result4) { die("query failed: " . msql_error()); } while ($row = mysql_fetch_array($result4)) { list($id, $cat_name, $cat_id, $location) = $row; while ($row = mysql_fetch_array($result3)) { list($id, $pic_id, $file_name, $cat_id, $comment,) = $row; $resultNxt = mysql_query("SELECT * FROM photo_img WHERE cat_id=$category AND pic_id > $pic_id LIMIT 1"); if (!resultNxt) { die("query failed: " . msql_error()); } while ($nextrow = mysql_fetch_array($resultNxt)) { $nextimg = $nextrow['pic_id']; print('<a href=photos.php?cat_id='.$cat_id.'&thumb=full&pic_id='.$nextimg.'><img src="images/'.$location.$file_name.'" border="0"></a>'); } } } ?>
  18. bump if anyone can help me out it would be greatly appreciated
  19. as far as i see it, everything works cept the if and elseif actions...
  20. my idea was to have a photo album with categories. Categories will be listed at the top at all times, when a category is selected list photos that are in that category. then when a photo is selected, display the photo in full. ive been trying to get this to work for a few days now, and its just not working out for me. I can make it work to the point that is shows the thumbnail, then when clicked displayin the full size, but the thumbnail is still displayed above it. ive done similar stuff like this, but just with content, the basic category select and display whats in it. but some reason i cant get this one to work ??? heres the link: http://70.66.236.26/timeless/photos.php heres my code(sorry for the mess, if theres a cleaner way to do please help me out) <? $result = mysql_query("SELECT * FROM photo_cat ORDER by id"); if (!$result) { die("query failed: " . msql_error()); } while ($row = mysql_fetch_array($result)) { list($id, $cat_name, $cat_id, $location) = $row; print(': <a href=photos.php?cat_id='.$cat_id.' target="_top">'.$cat_name.'</a> :'); } ?> </center> <hr width="350" align="center" /> <? $category = (isset($_GET['cat_id'])) ? intval($_GET['cat_id']) : 0; if($_GET['cat_id']==$category){ $result = mysql_query("SELECT * FROM photo_cat WHERE cat_id=$category ORDER by id"); if (!$result) { die("query failed: " . msql_error()); } while ($row = mysql_fetch_array($result)) { list($id, $cat_name, $cat_id, $location) = $row; $result2 = mysql_query("SELECT * FROM photo_img WHERE cat_id=$category ORDER by id"); if (!$result2) { die("query failed: " . msql_error()); } while ($row = mysql_fetch_array($result2)) { list($id, $pic_id, $file_name, $cat_id, $comment) = $row; print('<a href="photos.php?cat_id='.$cat_id.'&pic_id='.$pic_id.'"><img src="images/'.$location.$file_name.'" width="100" border="0"></a>'); }} } echo('<br />'); $pic_id = (isset($_GET['pic_id'])) ? intval($_GET['pic_id']) : 0; if($_GET['cat_id']==$category && $_GET['pic_id']==$pic_id){ $result3 = mysql_query("SELECT * FROM photo_img WHERE pic_id=$pic_id LIMIT 1"); if (!$result3) { die("query failed: " . msql_error()); } while ($row = mysql_fetch_array($result3)) { print('<img src="images/'.$location.$file_name.'" border="0">'); }} ?>
  21. ah there we go, it works great now. it woulda help if i had something in the database for that category
  22. okay that worked better, but only one category isnt working... and im confused... lol
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.