Jump to content

PHPTOM

Members
  • Posts

    84
  • Joined

  • Last visited

Everything posted by PHPTOM

  1. #bar { position: fixed; width: 100%; bottom: 0px; left: 0px; border-top: solid 1px #e1e1e1; background: #ffdab9; text-align: center; } <div id="bar"> Bar text </div> That *should* work
  2. Your $i variable should give the number of the row
  3. Hey guys, Basically I have this code: <select name="year"> <?PHP for($i = 1900; $i <= date('Y'); $i++){ echo '<option value="'.$i.'">'.$i.'</option>'; } ?> </select> But the only problem is that it displays in the wrong order. Eg: 1901 1902 1903 ... 2005 2006 2007 How can I make it so it goes like this: 2009 2008 2007 ... 1930 1929 1928 Thanks
  4. Hi, Basically I have a huge multi-line variable and I want to trim the top line off it. Here is an example: <?PHP $var = "line1 line2 line3 line4"; ?> And I want it just to be <?PHP $var = "line2 line3 line4"; ?> The first line changes, so I cant do explode or anything. Thanks
  5. No basically I have an external language file. It is a big array of translations. I want to echo an array, so this is a better explanation: language.php: <?PHP $language = array("hi" => "bonjour"); ?> [/plhp] functions.php: [code=php:0] <?PHP include "language.php"; class Layout{ function Top(){ echo $language['hi']; } } ?> However it doesnt actually echo this. It is not echoing anything. How can I do this?
  6. Hi all, Ok I have a language file and a class. Basically this is the class file: <?PHP include "language file"; class Layout{ function Top(){ ... function Bottom(){ .. } } ?> If I go to echo the $language variable, it doesn't display. How can I use variables from outside of the function/class in the function? so function Top(){ echo $language['....']; } Thanks
  7. Hi, Im wanting a table to function like this: *table coding* <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> </tr> <tr> <td>5</td> <td>6</td> <td>7</td> <td>8</td> </tr> I basically want it to go to a new row once it hits 4 items on the current row. Any ideas on how to do this? I'm off to school now, but I will be sure to have a read when I get in if anyone replies Thanks
  8. Edit: Works perfectly. I just plain echod new time, instead of using date. Great thanks a lot!
  9. Yup, I know about examples. I added that variable to show you better, as you won't know what $a['time'] means. I'm having problems with it not working the correct hour out. <table width="100%" cellpadding="4" cellspacing="0" border="0"> <tr> <td><font class="heading2">Start</font></td> <td><font class="heading2">End</font></td> <td><font class="heading2">Presenter</font></td> </tr> <?PHP $q = mysql_query("SELECT * FROM `timetable` WHERE `day` = '".$_GET['day']."' ORDER BY `time` ASC"); while($a = mysql_fetch_array($q)){ $newtime = strtotime("+2 hours", $a['time']); ?> <tr> <td><?=$a['time'];?></td> <td><?=date('H:i', $newtime);?></td> <td><?=$a[presenter];?></td> </tr> <?PHP } ?> </table> This is what I have dispayed: 17:00 02:00 Tom Any ideas? The 02:00 should show 19:00.
  10. Sorry doesnt work, it displays 7212. Basically I have: A while, getting the start time from mysql. $starttime = $a['time']; Then I put this $newtime = strtotime("+2 hours",$starttime); and echo $newtime; It displays:
  11. Hi, I am coding a timetable and basically I want to know how to add minutes to 24hour. I have for example 13:00 in the database, and I want to add 120 minutes to this. Can someone assist me in a function to do this please? Thanks
  12. Nevermind done it ---------------- Now playing: Sum41 - Pieces via FoxyTunes
  13. Hi, How do I do this.. Sorry my mind has gone blank. I have an array assigned to $array How do I cycle through the array? ---------------- Now playing: Sum41 - Pieces via FoxyTunes
  14. Hmmm... Even if I use a third party encrypter it isn't that safe i've read either. I might host it on my server and use Pay Per Access. Thanks guys!
  15. Hi, Basically I would like to distribute this script I am making with a serial number what calls to my server to check if its valid. Any ideas on how this is possible?
  16. PHP is executed server side as normal. .htaccess: RewriteEngine on RewriteBase / RewriteRule ^ads\.js$ ads.php ads.php: header('Content-type: application/javascript'); //You can do PHP stuff. But when you want to echo stuff do document.write echo "document.write('hello world')"; Now you can do <script type="text/javascript" src="ads.js" /> I don't know if this will actually work. But there is a chance ---------------- Now playing: 2pac - Changes via FoxyTunes
  17. Basically you want to do this right? Subject 1 Subject 2 Subject 3 Subject 4 So... On... ---------------- Now playing: 2pac - Changes via FoxyTunes
  18. Right Have a database Have a row called menu (used here) Have 3 columns called id, image and name <?PHP // Connect to database etc echo "<table>"; $query = mysql_query("SELECT * FROM `menu`"); while ($array = mysql_fetch_array($query)){ echo ' <tr> <td align="center"><a href="index.php?singer='.$array['id'].'"><img src="'.$array['image'].'" />'.$array['name'].'</a></td> </tr>'; } echo "</table>"; ?>
  19. <?php $con = mysql_connect("localhost","apnimusk","password"); if (!$con){ die('Could not connect: ' . mysql_error()); } mysql_select_db("apnimusk_naat", $con); if(isset($_GET['id']) && is_numeric($_GET['id'])){ $result = mysql_query("SELECT * FROM `albums` WHERE `id` = '".$_GET['id']."'"); echo "<table border='1'> <tr> <th>Title</th> </tr>"; while($row = mysql_fetch_array($result)){ echo "<tr>"; echo "<td>" . $row['title'] . "</td>"; echo "</tr>"; } echo "</table>"; }else{ $result = mysql_query("SELECT * FROM `album`"); echo "<table border='1'> <tr> <th>Name</th> <th>Age</th> </tr>"; while($row = mysql_fetch_array($result)){ echo "<tr>"; echo "<td>" . $row['name'] . "</td>"; echo "<td>" ."<a href='?id=".$row['id']."'>".$row['age']."</a>" . "</td>"; echo "</tr>"; } echo "</table>"; } mysql_close($con); ?>
  20. <?php if (isset($_GET['page'])) { $subject_pages = get_pages_for_subject($sel_subject['id']); echo "<table>"; while($page = mysql_fetch_array($subject_pages)) { echo " <tr> <td align=\"center\"><a href=\"index.php?singer=" . urlencode($page['id']) . "\"><img src=\"".$page['image']."\"/>".$page['menu_name']."</a> </td></tr>"; } echo "</table>"; } ?>
  21. <?php $con = mysql_connect("localhost","apnimusk","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("apnimusk_naat", $con); // check to see if id is set if(isset($_GET['id']) && is_numeric($_GET['id'])) { $result = mysql_query("SELECT * FROM `albums` WHERE `id` = '".$_GET['id']."'"); echo "<table border='1'> <tr> <th>Title</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['title'] . "</td>"; echo "</tr>"; } echo "</table>"; } // no id requested, display results else { $result = mysql_query("SELECT * FROM `album`"); echo "<table border='1'> <tr> <th>Name</th> <th>Age</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['name'] . "</td>"; echo "<td>" ."<a href='?id=".$row['id']."'>".$row['age']."</a>" . "</td>"; echo "</tr>"; } echo "</table>"; } ; } mysql_close($con);
  22. Couldn't you do something like this. I know it's an extremely bad way of doing it but I don't know any different. <?PHP $words = array( 'baloon' => 'बलून' ); ?> Then you could say: <?PHP echo "The translation of 'baloon' is: ".$words['baloon']; ?>
×
×
  • 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.