Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. Alright, I do not think getdate is what you want. I would go this route. Also please use [ code ] tags to make code look presentable. <html> <head> <title>PHP Assignment</title> </head> <body> <p><b>Part 4</b></p> <font color="red"> <?php $now = time(); print date("D F d Y, H:i:s", $now); ?> </font> <br></br> <?php $cnt = date("s", $now); echo str_pad("", intval($cnt), "*"); ?> </body> </html> Assigned the $now to the current time and just using that to reference everything. getdate returns an array of values and you really do not need that. Hopefully the above works.
  2. You may be wanting to do an AJAX request, where you can send data to a page and not do a page reload. My suggestion is look into AJAX.
  3. Should be an easy fix. $cnt = date("s", getdate()); echo str_pad("", intval($cnt), "*"); intval should solve that issue.
  4. http://www.theblog.ca/session-register-globals May help explain it. A few other pages with information can be found at: http://www.google.com/search?hl=en&q=register_globals+and+session+variables&btnG=Google+Search&aq=f&oq=
  5. Ahhh now that is much easier to do: $cnt = date("s", getdate()); echo str_pad("", $cnt, "*"); That should work as long as getdate() returns a valid date that can be used by the date function.
  6. First let me point out that I would use <?php echo over <?=. This should get you your result: <?php echo str_replace("_", " ", ucwords($query)); ?> preg_replace is better when you have alot to replace. For simple items like that str_replace is simpler.
  7. No not really. You mean you want to change from ******* to --------- to ^^^^^^^^^ to &&&&&&&& ? Provide an example of what you want written out like output should look like: ****** Then the next page load it should look like: &&&&&&&& And maybe that will clear up what you want.
  8. What exactly are you trying to do? If this is in a database, why not put UCUS-98646 Killzone Liberation [uS] into 3 seperate fields? IE: UCUS-98646 in a field called "code" Killzone Liberation in a field called "title" US in a field called "country" That will save you tremendous heartache of parsing etc and will allow for easy searchability etc. And you can easily rebuild the string to look like it does above.
  9. Or you could do this: $d = getdate(); $len = strlen($d); echo str_pad("", $len, "*"); I would think that would work. But if you know the amount of characters you could just do: echo str_pad("", 8, "*"); If it is always 24 hour time that should be true.
  10. When you need to iterate through all elements of an array. foreach
  11. <?php $output = "<form><select name=dates>"; while($row = mysql_fetch_array($results)){ $output .= "<option values='" . $row['dates'] . "'>" . $row['dates'] . "</option>"; } $output .= "</select></form>"; echo $output; ?> Maybe that is what you are after?
  12. From your first post, I thought that was what you wanted. Simple fix: echo ucwords($query) . " in Newark"; And your done.
  13. header("location: ../crime.php"); $query = $db->execute("update `players` set `nerve`=? where `id`=?", array($player->nerve - 1, $player->id )); That query will never get executed. Put it above the header line if you want it to actually be executed.
  14. <?php $output = "<form><select name=dates>"; while($row = mysql_fetch_array($results)){ $dates = $row['dates']; foreach($dates as $key => $values){ // $key = $values; not sure what that is for $output .= "<option values='$values'>$values</option>"; //echo $values; } } $output .= "</select></form>"; echo $output; ?> Should work, assuming $dates is an array.
  15. echo "(" . ucwords($query) . ") in Newark";
  16. I do not think it is necessary to sanitize it unless you use QUERY_STRING or REFERRER. Although I know the remote_addr can be spoffed I do not think they can change it to where it can be used as sql injection.
  17. <?php $username = $session->get('s_username'); $sql = "SELECT * FROM employees where username = '$username'"; ?> Assuming your session class works, you need single quotes around the variable when checking against mysql.
  18. mesg is the name of your database. Make sure you are using the correct database for this and that the table name is correct..
  19. You can use a meta redirect. Look that up on google, "meta redirect html" Header does not have a delay unless you sleep the script for x seconds.
  20. $results = mysql_query("SELECT `name` , `address` , `city` , `phone` , `www` ,`id` FROM `bizlist` WHERE `city` = 'Newark' AND `category` LIKE '%$query%' ORDER BY name ASC LIMIT $page, $limit") or die(mysql_error()); while ($data = mysql_fetch_array($results)) Add that and see what the error is in the sql.
  21. Its probably the us-sacii charset. If that was utf-8 I bet you wouldnt have that problem. Is there a reason you are using the us-ascii charset?
  22. If the headings are the same you only need to use them once. echo "<div >"; echo "<table width=700 border=1 cellpadding=3 cellspacing=1>"; echo "<tr><th><b>Location</b></th><th><b>Current Conditions</b> </th><th>Temperature</b> </th><th><b>Wind Speed</b></th><th><b>Wind Chill</b></th></tr>"; for ($c =0; $c <= 2; $c++) { echo "<tr><td>".data_extract($data, "location", $c)."</td>"; echo "<td>".data_extract($data, "weather", $c)."</td>"; echo "<td>".data_extract($data, "temperature_string", $c)."</td>"; echo "<td>".data_extract($data, "wind_string", $c)."</td>"; echo "<td>".data_extract($data, "windchill_string", $c)."</td></tr>"; echo "<tr><td colspan=5><img src=\"".data_extract($data, "icon_url_base", $c).data_extract($data, "icon_url_name", $c)."\"></img></td></tr>"; // not sure if this is kosher or where you want it. Probably should be in a column also. modified it to be in it's own row. } echo "</table>"; echo "</div>"; That should get you the desired results.
  23. If javascript is disabled that will not work, since it does use javascript. To use the header function you need to call that before anything is output to the screen, so do that if check at the top of the page and it should work.
  24. How about utf8_decode ? Encoding it just takes that string and makes it more nasty (I think). I know that solved my issues with the above. Although it is better to design your database to handle them instead of getting them trashed, yea. It worked for me at least.
  25. That is not really with cookies. You need to use the setcookie function if that checkbox is checked. Then you need to modify your authenticate function to validate cookies if they are set and sessions is not and then set them to the session so you just always access session. Although session is stored in a cookie, it gets wiped on a browser close. Cookies stay alive until a user logs out and you destroy them or they clear their browser's cookies out manually. Hope that helps.
×
×
  • 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.