Jump to content

xangelo

Members
  • Posts

    102
  • Joined

  • Last visited

    Never

Everything posted by xangelo

  1. Actually what I think you're talking about is adding the attribute "wrap" with the value "hard". <textarea wrap="hard"></textarea>
  2. I think your one line solution may confuse them just a bit
  3. It works, but you don't need to open and close the tags that many times. Also, I would include a catch-all. A final else statement that will display whatever you want incase the argument doesn't match: <?php if($_GET['page_id'] == 2) { include("decor_leftnav.php"); } else if($_GET['page_id'] == 3) { include("maintest.php"); } else { include("404.php"); } ?>
  4. With regard to your final question about changing the URL. Essentially you are talking about redirecting the user. You have a couple of options in that department. You could either go with php's header() or meta refresh Header would be for immediate redirects, whereas meta refresh could work if you needed to display some sort of message to the user.
  5. Basically in HTML, the <tr> tag designates a new row. Therefore, the logic behind generating two columns would simply be to create a simple counter. Increment the counter every time you look through your array. Then it would just be a matter of dividing the counter by the number of columns that you want (hint:modulus). If the number is divisible (returns a remained of zero) then you can close the <tr> tag and open a new one to designate the next row. If you need further help, I can always put up some code, but I thought it would be best to have an understanding of how it works.
  6. Nothings really going on with the file paths. You just have to realize that when it gets included into another file, the relative paths are no longer the same, since the file has moved.
  7. While the code works, if your database grows to be too large, you'll end up trying to do too much. As jonsjava said, first all you need is a count of the results. $q = mysql_query('select count(*) from table_name'); Do all the grunt work in PHP (IE, figure out what page your on, which results you'll have to display, create the sql statement with limits. Figure out how many pages you'll need, which ones you want to display etc). Then just run the query that you create from all that grunt work. That way you'll have only the results that pertain to that particular page.
  8. Maybe I'm a bit confused, but you're asking how to assign an array to a variable? You've got it right, you can just get rid of the [$a] part so that it reads: $a = $apples[3];
  9. Quite right MrAdam. Infact, I'd say that using javascript primarily as ways of doing validation, you're site would be more vulnerable. Since JS is run clientside (in the browser), anyone can access the script and see how it runs. You should never place sensitive information in Javascript.
  10. The problem with javascript, is that when you first learn how to use it, you go overboard with it. But perhaps that is just a learning process. As you use it more and more, you'll begin to see it's place in things. For example, JS is a great way to do some quick form validation. Checking if all fields are filled out, making sure that fields are filled with the right values and immediately displaying any errors. Another example, is like the one posted above, while viewing some content, javascript can quietly send some information off to the database and update your content without reloading the page. The biggest thing is knowing that most times, javascript is not a requirement, it is an add-on.
  11. Are you receiving an error of any kind? Or is it just not outputting anything? You can try modifying all your mysql_query statements to look like this: mysql_query('your statment') or die(mysql_error()) And if it outputs an error, just let us know what the error is.
  12. The error you are receiving seems to occur because of the way you are performing the concatenation. echo "<li> . "<a href=" . $row["category"] . "> something here..., maybe $row['category"] again... </a></li>"; You only need to do the concatenation when you are trying to insert bits of php. So </a>"."</li> is complete unnecessary. However, like IchBin said, it's easier to to separate which quotes you use. Keep single quotes to php and double quotes to html.
  13. Actually guys, it sounds like he wants them dynamically generated.
  14. You would have to first run a select statement to get the increase amount from the system. After that you would then run the query again. Since I don't really know your schema, here's just some pseudo-code $query = mysql_query('SELECT playerid,updateAmnt from players'); if($query) { while($r = mysql_fetch_array($query)) { $update = 'UPDATE players SET money = (money)+'.$r['updateAmnt'].' WHERE playerid = '.r['playerid']; mysql_query($update); } }
  15. Basically what happen is exactly as the error message described. Generally you need to put the header value at the very top of the script, but since you have some processing, we can get around this constraint if you do the following: 1. At the top if your script add this: ob_start(); Make sure that it is on the top most line in your page, it should come right after the opening php tag. All other code should be below it. 2.At the very end, after all your code add this: ob_flush(); It's called output buffering
  16. Not sure but would the colname_rs_results actually be colname2_rs_results? If so, your script would be slightly modified to the following: $result = mysql_query("SELECT * FROM ff_villas WHERE v_sleeps = $colname_rs_Results AND v_country = $colname2_rs_Results"); If not, what is the exact error that you are getting?
  17. Not a problem, glad to be of some help.
  18. Sorry about that cchhita.. I meant to put down $parsedUrl, but I was just a little distracted at the time I suppose. You're on the right way to adding more variables, but you need to alter it ever so slightly: <?php $sZipCode = $_POST['zip']; $sCity = $_POST['city']; $sState = $_POST['state']; $url = $_POST['url']; $parsedUrl = $url.'?zip='.$sZipCode.'&city='.$sCity.'&state='.$sState; header("Location: $parsedUrl"); ?> That should work fine for you. Only one questionmark should appear in the url, adding more variables means they are separated by an ampersand (&).
  19. Are you're sure id2 has a value? would you mind echoing $id AFTER setting $id = $_POST['id2']?
  20. Personally, I don't see the point in doing it for a small website. Granted, if there IS the chance that you'll be expanding, why not take the extra precautions and make sure you can do so easily. But if you go through all the planning, and then see that it's still going to be something small and simple, why spend the extra effort doing things that you won't benefit from.
  21. If both variables are being set properly (and you're sure of this) don't add quotation marks around the id value. Quotations are for strings, integers don't require them. $sql="UPDATE general SET image='$consname2' WHERE id=$id"; If both are being set, that should be your sql statement.
  22. Perhaps application was the wrong word to use, but I don't feel that OOP has it's place every time. For example, a simple website wouldn't need to utilize OOP principles, but one that needed such things as a user-management system and news system would be best done in OOP.
  23. echo 'consname2: '.$consname2.'<br>'; echo 'id: '.$id.'<br>'; $sql='UPDATE general SET image="'.$consname2.'" WHERE id= '.$id; echo $sql; From what it looks like, one of the values aren't being passed properly. What is the output of the above section of code I included?
  24. OOP doesn't have it's place in every application. A big part of learning OOP is deciding when it makes sense to use it. I personally would keep the MySQL class separate. That way, all your scripts could have access to it, and as an added bonus, you would be able to easily extend your current script, or even move the database class to other applications.
  25. Hmm.. are you sure the variables are being passed with the correct values?
×
×
  • 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.