Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. This is not a php question at this point... it's become a css question. You didn't do what I instructed. <br /> td {color: red; }<br /> Is not creating a style class, it's saying "make all elements red. <br /> .red {<br /> color: red;<br /> }<br />
  2. Here is your code if it was indented in a reasonable manner: if (isset($_POST['submitUpdate'])) { if (get_magic_quotes_gpc()) { $_POST = array_map('stripslashes',$_POST); } $fc = file_get_contents($_POST['file']); // truncate file $fw = fopen($_POST['file'], 'w+'); $text = explode("",$fc); $newText = $text[0]."".htmlentities($_POST['content'])."
  3. Mike, There is not much more to it than providing the write, host, user, password and database.
  4. This made me curious, so I checked this page: http://www.minecraftwiki.net/wiki/Skin So at very least it seems that the skin file has to be 64x32, so that could be one issue, but from there, since they are rendering the skin to a flash movie, it's probably safe to assume that they are looking at the internals of the file. If you're just experimenting with trying to fool it, try a 64x32 png file and see if it will accept it and process it into something.
  5. This is unrelated to php. If it's not an entirely different host that you need to specify, then the username of 'root' is a likely culprit, as you would probably not be connecting to mysql as the root user, but rather a user which has been given rights to whatever database has been configured on your host. Often this is handled through some type of web interface and they usually have instructions there for what the strings need to be in the same location that lets you create databases and users.
  6. I wrote an article about a very similar subject: http://www.gizmola.com/blog/archives/99-Finding-Next-Monday-using-MySQL-Dates.html
  7. The key to figuring this out is: http://us.php.net/manual/en/function.imageftbbox.php There are some notes on the manual page you may find helpful.
  8. Where you have ereg_replace, you change that to preg_replace(). Also your regex's need to have a delimitter around the regex. Usually people use the forward slash. '/[^A-z0-9]/i' This is all stuff that you can read about in the manual. If you have a more specific question people might be able to help.
  9. Yeah pretty much. You can pass your api key as a url parameter: http://service.domain.top/bands.php?apikey=xxxxxx In the question of xml vs json, from an efficiency standpoint you are better off using json as it is a much more terse format, and in mobile applications, it's highly advisable to send the data in the most compact form possible. Php has a number of functions or you can use the zend_json library. The best bet depends on the complexity of your json data, as well as how current a version of php you are using. When you return your results, you want to set the correct header. header('Content-type: application/json');
  10. Indentation is your friend. You have blocks that start and end for no apparent reason, so it's hard to sort out your code, but it looks like you have an unmatched end block curly bracket at the end..
  11. I'm not sure what it is that you couldn't get working. mysql_fetch_array() is exactly the same as mysql_fetch_assoc() only it returns a 2nd copy of the data that is numerically indexed along with the associative array. There is some weird code going on... for example, i have no idea why you are setting a cookie. The obvious thing that jumps out, is that you have some hygiene in regards to the $_GET['r'] parm where you store it to the $r variable, and then you do $r=intval($r); The purpose of that is to make sure that they don't try and slip in a sql injection, but later you drop back to using the $_GET['r'] variable in your query, defeating the purpose of this. Once you clean the data, you should use $r, and no longer use $_GET['r'] which is data that can not be trusted. Also, purely from a performance standpoint, you might as well know that casting the value to an (int) is much faster than calling the intval() function. I won't go into this much, but just take it on faith that you should instead do: $r = (int)$r; However the more important thing is that later, use $r, and not $_GET['r'] in your query. As it is, it seems you're making some progress and no doubt learning a lot as you go. This thread already has a lot of helpful tips in it that you might want to re-read and study. Truthfully, the code at the top of your script looks to have a number of issues, but since we don't really know your objective, it's hard to provide any further practical advise.
  12. Have a css style class that styles the td the way you want. I'm going to assume that the name of this class is ".red" echo ($row['bal'] > 5000) ? '' : ''; echo "{$row['bal']}"; If the first line looks a bit cryptic it's using the ternary operator, which is the equivalent of an if-then-else statement. I also included a little hint on how you can include an associative array element inside an interpolated string. A lot easier to read and maintain than having to concatenate all over the place.
  13. Yes. Most clients these days will autodetect that you have html in the content body and display it as html. Just as a little tip, you really don't need to have all those concatenation operators in there on every line. What you have in your reply isn't valid for example, as you have a long string that you never terminate. At any rate, this is a lot easier to read and maintain: $mybigstring = "This starts here\n And another line\n And another one\n etc.";
  14. bindiya, You still haven't answered my question about the data, but I'm going to guess that you have the structure i described. Write a function that takes this and generates the series of links you want. Something like this: function make_links($categories) { $links = ''; $categories = explode(',' $categories); foreach($categories as $category) { $category = trim($category); $links .= '' . $category . ''; } return $links; } Call this function in place of where you are generating the link instead. echo make_links($row['category']);
  15. You need to understand php arrays. I wrote you a detailed response. $row is an "associative array". If you don't understand what it is, you should read the manual. A hint would have been looking at the code I provided you above. if ($row['tmap'] == 1) { ---- I personally don't know if tmap is the right key or not because I don't know your database structure. I'm guessing that is the right name. For learning about things, the var_dump() function is very helpful. var_dump($row); And you'll get some output that shows you what $row actually contains after the fetch. You should get output that indicates that you have an arrray structure, and the contents of that array.
  16. With css the simple answer is to use a css style for the image that does: float: left; You should output the image first. Additional text will flow around the image. There's no need for tables, and I would avoid them for this.
  17. Ok so if I understand you: form.php - Your form page, with target being ... checkdata.php - Where you validate input and then if everything is ok, you header('Location: page3.php') page3.php And page3.php is the page people are going to directly. Does this summarize things correctly? If so, let's see the code at the top of "page3.php"
  18. The only way this works is if you are sending an html format email. You simply inlcude an img tag just as you would for any other html page.
  19. When you query the database the server generates a result set on the server. You then have to fetch the data. There's various functions, but I usually recommend mysql_fetch_assoc() which gives you an associative array where the array keys are the names of the columns in your result set. So your 'something here' should be: $row = mysql_fetch_assoc($result); Assuming I guessed your structure correctly the array code I provided should work.
  20. That is not what I'm asking. What I'm asking, has to do with the data. I can not guess at the structure of your database table or tables. So far all you provided is: $q1="select * from post_pages where post_category like \"%$var%\" order by posted_date desc "; I can not answer your question when I don't know the structure of post_category, or how the database represents that a post_pages row is in multiple categories. Is this a varchar column that has something like: 'News, Issues' in it?
  21. Ok, let me try this one last time. You don't want to send content when someone has bypassed a required page on your site. Why then, are you sending the page content when you already *know* that they should not see it in the first place? Why are you avoiding figuring out the problem with your script? Please stop avoiding my question, and answer this question.
  22. If you want this all in one script, you could add a little code that finds the day of the week based on date, so if you want this to be done let's say on Sunday only, something like: if (date('N') == 7) unlink($FileName);
  23. You need to read the section of php manual on mysql_query()
  24. That is a really painful way to do that. One much better way -- use an array: $tmapmsg = array('tmap 0 msg', 'tmap 1 msg', 'tmap 2 msg', 'tmap 3 msg', 'tmap 4 msg', 'tmap 5 msg'); //... do your query, fetch row echo $tmapmsg[$row['tmap']];
×
×
  • 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.