Jump to content

AndyB

Staff Alumni
  • Posts

    5,465
  • Joined

  • Last visited

    Never

Everything posted by AndyB

  1. The syntax for your query ought to be SELECT from tablename ORDER by fieldname DESC LIMIT 25. If the value of $total happened to be 250, do you actually a database field named 250? I doubt it. And that's why you get an error.
  2. Curious and curiouser. I'm running FF 2.0.0.14 and XP Pro locally. The php script is running on a *nix server so it appears we have identical environments. I don't see that the disabled functions would have any effect at all. One difference between the code I have working and the code you're having trouble with is that mine generates a .txt file whereas you're trying to generate a .xls file. Needless to say, my .txt file opens perfectly with Excel.
  3. It's not clear why my most recent code works for me with Firefox (2.0.0.14) on a PC but fails for you. What's your version? What's your OS?
  4. No. Suppose you retrieve the date from the database as the variable named $the_date. list($y,$m,$d) = explode("-", $the_date); // gets y, m, and d from the stored date $some_date = date("Y-m-d", mktime(0,0,0,$m,$d,$y+1)); // $some_date is one year later Does that shed some light on things?
  5. http://www.w3schools.com/css/pr_background-position.asp background-position: top center;
  6. You should remove the zillion tabs between the end of the textarea opening tag and the start of the textarea closing tag. My guess is that'll fix it.
  7. well, since day is a number anyway why not just skip the number format thing and echo $d
  8. $year = mysql_query("SELECT dob FROM $table WHERE username = '$mysite_username'"); $year1 = mysql_fetch_array($year); $dob = $year1['dob']; // this line is revised list ($y, $sm, $d) = explode ('-', $dob); // slight change echo number_format($d); I assume it's a single result, so no while needed.
  9. We don't know your database field names, etc. Show us your efforts first, then we'll help.
  10. open the script file using whatever editor you use. Copy the file contents to your clipboad. How that's done depends on your editor. 'Reply' to this thread and paste your clipboard into the reply between code tags
  11. Look at the use of strtotime() in example #1 at http://ca.php.net/manual/en/function.time.php Using yyyy-mm-dd format allows you to perform all the manipulation of dates that you'll ever need without worry about what if the month changes, what if the year changes, etc.
  12. If want to store useful dates in a database, also use the ISO standard format - yyyy-mm-dd. That allows you to sort in calendar order, do 'math', and you can use whatever format you want to display the date as needed.
  13. http://www.codertools.com/css_help_guide/css_background-position.aspx
  14. Before executing the query, echo $_u and examine it to see if it makes sense and is in the form you expect and contains the data you expected.
  15. tested with Firefox, this produces the download dialog box with option to open and save. You should be able to adjust to suit your case and have it work: <?php include("../includes/db-conn.php"); mysql_connect($db_host, $db_login, $db_pass) or die ("Can't connect!"); mysql_select_db($db_name) or die ("Can't open database!"); $CSV = "To,From,Car Price,4WD Price\n"; $file ="report_". date("Y-m-d"). ".txt"; $query = "SELECT * FROM ratesheet ORDER by id ASC"; $result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query); while($myrow = mysql_fetch_array($result)) { $CSV.= $myrow[city_to]. ","; $CSV.= $myrow[city_from]. ","; $CSV.= $myrow[price_car]. ","; $CSV.= $myrow[price_4wd]. "\n"; } header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"$file\""); header("Content-Transfer-Encoding: binary"); if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')){ // IE cannot download from sessions without a cache header('Cache-Control: public'); } echo $CSV; exit; ?>[code] [/code]
  16. $q = "INSERT INTO resume(name,dob,address,city,state,post,contact,mobile,email,file) VALUES ('".$_POST[name]."','".$_POST[dob]."','".$_POST[address]."','".$_POST[city]."','".$_POST[state]."','".$_POST[post]."','".$_POST[contact]."','".$_POST[mobile]."','".$_POST[email]."','')"; 10 fields listed 9 values stated If you had error-trapping, it would have jumped out at you
  17. AndyB

    Varchar to INT?

    It will destroy the integrity of the data. Things with commas are strings not numbers. Sounds as though you need to convert your data into floating point numbers and store them in a field type float or decimal. How you display them in the browser is immaterial.
  18. if (isset($_POST['Register'])){ should be if (isset($_POST['Register_x'])){ images as submit items return the x and y co-ordinates of where they were clicked
  19. SELECT rank from users where some_field = 'something in the login that identifies the user'
  20. http://www.everythingdunes.com/
  21. I suspect that lots of people who have looked at your problem have ideas on how to do that. Why don't you show us your code effort - we're here to help you help yourself, not to write code for you.
  22. This works for me: header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=$filename"); header("Content-Transfer-Encoding: binary"); if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')){ // IE cannot download from sessions without a cache header('Cache-Control: public'); } echo $tsv;
  23. I notice there is absolutely no text content in your home page. It's certainly not going to be found in any search engine index.
×
×
  • 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.