Jump to content

alfman05302001

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

alfman05302001's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. What code would you need, the whole page of code that segment is taken from?  Each of the methods you sugested requiered some modification to the php if a new position is added, unless I am interperating the code wrong. 
  2. So have this code [code] $chiefquery = "SELECT * FROM oalodge_plst1.officer_contact WHERE Position='Chief' "; $result = mysql_query($chiefquery) or die("Internal Error: " . mysql_error()); $chief = mysql_fetch_assoc($result); $chiefemail = $chief["Email"]; $chiefFirst = $chief["FirstName"]; $chiefLast = $chief["LastName"]; $VCPquery = "SELECT * FROM oalodge_plst1.officer_contact WHERE Position='VCP' "; $result = mysql_query($VCPquery) or die("Internal Error: " . mysql_error()); $VCP = mysql_fetch_assoc($result); $VCPemail = $VCP["Email"]; $VCPFirst = $VCP["FirstName"]; $VCPLast = $VCP["LastName"]; [/code] ect. ect. ect. And this code repeats for each position where in general its $(position)query $(position)email ect.  I was hoping to condense this code into a loop without changing the variables since every single page on my website links to them.  The main reason I want to put the effort into creating the loop is this page I am also working on http://oalodge43.org/cont-test.php where the last line of the table allows you to create a new position.  I am not even sure if what I want to do is possible (although it seems like something that would be somewhat common), or even what would be good keywords to google.  I am not opposed to doing research on my own, but I am just not sure where to even begin with this one.  Thanks for your help Jonathan
  3. [!--quoteo(post=373659:date=May 14 2006, 01:06 AM:name=_will)--][div class=\'quotetop\']QUOTE(_will @ May 14 2006, 01:06 AM) [snapback]373659[/snapback][/div][div class=\'quotemain\'][!--quotec--] instead of trying include('this' OR 'that') (which won't work...), somthing as simple as [code] if ($bIsTopLevel) {    include('config.inc.php'); } else {    include('../config.inc.php'); } [/code] Another alternative would be to move all your pages to the second level of your web root, and just have an index.php in the top level. All of the files that you had originally in the top level could be moved to /main or /static. In the index you put [code] header('Location: main/index.php'); [/code] When a user accesses your site they will get forwarded automatically to your sublevel, and you don't have to worry about the headache of finding the right path based on which page the user is viewing, because they are always ../ from the web root. [/quote] The second option I would require me to redo all the linking for my pages as they were not relative (for some strange reason when I coded the site I used the full url). The first option would work, but I would need to use it on a second page too as the first include statement has a page that has its own include statement (the db connection info) but the code should be the same I think for both pages (is that correct?). The one peice that confuses me is how the variable is defined? Thanks for your help and fast reply Jonathan
  4. Ok so I am sure this is a fairly simple problem, but I am not quite sure how to go about fixing it. I am using an include statement on my website and it works in every page except the top index page. The problem is the way I am linking to the file. I am wrting my includes as include(..//directory/file.php). As I stated this works everywhere except the top level. I need to know if there is a way to write it so it can work on both top level and sub level files. Website is [a href=\"http://www.oalodge43.org\" target=\"_blank\"]www.oalodge43.org[/a] The site originaly started as a static html site (hence the .html extentions (php is processing it as a php file)) made from a Dreamweaver template that every page on the website is tied to. Is there a way to do something like this "include('this' OR 'that'); that will not produce erros or warnings Thanks for your help Jonathan
  5. I did some searching around on the web, but could not find any examples where an existing PDF was being edited with text that was being inputed via a form? I plan on continuing to look, but if anyone knows anything it would help. Thanks Jonathan
  6. So I am reasonably new to PHP, but am finding it an amazing tool that can really make websites useful. I have been browsing the web and have seen that it is possible to generate a PDF from PHP, but is it possible to edit one. I would like to do the following (if it is even possible): Take an existing registration type document and via a form be able to insert information such as Name, Address, Date of Birth, ect. I would like that information then inserted into both the document (where it can be printed) and a MySQL table for latter use. Once the PDF is generated i would also use the mail() function then to email out a copy of the form to the people who need record of it. Like I said I do not even know if this is posible (or if there is a better way to do this), but any information about this would be really helpful. Thanks Jonathan
  7. So the initial part of my script is still the same (where I define the variables for the require statement), but my script has changed to the following: <?php require ("http://wwww.oalodge.org/mysql_test/dbConfig/db_config.php"); //require ("$_SERVER["DOCUMENT_ROOT"]."/dbConfig/db_config.php""); $dbh = mysql_connect ($db_server, $db_user, $db_password) or die ('I cannot connect to the database because: ' . mysql_error()); //mysql_select_db ("oalodge_plst1"); ?> I am now reciving the following errors: Warning: main() [function.main]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/oalodge/public_html/mysql_test/connection.php on line 3 Warning: main(http://wwww.oalodge.org/mysql_test/dbConfig/db_config.php) [function.main]: failed to open stream: Success in /home/oalodge/public_html/mysql_test/connection.php on line 3 Fatal error: main() [function.require]: Failed opening required 'http://wwww.oalodge.org/mysql_test/dbConfig/db_config.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/oalodge/public_html/mysql_test/connection.php on line 3 What is .:/usr/lib/php:/usr/local/lib/php ?
  8. I am trying to connect to a MySQL db using an include statement to help secure the connection. My connection variables are as follows: <?php $db_server = "localhost"; $database = "oalodge_plst1"; $db_table = "user"; $db_user = "oalodge_dbUser"; $db_password = "**********"; ?> And my connection statement looks like: <?php require ("/mysql_test/dbConfig/db_config.php") //require ("$_SERVER["DOCUMENT_ROOT"]."/dbConfig/db_config.php"); $dbh = mysql_connect ($db_server, $db_user, $db_password) or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("oalodge_plst1"); ?> But it will not let me connect The error is as follows: Parse error: parse error, unexpected T_VARIABLE in /home/oalodge/public_html/mysql_test/connection.php on line 6
×
×
  • 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.