Jump to content

j0n

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

About j0n

  • Birthday 12/28/1983

Profile Information

  • Gender
    Male
  • Location
    United Kingdom

j0n's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Sure. Crappy example, but here you go: <ul> <?php foreach($definedPages as $page) { echo sprintf('<li><a href="/some/path/index.php?page=%s">%s</a></li>', $page, ucfirst($page)); } ?> </ul>
  2. at the top of your script, try this: ini_set('display_errors', 1); Don't be so rude to people trying to help you, or you'll find your threads quickly go unanswered.
  3. Check there isn't a DEFAULT flag on that field. This query will set the default back to 'NULL' again (obviously, put in your table name and column name). ALTER TABLE your_table MODIFY date_column DATE DEFAULT NULL;
  4. May I recommend jpGraph: http://www.aditus.nu/jpgraph/
  5. If it stores a date, why are you not using a DATE or DATETIME column? Try changing this and the SQL posted previously should work.
  6. It isn't necessarily slow. Once the image has been generated for the first time, he can cache it on disk. Generating an image of that size is going to take a fraction of a second anyway, so speed is not an issue here.
  7. If the width of the text is annoying him so bad, he could always use GD to create images for the game titles. Using the functions outlined above, it'll always be rendered the same and always fit.
  8. another way. $month = 11; $query = sprintf("select * from events e where e.active = 'y' and month(e.date) = '%d' order by e.date desc", mysql_real_escape_string($month));
  9. You can parse glyph information out of TTF files, but it is a relatively involved process. There is a library called FPDF for generating PDF documents on the fly that has tools to do this, which you can find here. You can just download the FPDF library and just use the font tools if you need. Another way is by using the GD library. imagefontwidth() may do some of what you require. There is also one for the height of a font as well, unsurprisingly named imagefontheight().
  10. for your reference (if you need to refer to this again), it is called a ternary operator. is also a waste, since an IF statement is a boolean operation anyway. It can be rewritten in PHP as: $isPositive = ($x > 0); Hope this helps.
  11. $query = mysql_query(sprintf("SELECT Admin FROM Users WHERE Username = '%s' LIMIT 1", mysql_real_escape_string($_SESSION['s_logged_n']))) or die(mysql_error()); should fix it. Essentially, If you look at $_SESSION['s_logged_n'], you're closing the previous string with the apostrophe. You may want to look at different ways to concatenate strings together. For MySQL queries, you should perhaps look at preparing your statements (required mysqli extension). Otherwise you could do as I did above and use sprintf or vsprintf.
×
×
  • 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.