Jump to content

webguync

Members
  • Posts

    951
  • Joined

  • Last visited

Everything posted by webguync

  1. I tried this: <?php $currentPage = basename($_SERVER['SCRIPT_NAME']);?> <ul id="top_menu"> <li><a href="../index.php"<?php if($_SERVER['REQUEST_URI'] == 'index.php'){echo 'id="active"';} ?>> Home</a></li> <li><a href="../About_Us/index.php"<?php if ($_SERVER['REQUEST_URI'] == 'About_Us/index.php') {echo 'id="active"';} ?>>About Us</a></li> <li><a href="../Online_Sermons/index.php"<?php if ($_SERVER['REQUEST_URI'] == '../Online_Sermons/index.php') {echo 'id="active"';} ?>>Online Sermons and Video</a></li> <li><a href="../Itinerary/index.php"<?php if ($_SERVER['REQUEST_URI'] == '../Itinerary/index.php') {echo 'id="active"';} ?>>Itinerary</a></li> <li ><a href="../Request_Visit/index.php"<?php if ($_SERVER['REQUEST_URI'] == '../Request_Visit/index.php') {echo 'id="active"';} ?>>Request a Visit to Your City</a></li> <li><a href="../Links/index.php"<?php if ($_SERVER['REQUEST_URI'] == '../Links/index.php') {echo 'id="active"';} ?>>Links</a></li> <li><a href="../Contact_Us/index.php"<?php if ($_SERVER['REQUEST_URI'] == '../Contact_Us/index.php') {echo 'id="active"';} ?>>Contact Us</a></li> </ul> but it doesn't give me the id="active" that I need to set the you are on this page css See anything that might be wrong?
  2. I am using CSS to indicate which page you are on and PHP to use this menu as an include while still being able to determine the 'you_are_here" CSS. work great on the home page http://www.warriorsarise.org/index.php you will see that the indicator is that you are on the home page however, when you go here: http://www.warriorsarise.org/About_Us/index.php you will see that the menu indicates that you are still on the home page. This is what I am having an issue with. I know why it is doing this. It is because my directory is set up as Contact_Us/index.php, Itinerary/index.php etc. how do i alter my code, so that it picks up the right pages? my PHP as it is now <?php $currentPage = basename($_SERVER['SCRIPT_NAME']);?> <ul id="top_menu"> <li><a href="../index.php"<?php if ($currentPage == 'index.php'){echo 'id="active"';} ?>> Home</a></li> <li><a href="../About_Us/index.php"<?php if ($currentPage == '../About_Us/index.php') {echo 'id="active"';} ?>>About Us</a></li> <li><a href="../OnlineSermons/index.php"<?php if ($currentPage == '../OnlineSermons/index.php') {echo 'id="active"';} ?>>Online Sermons and Video</a></li> <li><a href="../Itinerary/index.php"<?php if ($currentPage == '../Itinerary/index.php') {echo 'id="active"';} ?>>Itinerary</a></li> <li ><a href="../Request_Visit/index.php"<?php if ($currentPage == '../Request_Visit/index.php') {echo 'id="active"';} ?>>Request a Visit to Your City</a></li> <li><a href="../Links/index.php"<?php if ($currentPage == '../Links/index.php') {echo 'id="active"';} ?>>Links</a></li> <li><a href="../Contact_Us/index.php"<?php if ($currentPage == '../Contact_Us/index.php') {echo 'id="active"';} ?>>Contact Us</a></li> </ul>
  3. that resolved it thanks. I have another issue, but I will repost under another topic.
  4. sure the page file would be in About_Us/index.php and the include file would be in includes/meta_tags.inc both sit inside of a directory www actual paths to the files in question are: http://www.warriorsarise.org/About_Us/index.php and http://www.warriorsarise.org/includes/meta_tags.inc I have taken the includes out temporarily so an error is not currently thrown
  5. grrrrr, I am still getting errors. Warning: main(/home/warriors/public_html/About_Us/includes/meta_tags.inc) [function.main]: failed to open stream: No such file or directory in /home/warriors/public_html/About_Us/index.php on line 6 Fatal error: main() [function.require]: Failed opening required '/home/warriors/public_html/About_Us/includes/meta_tags.inc' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/warriors/public_html/About_Us/index.php on line 6 I used <?php require_once dirname(__FILE__)."includes/meta_tags.inc";?> and also tried with a / in front of includes
  6. yes, I am sure the extension is .inc. I also tried taking out the initial /. I will try using require_once dirname(__FILE__)."/includes/meta_tags.inc"; I won't be able to get to it again this evening. I believe that the file with the include and the include itself would be at the same level since they are both one level into directories. eg: www.urlforwebsite/about_us/index.php www.urlforwebsite/includes/meta_tags.inc
  7. Hello, I have file within a directory on the server, for instance index.php inside of a directory called 'About_Us', and I also have includes within a directory called 'includes'. I am trying to reference the include 'meta_tags.inc' as such: <?php require('/includes/meta_tags.inc'); ?> but I continually get a warning and fatal error. No such file or directory. I double checked and all of the necessary files are on the server and everything is being named correctly. I also tried adding ../ and /../ in front of the path and nothing has worked. I believe that this is a problem with the path to the file, but is seems like it would be the correct path. Any suggestions/help would be appreciated.
  8. thanks, I am just now getting to this. I probably will have some questions once I look this over and will post them. thanks again!
  9. sorry to be vague in my original post. Yes, I am referring to storing images as binary via a BLOB field
  10. Can someone point me in the right direction as to display an image in PHP that is being stored in MySQL? Basically I know how to store the image in MySQL, but getting it to display on a web page is what I am having trouble with. Any assistance is appreciated!
  11. to elaborate on this, what I am trying to do, is create dynamically in the HTML using PHP <li><a id="current" href="what-we-do.php" title="What We Do">What we do</a></li> and then the CSS will do the rest, creating the "you are on this page" indicator. This needs to be done dynamically so that I can use the menu code as an include, and not have to hard code on every page.
  12. I want to use CSS to indicate that a user is on a certain page, while also using a menu as an include, and I was able to get this working once, but now it does not want to. the code for the menu I have: <?php $footer = <<< MENU <ul> <li><a href="what-we-do.php" title="What We Do">What we do</a></li> <li><a href="news-events.php" title="News & Events">News & Events</a></li> <li><a href="affiliates-programs.php" title="Affiliates & Programs">Affiliates & Programs</a></li> <li><a href="people.php" title="People">People</a></li> <li><a href="facilities.php" title="Facilities">Facilities</a></li> <li><a href="tech-resources.php" title="Technology & Resources">Technology & Resources</a></li> <li><a href="site-map.php" title="web site map">Web Site Map</a></li> <li><a href="copyright-disclaimer.php" title="Copyright & Displaimer">Copyright & Disclaimer</a></li> <li class="last"><a href="privacy-policy.php" title="Privacy Policy">Privacy Policy</a></li> </ul> MENU; $lines = split("\n", $footer); foreach ($lines as $line) { $current = false; preg_match('/href="([^"]+)"/', $line, $url); if (substr($_SERVER["REQUEST_URI"], 0, 5) == substr($url[1], 0, 5)) { $line = str_replace('<a h', '<a id="current" h', $line); } echo $line."\n"; } ?> and in the CSS I have a#current set to a particular color. This worked previously, but now it does not. the current state doesn't appear in the html. Any ideas why?
  13. thanks simcoweb using: if ( $importance == 1 ) { was indeed the right solution
  14. yes, the ID's are Unique and I only want one display per page maybe displaying the entire code on the page will help <?php if (!$_GET[id]) { header ( "Location: http://www.mywebsite.com"); } else { session_start(); } if ($_SESSION[valid] !="yes") { header ("Location: http://www.mywebsite.com"); exit; } //check for validity of user $db_name="my_DB"; $table_name ="myTable"; $connection = @mysql_connect("localhost", "username", "password") or die (mysql_error()); $db = @mysql_select_db($db_name, $connection) or die (mysql_error()); $chk_id = "SELECT id FROM $table_name WHERE id ='$_GET[id]' "; $chk_id_res = @mysql_query($chk_id, $connection) or die(mysql_error()); $chk_id_num = mysql_num_rows($chk_id_res); if ($chk_id_num !=1) { header ("header://www.mywebpage/login.php"); exit; } else { $sql = "SELECT f_name, l_name,title, address1, city, prim_tel, email, URL, last_updated, company, importance, notes FROM $table_name WHERE id = '$_GET[id]' "; $result = @mysql_query($sql, $connection) or die (mysql_error()); $img= "<img src='images/airplane.gif' width='25' height='25' alt='Airplane'>"; while ($row = mysql_fetch_array($result)) { $f_name=$row[0]; $l_name=$row[1]; $title=$row[2]; $address1=$row[3]; $city=$row[4]; $prim_tel=$row[5]; $email=$row[6]; $URL=$row[7]; $last_updated=$row[8]; $company=$row[9]; $importance=$row[10]; $notes=$row[11]; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US" dir="ltr"> <head> <meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1" /> <title>Contact Database</title> </head> <body> <!-- begin outer wrapper div --> <div id="wrapper_outer"> <!-- begin header div --> <!-- top nav list --> <h2>Contact details for <? echo "$f_name $l_name who works for <span class=\"company\">$company"; ?></span></h2> <table id="recruiter_list" cellspacing="0"> <tr> <th colspan="3" align="center">CONTACT INFORMATION</th> </tr> <tr> <? if ( $row['importance'] == 1 ) { echo "<td colspan='3'>".$img."</td>"; } else { echo "<td colspan='3'>Not so Important</td>"; } ?> </tr> <td> <? echo "$f_name $l_name"; ?>,<br /><h2><? echo "$company $importance" ?></h2></td> <td><strong>Title</strong><br /><? echo "<em> $title </em>"; ?></td> <td><strong>Address</strong><br /><? echo "$address1"; ?></td> </tr> <tr> <td><strong>Location</strong><br /><? echo "$city"; ?></td> <td><strong>Telephone:</strong><br /><? echo "$prim_tel"; ?></td> <td ><strong>e-mail:</strong><br /> <? echo "<a href=\"mailto:$email\" class=\"recruiter\">$email</a>"; ?></td> </tr> <tr id='trX'><td colspan='3'><a href='#' onClick="FuncShowHide()"> Display URL</td> </tr> <tr id='hideShow' style='display:none'> <td colspan="3" ><strong>URL:</strong><br /> <? echo "<a href=\"http://$URL\" class=\"recruiter\">$URL</a>"; ?></td> <tr> <td colspan="3" align=\"center"\> <strong>Notes</strong><br /> <? echo "$notes"; ?> </td> </tr> <tr> <td colspan="3">Last Update: <?php echo "$last_updated" ;?> </td> </tr> <tr> <td colspan="3" align="center"> <p><a href="Recruiters.php">Return to main menu</a></p></td> </tr> </table> <?php //close the db mysql_close(); ?> <div id="clear_float" <?php require('includes/footer_tag.php') ; ?> <?php require('includes/redirect.php'); ?> </div> </div> <!-- begin footer --> </div> </div> </body> </html>
  15. well basically I have a table which displays the results from the query: $sql = "SELECT f_name, l_name,title, address1, city, prim_tel, email, URL, last_updated, company, importance, notes FROM $table_name WHERE id = '$_GET[id]' "; and I don't want to filter those results to just display the ones with importance=1, I just want the records that meet that criteria to display an image in a td cell, and those that do not, to not display anything. so when I add AND importance='1' to the above query that gives me blank results for most of the records, which I don't want. I do want to meet this condition, however, and the if is still not working, so 'Not so Important' is always displaying even when the result of importance is equal to 1 ... <? if ( $row['importance'] == 1 ) { echo "<td colspan='3'>".$img."</td>"; } else { echo "<td colspan='3'>Not so Important</td>"; } ?>
  16. $sql = "SELECT f_name, l_name,title, address1, city, prim_tel, email, URL, last_updated, company, importance, notes FROM $table_name WHERE id = '$_GET[id]' "; $result = @mysql_query($sql, $connection) or die (mysql_error()); $img= "<img src='images/Recruiter.gif' width='25' height='25' alt='Recruiter'>"; while ($row = mysql_fetch_array($result)) { I don't have a query specifically set up for that field [importance] do I need to do a separate query for this?
  17. it's not displaying anything...but in MySQL there is a row named "importance" that does have entries with values of 1, so I guess I am missing something somewhere else?
  18. the limiting of records is working, but I am still not getting the Next and Previous records to work. The end result I would like is to display 25 records on a page, and then have a link, to the next 25, and backo the previous page (if there is one). Here is my current code <?php //start a session session_start(); //check for validity of user $db_name="people"; $table_name ="Listing"; $connection = @mysql_connect("localhost", "username", "password") or die (mysql_error()); $db = @mysql_select_db($db_name, $connection) or die (mysql_error()); $limit = 25; // Sets how many results shown per page $query_count = "SELECT count(*) FROM $table_name"; // Sets what we want to pull from the database $result_count = mysql_query($query_count); // Pulls what we want from the database $totalrows = mysql_num_rows($result_count); // This counts the number of users if(empty($page)){ // Checks if the $page variable is empty (not set) $page = 1; // If it is empty, we're on page 1 } $limitvalue = $page * $limit - ($limit); // Ex: (2 * 25) - 25 = 25 <- data starts at 25 //build and issue query $sql ="SELECT id, f_name, l_name, company FROM $table_name ORDER BY company LIMIT $limitvalue, $limit"; $result = @mysql_query($sql, $connection) or die(mysql_error()); $limit = 25; $query_count = "SELECT count(*) FROM $table_name"; $result_count = mysql_query($query_count); $totalrows = mysql_num_rows($result_count); if(empty($page)){ $page = 1; } $limitvalue = $page * $limit - ($limit); if(mysql_num_rows($result) == 0){ echo("Nothing to Display!"); } //create list block of results $contact_list="<ul class='vertical_list'>"; while ($row = mysql_fetch_array($result)) { $id = $row['0']; $f_name=$row['1']; $l_name=$row['2']; $company=$row['3']; $contact_list .="<li> <a href=\"show_contact.php?id=$id\">$company,$l_name, $f_name, </a>"; } $contact_list .="</li></ul>"; ?> <html> <head> <title>MySQL Results Display</title> </head> <body> <p>Select a contact from the list below, to view a contact's record</p> <? echo "$contact_list"; ?> <?php if(!isset($_GET['page'])){ $page = 1; } else { $page = $_GET['page']; } $numofpages = $totalrows / $limit; for($i = 1; $i <= $numofpages; $i++){ if($i == $page){ echo($i." "); }else{ echo("<a href=\"$PHP_SELF?page=$i\">$i</a> "); } } if(($totalrows % $limit) != 0){ if($i == $page){ echo($i." "); }else{ echo("<a href=\"$PHP_SELF?page=$i\">$i</a> "); } } if(($totalrows - ($limit * $page)) > 0){ $pagenext = $page++; echo("<a href=\"$PHP_SELF?page=$pagenext\">NEXT".$limit."</a>"); }else{ echo("NEXT".$limit); } mysql_free_result($result); ?> <p><a href="Recruiters.php"> Return to main menu</a></p> </body> </html>
  19. thanks, that worked as intended one more question, I want to do the same thing (more or less), but I want to display 1980-2007 with 2007 being at the top and 1980 at the bottom. I know it would be quite similar, but need some assistance thanks gain
  20. Hello I need to create an HTML select tag and add the days of the month from 1-31. <select> <option value ="1">1</option> <option value ="2">2</option> <option value ="3">3</option> <option value ="4">4</option> </select> etc... like that except I wanted to use php to programitically create the 1-31 instead of adding each option, and I need help with that part. If someone could point me in the right direction, I would greatly appreciate it.
  21. there is currently no $_GET['page'] nor was that in the tutorial. I guess you are saying I need to add that? I pretty much took the code from the tutorial without fully understanding all of it
  22. From the tutorial on pagination from this site I have the following code, but don't get links only text. What do I have wrong? <?php if($page != 1){ $pageprev = $page--; echo("<a href=\"$PHP_SELF&page=$pageprev\">PREV".$limit."</a> "); }else{ echo("PREV".$limit." "); } $numofpages = $totalrows / $limit; for($i = 1; $i <= $numofpages; $i++){ if($i == $page){ echo($i." "); }else{ echo("<a href=\"$PHP_SELF?page=$i\">$i</a> "); } } if(($totalrows % $limit) != 0){ if($i == $page){ echo($i." "); }else{ echo("<a href=\"$PHP_SELF?page=$i\">$i</a> "); } } if(($totalrows - ($limit * $page)) > 0){ $pagenext = $page++; echo("<a href=\"$PHP_SELF?page=$pagenext\">NEXT".$limit."</a>"); }else{ echo("NEXT".$limit); } mysql_free_result($result); ?> this produced PREV25 1 NEXT25 without links
  23. <tr> <? if ( $row['importance'] == 1 ) { echo "<td colspan='3'>".$img."</td>"; } else { echo "<td colspan='3'>not so important.</td>"; } ?> </tr> also, I have image set as : $img= "<img src='images/mymage.gif' width='25' height='25' alt='myimage'>"; the field in MySQL is named 'importance' and some of the values in that field = 1. That is when I want the image to display. <? if ( $row[10] == 1 ) { echo "<td colspan='3'>".$img."</td>"; } else { echo "<td colspan='3'>not so important.</td>"; } ?> since 10 is the array association order
×
×
  • 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.