Jump to content

Philip

Staff Alumni
  • Posts

    4,665
  • Joined

  • Last visited

  • Days Won

    20

Everything posted by Philip

  1. I think you're going to have to do it with JS/ajax, if you wanted something with little/no refreshing. otherwise, you can do something like: <a href="viewtopic.php?action=edit&id=12345">edit me!</a> <?php $action = $_GET['action']; // clean var switch($action) { case 'edit': //show page with text box and values, and save button break; case 'save': //get vars from $_POST (or $_GET) and save them to the db break; } ?> Just a rough outline
  2. It's missing a period $r['message']"<HR color='#660000'>";
  3. I don't really understand why both of the posters above included a "". at the beginning of the line, it's unneeded. echo $r['message']."<HR color='#660000'>"; That works just fine.
  4. With just one table? uniqueID | catID | subcatID | itemID | title | description | etc... Then some examples: 1 | 1 | 0 | 0 | Attacks | attack thy enemy! | ... (category) 2 | 1 | 1 | 0 | Elemental | an element feature | ... (sub-cat) 3 | 1 | 1 | 1 | Ice Breath | Icy cold | ... (item) 4 | 2 | 0 | 0 | Defense | stand true soldier | ... (category) 5 | 2 | 1 | 0 | Physical | get involved | .. (sub-cat) 6 | 2 | 1 | 1 | Blockage | dont get hit | ... (item) 7 | 2 | 1 | 2 | Duck | miss that swing | ... (item) 8 | 2 | 2 | 0 | Verbal | yell at him | ... (sub-cat) 9 | 2 | 2 | 1 | Intimidate | make him fear | ... (item) There's probably a better way, but that's just a suggestion. edit: I guess it would be better to explain it a little too: You could easily run it to where if(subID == 0), then it's a category, if((subID != 0) && (itemID == 0)) then its a sub category, if(itemID != 0) its an item. Then finding the sub categories for each category would run a query like ("SELECT * FROM `tablename` WHERE `catID`='".$catID."' and `subID`!='0'") etc.
  5. Do you have <? session_start();?> at the top of your page?
  6. I don't know how much about .htacces you know, but here's a shot for ya: Options +FollowSymlinks RewriteEngine on RewriteRule ^?ref=([0-9]+)$ 456.php?refID=$1 [R] That would get them to the 2nd page (redirect file). Did you just want to do it in one swoop to get them to the 456domain.com, or still go through the redirect file?
  7. Try this: In the ajax/js, after the response is received: var newData = request.responseText; var response = newData.split("|||"); // update the div, or do whatever with the strings document.getElementById('1').innerHTML = response[0]; document.getElementById('2').innerHTML = response[1]; ... In the php: <?php ... // where you are echoing the results: $results = $div_data_1 . " |||" . $div_data_2; echo $results; ?>
  8. I found the problem, but it's not in the code you have above (it seems you stripped it out). I ended up just saving your site, with full code to my HDD and played around with it. You have 2 div's with an ID of 'content'. Simply change the 2nd one (the one you want to have updated) to something like 'contentx'. Also don't forget to change the variable in the JS: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <link href="http://www.gamexe.net/layout5/layout.css" rel="stylesheet" type="text/css" /> <link href="http://www.gamexe.net/layout5/favicon.ico" rel="shortcut icon" /> <!--[if lte IE 6]><link rel="stylesheet" type="text/css" media="screen" href="http://www.gamexe.net/layout5/ie.css" /><![endif]--> <script type="text/javascript" src="http://www.gamexe.net/layout5/general.js"></script> <script type="text/javascript" src="http://www.gamexe.net/layout5/prototype.js"></script> <script type="text/javascript"> function init () { var tabs = document.getElementsByClassName('tabs'); for (var i = 0; i < tabs.length; i++) { $(tabs[i].id).onclick = function () { getTabData(this.id); } } } function getTabData(id) { var url = '../smashbros/ssbb_characters_content.php'; var rand = Math.random(9999); var pars = 'id=' + id + '&rand=' + rand; var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoad, onComplete: showResponse} ); } function showLoad () { $('load').style.display = 'block'; } function showResponse (originalRequest) { var newData = originalRequest.responseText; var response = newData.split("|||"); $('load').style.display = 'none'; document.getElementById('contentx').innerHTML = response[0]; document.getElementById('content2').innerHTML = response[1]; } </script> <style type="text/css"> body { font-family:Arial, Helvetica, sans-serif; font-size:12px; } .tabs { width: 50px; margin-right: 10px; padding:4px; cursor: pointer; display: block; } #content { clear:both; } #load { display: none; text-align: center; padding-top: 100px; } </style> </head> <body onload="init()"> <div id="container"> <h1>Characters</h1> <div id="ginfo1"><div id="ginfo2"><div id="ginfo3"> <div id="ginfo_left"> <div class="tabs" id="tab1">Tab 1</div> <div class="tabs" id="tab2">Tab 2</div> <div class="tabs" id="tab3">Tab 3</div> <div class="tabs" id="tab4">Tab 4</div> </div> <div id="ginfo_right"> <div id="load"><img src="http://www.gamexe.net/layout5/loading.gif" alt="Loading..." /></div> <div id="contentx"></div> </div> </div></div></div> <div id="ginfo_b1"><div id="ginfo_b2"><div id="ginfo_b3"> <div id="content2"></div> <br /><br /><br /><br /><br /><br />I'd like $content2 to be echoed right here. The contents of both variables should be dependant on what tab the user has clicked on. </div></div></div> </div> </body> </html> Hope it works
  9. I figured you would, lol, I'm just throwing it out there, so we don't look like we forgot it Hopefully one of our suggestions solved their problem
  10. Not necessarily, .htaccess can be used to clean up URLs, like blah.com/index.php?action=home&user=phil to blah.com/home/phil/ It is possible that it is http://www.blah.com/index.php covered up to only show http://www.blah.com/ .htaccess can do wonders with the mod rewrite
  11. <?php $ref = $_GET['ref']; $url = "http://www.blah.com/?id=".$ref; header("Location: $url"); ?> Is that what you are looking for?
  12. What was the code that you tried? http://www.he.net/faq/tutorials/htaccess/demo.html That's also a good demo on how to use .htaccess's user/password protection
  13. Why not just use a normal form, do you have to use the password prompt?
  14. lol, no problem. there are some things you're going to want to clean up, (example ($info == home) should be ($info == "home"), etc. Keep working on it, and always ask questions
  15. Okay, that's much better. I'll give you a rough outline on what to do: <?php ... $clan_id_var = $_GET['va']; //do some variable cleaning here to protect against attacks $query="select * from `air_".$clan_id_var."`"; $rt=mysql_query($query) or die(mysql_error()); ?> ..Later in the code... <?php if ($info == home){ while($nt=mysql_fetch_array($rt)){ echo $nt['iata']; } } else { echo 'error'; } ?> Hope it helps/works =) noticed a typo, edited this line: echo "$nt['iata']"; to echo $nt['iata'];
  16. Nothing, I was just stating a different way of doing it. I guess I should have put in the word 'also' after "there is" Sorry
  17. <?php ... $dbase = $rt['iata']; echo $dbase; $query="select * from `air_".$dbase."`"; $rt=mysql_query($query); ?> ..Later in the code... <?php if ($info == home){ while($nt=mysql_fetch_array($rt)){ echo "$nt[iata]"; } } else echo 'error'; ?> From the looks of it, you're calling a variable ($dbase = $rt['iata']; ) from something that hasn't happened yet. I'm a little confused on what you are trying to do here. Could you explain your intentions?
  18. replace it with this: while($nt=mysql_fetch_array($rt)){ echo $nt['iata']; } and tell us what it says
  19. I'm pretty sure by this statement, that you're going to need to use $nt['iata'] instead of $rt['iata'] : <?php while($nt=mysql_fetch_array($rt)){ echo "Page info goes here. It gets called from the database"; ?> Because that is saying $rt is the query, and $nt is the array from the query. And where is that code at?
  20. There is: dirname(__FILE__); That shows like /home/user/www/folder1/folder2/ What I did was, even though my PHP files are in a different folder I did: $path = dirname(__FILE__); include $path."/php/admin/head.php"; Hope it helps.
  21. Echo out $dbase first, and if that doesn't work... <?php $dbase = $rt['iata']; echo $dbase; $query="select * from `air_".$dbase."`"; $rt=mysql_query($query); ?> ...it's looking like your variable rt['iata'] doesnt really exist. Are you sure it's not supposed to be $nt? Try this too: <?php $dbase = $nt['iata']; $query="select * from `air_".$dbase."`"; echo $query; $rt=mysql_query($query) or die(mysql_error()); ?>
  22. $dbase = '$rt[iata]'; $query="select * from air_$dbase"; $rt=mysql_query($query); Try: <?php $dbase = $rt['iata']; $query="select * from `air_".$dbase."`"; echo $query; $rt=mysql_query($query); ?> edited to put in php tags
  23. $dbase = '$rt[iata']'; Take a look at where the quotes are, you have 3, so 2 open, 1 close. That would make a problem
  24. Okay, slow down here, let's try to fully explain the problem: Why part is stretching? The tables around the images on the left and right columns, correct? There is an attribute for table height (simply height="XX" - where x = # of pixels), however it really isn't the best option. I would suggest picking up some CSS and trying it out possibly, because even though you've done a lot of work now, it's going to pay off in the long run whenever you want to change something, or add something. I was the same way, always used tables, but once I used CSS once, I never went back. If you're wanting to stick with tables, why not combine the 2 images in the same <td>? (these 2): http://mentalgauge.com/testarea/temp/images/cutmy111_24.gif http://mentalgauge.com/testarea/temp/images/cutmy111_27.gif then have one in between those that does have an auto height, where the background is black.
  25. I'm not really sure on how you are giving the response to AJAX, it seems like you're printing it all into one piece of text. The problem I see with that is js won't be able to tell what goes into the content box, and the secondary content box. My way wasn't the best, but it works (until you get really big amounts of text) and I'm going to change it to apply to your setting: Setup the response so it becomes: (in the ssbb_characters_content.php file) <? ... $request_text = $content . "|||" . $content2; print $request_text; usleep(900000); ?> (in the ssbb_characters.php file) ... function showResponse (originalRequest) { var newData = originalRequest.responseText; var response = newData.split("|||"); $('load').style.display = 'none'; document.getElementById('content').innerHTML = response[0]; document.getElementById('content2').innerHTML = response[1]; } ... That will show the content inside the div ID'd content, not after the < br /> (same with content2) <div id="content"></div> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br />I'd like $content to be echoed right here.
×
×
  • 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.