Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. Back in around 2005 we did have ajaxfreaks and mysqlfreaks. At some point the sites were done away with, which is a shame because there was some good content associated with each. I'm not really sure why they decided to merge things, but that all happened years ago. Ajax is really just a small part of javascript. Not as many people read the javascript board, but I think our coverage there is pretty good, however, if you're not having much luck there are a lot of other forums out there that focus or have subboards about javascript that might try. Sitepoint has a pretty active forum, and some good expertise there thanks to their books on the topic: http://www.sitepoint.com/forums/javascript-15/
  2. At the point you are running this, you don't have a session, or the variable $_SESSION['id'] is not set.
  3. Of course. Usually people will have a database table and when an image is uploaded they'll insert an entry into the table, with a column for the name and path of the uploaded file, the user_id of the user who uploaded it, and maybe a title, createdDate, etc.. People often find this table useful since you can easily offer views that sort by date or by user, or any combination that makes sense, and a database can do this efficiently even as a lot of images are added.
  4. If this is on linux, all you need is a little shell scripting. A quick google will return you pages of results. Typically people will cron their backup. If it's a database driven website, then you will want a job that dumps the database(s) to files and you can then combine that with the files, or just leave them seperate. Generating the backup is simple, you can use tar and bzip in one simple command line and you have everything you need. The problem is moving the backed up file to some other machine, or a backup tape or what have you.
  5. There's lots of different ways to output html from php. You can drop in and out of php, you can make heredocs, or you can just echo out strings. The best way really depends on what you have, but here's a simple example of echoing: $name = 'vivien'; $status = 'ojt'; echo "</pre> <table> Namestatus $name$status </table>";<b This demonstrates how php will interpolate variables into strings you define using the double quotes.
  6. No, you really have to add an account system first, and then employ a scheme that associates files with the user who uploads them.
  7. What is ojt? All I got from your post is that you have some code that does something, and you tried to add something and something doesn't work. How about trying to rephrase specifically what your question is, and provide code if what you're hoping for is some help with how to fix code that has errors or doesn't work.
  8. Just really depends on the nature of the site, what sort of people are in your target audience, how much competition you're facing, and how sticky the site is.
  9. At the top add this code so you can see what the actual query is. $query = "SELECT id, firstname FROM `Members` WHERE id={$_SESSION['id']}"; var_dump($query); Just add the var_dump there. Hopefully you have phpMyAdmin setup so you can look at the contents of the database, and issue queries to it. Whatever the query is, it is returning multiple rows when you expect that it should only select 1. You need to figure out why that is.
  10. Well, your code is looping and will echo for every row in the result set. Also you need to actually use the data in the $row variable. echo "Welcome, {$row['firstname']}"; What this indicates to me is that you have some issue with your routine where it is inserting multiple rows with the same id, which is something that should not be possible if there is a proper primary key on the table. Fixing the welcome message should help you figure out more about what you have, but at this point you're at least making a valid query and getting a result set back.
  11. Strike 3 on posting code without tags.
  12. Well the problem appears to be that you are setting the value of $_SESSION['id'] to be literally '$id' rather than the numeric value of the id for the user. You need to check the script that does that work. Based on your error checking code here is what I would suggest you change to make things a bit easier, and eliminate the notice you're getting for the undefined variable. $query = "SELECT id, firstname FROM `Members` WHERE id={$_SESSION['id']}"; $result = mysql_query($query); //Check result //This shows the actual query sent to MySQL and the error. Useful for debugging. if(!$result){ $message = 'Invalid query:' . mysql_error() . "\n"; $message .= 'Whole query:' . $query; die($message); } //Use result //Attempting to print $result won't allow access to information in the resource //One of the mysql result functions must be used //See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc. while($row=mysql_fetch_assoc($result)){ echo "Welcome, $firstname"; } //Free the resources associated with the result set mysql_free_result($result);
  13. No worries, and good luck with your project.
  14. You need to reference the ini file, open it with a text editor, find the line memory_limit = And increase that. You got an out of memory limit at only 8 mb, so the limit must be unusually low. Try bumping it up to 32m. Whenever you make changes to the ini file, you need to restart apache, and you should probably check the phpinfo to be sure that your change is reflected in the configuration screen.
  15. Seriously, did you actually make an attempt to proof read what you wrote there? Try actual sentences, punctuation and reading what you wrote out loud if you're unclear. Do an html only mockup before you try to get it working in code. -Tables can have nested tables. -If each section is a table with a th and one td per tr, you will have the basis for the section for one letter. You know how to do this already. -Your outer container table simply needs to have one row with 5 Once you understand the html, figuring out how to output it correctly should be pretty easy to accomplish.
  16. Haha, yeah i see the issue. I wrote "emit" which in this context means to output. I should just say echo or print, but i've used emit for years. I never thought about it that much but I can see how it could easily be confused with "omit".
  17. Why did you revert back your code to the same problem we already fixed?
  18. First create a script that accepts name as a parameter, queries the groups table and returns the name, number and email. Most people these days will use json format for the data. When you have that done, you can do the ajax, and the DML should be simple enough, but I strongly suggest that you use jquery rather than trying to adapt some crappy w3schools article.
  19. rajaahsan, I realize you are not a native english speaker, but this forum is an english language forum. We can not communicate effectively if you can not explain your problems adequately in the english language, or if you are unable to read and understand what people are saying to you. You might be better off trying a php forum where there are people who speak and write in your native language. Your code is simple, and it does what it is suppossed to do. The problem here is that nobody can tell from your code what the problem is, or what you are trying to do.
  20. [code=php:0] Paste your code here [/code]
  21. No, do you understand what an img tag is and how it works? My best guess, because i don't know where the images actually reside and what the value of $dir would be.
  22. You're confused. MySQL has pluggable "engines" which allow it to support different storage systems, which can have vastly different mechanics and capabilities. The default engine is "myisam". Fulltext indexes require that the table where you've created the fulltext index be a myisam engine table. phpMyAdmin is a web application that provides an administrative interface to mysql. It is not an engine. Often people use the innodb engine for a number of reasons. MySQL fully supports the use of multiple engines at the same time, so you can have a database where you have an innodb engine table and a myisam engine table in it. You can look at the table schema in phpMyAdmin and see what engine is being used, but my guess is that unless you knew specifically what you were doing, your tables are already myisam, so you will not have an issue adding a fulltext index.
  23. rajaahsan, If you make another post without using the code tags I'm going to lock this thread, and might ban you as well. No more warnings.
  24. You're missing the point of my reply. The query is not going to return any rows. You need to look at the WHERE clause and figure out how to get PHP variables in there so that you actually find the row for the member who just logged in. I would assume that id is all you need in your query, but there's no way to know from the code you presented, where the id value is suppossed to come from. My assumption is that some prior operation might have set it in a session variable, so you could use it in the query like so: $result = mysql_query("SELECT id, firstname FROM `Members` WHERE id={$_SESSION['id'}");
  25. -Use php code tags around your code My best guess at your question, is that you want to add a WHERE clause to your query. Personally I would do: SELECT count(*) as countof FROM game1 WHERE `date` = '{$_POST['sdate']}' This query will always return a single row you can fetch, with a single column. There may be issues depending on the format of $_POST['sdate'] matching what mysql needs, as well as an issue with the data type of the date column in the table, but you can read about that in the mysql manual.
×
×
  • 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.