Jump to content

kate_rose

Members
  • Posts

    121
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

kate_rose's Achievements

Member

Member (2/5)

1

Reputation

  1. P.S. Psycho it is weird that it always displayed the second slide when it broke . . . Oh well I have to much to do to figure out why right now. K-
  2. Thank you Jessica & Psycho. The loop is working correctly now - I hadn't written one like this before & didn't realize the dif. between = & ==. Psycho, I think day of the year is probably better because the first 2 days of the month will display the same slide. The images won't be dynamic & the max will be 5 so I probably won't need a DB. & it is a good idea to use an array (I do with some of my other bits on this site). I appreciate the advice, I can obviously use it. Kate
  3. Hi, I haven't done that much in php so thanks for you patience if there are really obvious errors or bad practices I am trying to rotate the content of a div depending on the date between 3 different images (each day a new image is displayed and after 3 days it starts over - in the future we may need to add more images). For some reason my code always displays the second image of the three no matter what the day is. Here is my code. <?php $num_slides=3; //let the variable num_slides = the number of slides to be shown (in this case 3) $day_month = date('d'); //load the day of the month into $day_month $slidenum = $day_month % $num_slides; //let $remain = the remainder after $daymonth is divided by $num_slides $slidenum = 0; //override normal $slidenum generation for debugging if ($slidenum=0) {echo <<<EOL <div id="learning_outside_top"> <a href="learning_outside/learning_outside_main.php" title="link to hands on learning page" alt="link to hands on learning page"><img src="images/learning_outside_research_top.jpg" onmouseenter="this.src='images/learning_outside_research_top_mouseover.jpg'" onmouseleave="this.src='images/learning_outside_research_top.jpg'"/></a> </div> <a href="learning_outside/learning_research.php" title="link to undergraduate research FAQ page" alt="link to undergraduate research FAQ page"><img src="images/learning_outside_research_bottom.jpg"/></a> EOL; ; } elseif ($slidenum=1) {echo <<<EOD <div id="learning_outside_top"> <a href="learning_outside/learning_outside_main.php" title="link to hands on learning page" alt="link to hands on learning page"><img src="images/learning_outside_internships_top.jpg" onmouseenter="this.src='images/learning_outside_internships_top_mouseover.jpg'" onmouseleave="this.src='images/learning_outside_internships_top.jpg'"/></a> </div> <a href="learning_outside/learning_internships.php" title="link to undergraduate internship FAQ page" alt="link to undergraduate internship FAQ page"><img src="images/learning_outside_internships_bottom.jpg"/></a> EOD; ; } else {echo <<<EOC <div id="learning_outside_top"> <a href="learning_outside/learning_outside_main.php" title="link to hands on learning page" alt="link to hands on learning page"><img src="images/learning_outside_class_based_top.jpg" onmouseenter="this.src='images/learning_outside_class_based_top_mouseover.jpg'" onmouseleave="this.src='images/learning_outside_class_based_top.jpg'"/></a> </div> <a href="learning_outside/class_based.php" title="link to undergraduate hands on learning in classes page" alt="link to undergraduate hands on learning in classes page"><img src="images/learning_outside_class_based_bottom.jpg"/></a> EOC; ; } ?> I am sure that the $slidenum part of this is working correctly because I have echoed that. Even when I insert a line that sets $slidenum = 0; (like in the code above) it still only shows the second image which is created by the echo EOD section of the code. It is probably just something I am missing after staring at this too long but I could really use another set of eyes. Thanks, Kate
  4. Zane, I think that did it. I guess I need to read about classes because I thought you hade to have a div id= statement to get the div to display. I had no idea you could use this sort of syntax echo "<div class='imageClass'>"; //display div named $div to get a div to display . . . It doesn't make much sense to me because I don't see where my named div "$div" is used in this statement I will go read & try to figure it out. Thanks again, Kate
  5. Thanks Zane, As you can probably tell I am sort of new at CSS. I will go & try to implement your suggestions & see if I can get it to work. kate
  6. Hi, I am trying to create a bunch of pics html linked to more info on a page in a grid format. The pic names and link urls come from a mysql db and I use a php code & embedded css (see code below) to dynamically create divs for each pic and display them on the page linked to more info. <div id="systems_visual_library"> <?php //this php code displays all the pics of systems and species and links them to the appropriate content from urls provided in the mysql table titled "systems_list"???? mysql_connect("55555555555","5555555","555555") or die(mysql_error()); // mysql connection to server mysql_select_db("NRM_faculty_profiles") or die(mysql_error()); //use the NRM_faculty_profiles DB //SYSTEM & SPECIES LINK BOXES $data = mysql_query("SELECT * FROM systems_we_study") or die(mysql_error()); //get all the data from systems_list $div_name = "#system_pic_linkbox"; // sets $div_name variable = to "#system_pic_linkbox" while($info = mysql_fetch_array( $data )) //loops through each instance in the array executing commands inside { } for each instance { $count = $info['count']; // loads the # of the picture/link in the table into the variable $count $div = $div_name . $count; // concatenates $div_name & $count so you get "system_pic_linkbox1","system_pic_linkbox2" etc. echo "<style type=\"text/css\"> $div { width: 162px; height: 121px; display: inline; margin-top: 10px; margin-left: 10px; } </style>"; // creates a div names $div $url = $info['url_link'];//loads the url in the url column into $url $jpeg = $info['jpeg_source'];//loads the jpeg source in the jpeg column into $jpeg echo "<div id=\"$div\">"; //display div named $div echo "<a href=\"$url\"><img src=\"$jpeg\" /></a>"; //displays the jpeg image linked to the url inside the div echo "</div>"; } ?> </div> So the mechanics work fine but instead of displaying in a grid the divs are just stacked on top of one another with no margin between at all see what I mean -->(http://cherokee.tosm...ied/systems.php). I sized the container div so they would display 4 across. I also tried "float: left;" but it doesn't change anything. Thanks, Kate
  7. I will see if I can find the setting Dan but after this I doubt I will forget to check. Thanks again, Kate
  8. This DB was created in mysql workbench and it won't let you use any weird characters like "&" or "$" when you name a column. However it does automatically add a "$" to the begining of any column name where the data it contains will be strings. That was the whole problem. I just had to go back and manually delete the "$" at the begining of each column name. Thank you all for you time and patience. Kate P.S. I will fix my spelling ManiacDan.
  9. Pika, I think all mysql strings automatically have a $ at the beginning so what do you mean by rename them??
  10. So as you might be able to tell I am pretty new at this so the pause has been me trying to figure out how to implement "SHOW CREATE TABLE" I ended up using this $showme = mysql_query("SHOW CREATE TABLE youtube_playlists"); echo $showme; It outputs "Resource id #3" Pikachu - I have tried using the $ in my code so it looked like this $data = mysql_query("SELECT * FROM youtube_playlists WHERE $catagory='individual'") or die(mysql_error()); //untested code where selector but I get this error "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '='individual'' at line 1" Also all of the many examples leave off the $. I figured it just designated the mysql datatype as a string. Kate
  11. yes mikosiko the name of the column in the DB is "$catagory" (I will try attaching the image to this post so you can see it)
  12. I just tried subbing in name again & got the same error with this code $data = mysql_query("SELECT * FROM youtube_playlists WHERE name='Dr. Phil Gipson'") or die(mysql_error()); //untested code where selector error reads "Unknown column 'name' in 'where clause'" but when I use the column 'name' in this context the code works fine while($info = mysql_fetch_array( $data )) //loops through each instance in the array executing commands inside { } for each instance { echo "<b>Name:</b> ".$info['$name'] . " <br/>"; $name = $info['name']; //untested code } so is my problem with the whole DB or something????
  13. I do suck at spelling but I just double checked and even if "catagory" is spelled wrong it is spelled wrong both in my DB & in my script. $data = mysql_query("SELECT * FROM youtube_playlists WHERE catagory='individual'") or die(mysql_error()); //untested code where [/code} & of course I can't show you my mysql workbench view since I can't paste in an image but trust me it is "$catagory"
  14. Pikachu2000, I understand what the error message means but I do have a column named catagory in my table. That is why I am confused. I tried using "$catagory" instead of "catagory" but that just gave me a syntax error. I even tried subbing in the "name" column name as a test to see if there was something wrong with the "catagory" column name but I get the same error. It seems weird to me since I use the "name" column later in the script and that works fine??
  15. Hi, I have read a bunch about this error but I can't figure out what I am doing wrong. I am trying to use a where selector to limit data I pull from my mysql database. The code runs fine before I add the where selector but gives me the "Unknown column 'catagory' in 'where clause'" error as soon as I add it in. The code is mysql_select_db("NRM_videos") or die(mysql_error()); //use the NRM_videos DB $data = mysql_query("SELECT * FROM youtube_playlists WHERE catagory='individual'") or die(mysql_error()); //untested code where selector echo "<p><b><u>NRM Faculty</u></b></p>"; while($info = mysql_fetch_array( $data )) //loops through each instance in the array executing commands inside { } for each instance { echo "<b>Name:</b> ".$info['$name'] . " <br/>"; $name = $info['name']; //untested code $url = $info['playlist_url'];//untested code echo "<a href=$url>$name</a>"; // untested code } Usually this error is because someone didn't have required column in their database but I am pretty sure I do. Here is what my DB looks like (hmm . . . I tried to paste in an image of the DB from captured from Mysql workbench but it keeps deleting it in the preview) So I will type it I suppose $name $playlist_url $catagory Dr. Brad Dabbert http://www.youtube.com/playlist?list=PLKzzRdXA6QxWsrTsADIAQBAaazxd1vQAo individual Dr. Phil Gipson http://www.youtube.com/playlist?list=PLKzzRdXA6QxWkCO46zKStmFcoXw__GZd8 individual Dr. Rob Cox http://www.youtube.com/playlist?list=PLKzzRdXA6QxWn2ke9-vicexA_vngeU1z2v individual well that was a pain - anyone know how to display an image without it getting axed?? Anyway I know it looks like I don't even need the where selector because my DB is so simple but I am just trying to get the code to work and have not yet entered all the data in the DB. Thanks for your help, Kate
×
×
  • 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.