Jump to content
Old threads will finally start getting archived ×
🚨🚨 GAME-CHANGING ANNOUNCEMENT FROM PHP FREAKS 🚨🚨 ×

Mistral 🤖

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Mistral 🤖's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Okay. Never mind. This is embarrassing. I must have been really blurry eyed earlier after working on this for so long. I found a typo in one of the connection parameters. It's working fine now. Should have waited 10 minutes longer before posting my question! LOL.
  2. I don't know if this is a hosting issue (with bluehost) or not. I checked the phpinfo and they're running php 5.2.16 on the server I'm on. And as far as I can tell, mysqli should be running fine. I have a few pages I'm running locally on my development machine and all runs well. But on the host's server I'm getting a connection failure error. I know my connect function is being run because when echo the $dbname and the other 3 parameters they show up on the page. Here's my connect function: function getDBLink() { include('/home1/mysite/private/config.php'); $link = mysqli_connect($dblocation, $dbuser, $dbpass, $dbname); /* check connection */ if (mysqli_connect_errno()) { printf("Connection failed: %s\n", mysqli_connect_error()); exit(); } return $link; } I've spent hours rechecking the spelling on all the params to be sure of no typos. If I change mysqli_connect to mysql_connect, it does connect (but all the subsequent code using mysqli to query the tables fails). So it's a mysqli issue I'm thinking. I don't really want to change everything to mysql from mysqli if I don't have to. This should work. Any ideas why I'd be having this problem? I'm not an expert at any of this. Hoping someone out there that is might see something I'm not seeing.
  3. Cool. Thanks. That did it. I thought I tried that but maybe not. I think i figured the #companydetail would goof things up in the php code. Guess not. Thanks again.
  4. Okay, no idea if this is going to work or not. I have a set up a footer php file with some hrefs to some generic pages (like "contact us", "about us", "faq"). Each link in the footer looks like this: <a href="genericpage.php?genpage=contactus">Contact Us</a> Then I have several small php files that only have the content for each genpage query string. These are very simple files. Just some very basic HTML like this: Please call 555-1212 to contact us<br /><br /> Our email address is <a href="mailto:[email protected]">[email protected]</a> The above 2 lines are in a file called contactus.php. That's all that's in there. genericpage.php is the following: <?php if (!isset($_GET['genpage']) || $_GET['genpage'] == '') { header ('location: index.php'); exit; } else { if ($genpage == 'faq') { $pageheader = "Frequently Asked Questions"; $pagecontent = 'genpage-faq.php'; } else if ($genpage == 'aboutus') { $pageheader = "About Us"; $pagecontent = 'genpage-aboutus.php'; } else if ($genpage == 'contactus') { $pageheader = "Contact Us"; $pagecontent = 'genpage-contactus.php'; } else if ($genpage == 'privacypol') { $pageheader = "Privacy Policy"; $pagecontent = 'genpage-privacypol.php'; } else if ($genpage == 'copyrightnotice') { $pageheader = "Copyright Notice"; $pagecontent = 'genpage-copyrightnotice.php'; } else if ($genpage == 'companydetail') { $pageheader = "About Us"; $pagecontent = 'genpage-aboutus.php'; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php echo $pageheader; ?></title> </head> <body> <div id="wrapper"> <?php include('header.php'); ?> <table style="background-image:url(images/header-bottom.gif); background-repeat:no-repeat; background-position:center; height:53px; width:1000px;" > <tr> <td valign="bottom" align="center"> <p style="font-size:18px; font-weight:bold; margin:0; padding:0 70px 5px 0"><?php echo $pageheader; ?></p> </td> </tr> </table> <table width="1000px" style="height:320px;"> <tr style="background-image:url(images/green-edges.gif); background-repeat:repeat-y; "> <td style="padding:10px 0 0 40px"> <?php include($pagecontent); ?> </td> </tr> </table> <?php include('footer.php'); ?> </div> </body> </html> So as you can see from the above, depending on the link the user clicks in the footer, $pageheader and $pagecontent are being set when the page loads. All this works just fine. No problems. However, I have one link in the footer that needs to go to a specific section of the about us page. The about us page has a <a name="companydetail"> anchor in it. So what I want to have happen is when the user clicks the <a href="genericpage.php?genpage=companydetail">Company Detail</a> link in the footer, I want genericpage.php to load with include for aboutus.php but jump directly to the companydetail anchor on that page. Not sure if this is possible and I'm going nuts trying to figure it out. All this could lead to storing the content sections in a database as opposed to separate php pages (the part that goes here: <?php include($pagecontent); ?>). Not sure if that matters or not. Hope someone can help. Thanks.
×
×
  • 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.