Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. is it inside your form tags?
  2. fyi, doing mysql_fetch_array($blah, MYSQL_ASSOC) is the same as doing mysql_fetch_assoc ($blah) _assoc returns associative array _row returns a numerical array _array returns both without a 2nd argument, and one or the other with a 2nd argument
  3. curl
  4. I usually use my fingers. If I run out of fingers.... it probably wasn't that important anyways.
  5. http://www.phpfreaks.com/forums/index.php/topic,107835.0.html
  6. well back up there mister...as I said, the only reason you'd want to use a session variable is if you're going from form > formtarget > someotherpage how many actual script pages do you have? Because it SEEMS to me that you should either be having 1 or 2 here. Right? If so, forget about the sessions you don't need them. Repost your code the whole thing.
  7. yeah...well, you can do more than that. Like 20-50. Guess it really depends on your server.
  8. does php have read permissions for cmd.exe? simplest way to do that is to make a copy of it in php.exe's directory.
  9. well if you are only sending a couple of emails then your script will process it in time but if you have like hundreds or thousands of emails, you're script is going to timeout because it will take too long to send all those emails. So you would break the email list down into smaller chunks and send them 1 chunk at a time.
  10. ^ depends on how many emails you are sending you might need to break it down into bite-sized chunks so your script don't timeout.
  11. should you? I have no idea what your batch file is supposed to be doing or your script's intentions.
  12. using the $_POST array only works for the targeted action='target.php' page if you wish to then carry it from target.php to some other place, you're going to have to turn it into a session variable. As far as your query "not working" you're going to have to be more specific. Right off the bat I see that you are not properly escaping quotes in your string it needs to look like this: $sql = mysql_query("Select * from login where EMAIL='{$_POST['mypassword']}'"); If that still doesn't work then check your form and make sure you spelled mypassword correctly. If you did, then separate your query string from your query execution, echo it, and also add some error reporting, like so: $sql = "Select * from login where EMAIL='{$_POST['mypassword']}'"; echo $sql; $res = mysql_query($sql) or die(mysql_error()); check your table name and column name make sure you're using the right ones. Enter in the echoed query string directly into sql through phpmyadmin to see if you get expected results.
  13. umm it looks like you have a basic form with basic variable checking there's no functions or classes or anything in play here so you don't need to worry about variable scope. The problem is that you are getting information from your form via the POST method so you need to be accessing your info via the $_POST array not from a session. Your variable can be accessed from this: $_POST['mypassword'] just plug that into your conditions and you're good to go. I do suggest sanitizing it first though.
  14. does the batch file complete it's run? because unless you redirect the output of the file to some other file or stream it will cause php to be put on hold until it's done..so it might be timing out your script
  15. Wait..what? I did not sign up for this... /covers cornhole
  16. yeah so you're basically going to want to have a table that looks like this (with example rows): idartistalbumstatus 1Artist1somealbumsomestatus 2Artist2somealbumsomestatus 3Artist3somealbumsomestatus 4Artist1somealbumsomestatus Now notice that there's 2 rows in there with the same artists, because as you know, artists can have more than one album. So you can't do a query to select rows to edit based on artist name, because you will get more than one result back. But you CAN make a query to do that and then display them and then users can pick which one to edit. Your query would include getting the id for that row. They click on the album (or whatever) and since your code knows the id, you do a query to get that specific information. Or rather, you would already have queried and gotten that information, so all you have to do is take that same information and put it in your value = "" attributes in your editing form (no need to query the db twice for the same info). Then your script would UPDATE the row based on that id, so it knows which one to update.
  17. Do it sasa's way. I forgot the outer quotes in the implode. The implode will take your array and make it into a comma and quote separated list, the goal being to make your query string look like this: select id from table where id in ('blah','someotherblah','moreblah')
  18. well...you could do a blanket select * from table and make a form display for every single artist, but that's pretty inefficient. I mean, 1 or 2 artists is one thing, but if you plan on having hundreds of rows... Anyways, you're going to need some kind of unique identifier for each of your rows in your database. That's the way databases work. If you have 10 books on a shelf and you ask someone to get you "a book," that doesn't really tell them which book you want. Even if you narrow it down and say give me a book by "some author," well, you could have 10 books on that shelf by that author. That's the trick to databases. Think of it as a giant bookshelf with lots of rows and even lots of shelves. Think old-school like how they group books together by subject/genre, then by title and/or author, and finally by serial numbers (that whole dewey decimal system thing). So the efficient thing to do is have a unique identifier for every single row. Other users and even you do not need to necessarily know the id number. I mean, it really depends on what kind of data you are holding in your database and how you have it setup. Let's for example say that you have artists in your table and each row has to do with their songs and there's a different row for each song. You could make a form to do a search for the artist. Let's say you put "Janet Jackson" into the form it could return all rows that have to do with Janet Jackson. You could then make it to where you click on the one you want, and it will show the form with the editable information. But again, it really depends on what data you have and your intentions of your site, as to how you're gonna do this. But the uniquely identifying id for each row is going to be a necessity regardless; that's for your code to figure out which row to update. If there's only going to be one row per artist and each artist's name is unique, then for all intents and purposes, that could be the unique id per row. It sounds to me like the first thing you need to do is sit down and make a flowchart of your website. Make some diagrams on paper showing what exactly it is you're wanting to be able to display and edit. From there, you will be able to decide how to design your database structure, and from there, you can design how to get your information from the database to the webpage and back again.
  19. $list = implode (',',$aEmail); $query = "select id from table where id in('$list')";
  20. also make sure your CHMOD for the folder and file allows for the script to access it.
  21. Most people use CSS for spacing things. As far as php code for repeating things: you would use a loop. for() foreach() do() while() for example: for ($x = 0;$x < 10; $x++) { echo " "; } // end loop // will echo out 10 of those things on the same line
  22. The first thing you want to do is query your database for the current information. What your query string will look like depends on what you're wanting to edit. If your table is for instance account information for people, each row should have some kind of uniquely identifying data, like a user id. So you will want to select the row from the table by that user id (or whatever). A basic query for this might look like: select * from table where userid = '$userid' Now you will get $userid from some kind of initial input from the user. Something as simple as a form to get an id will work. A common example of this is with login scripts, or account editing scripts. Someone enters in a user name and password and you would select data from the table based on those, or after they are logged in, you'd retrieve their account information based on their userid that you would have retrieved from the login script. After you have selected the data you wish to edit, you will want to make a form with fields that match the data. Now, in each form field you can add the value = "..." attribute. You will put the retrieved data inside those quotes, and the information will display in your fields as default values in your form. From there, you will be able to edit the data at run time in the form just like normal, and as far as adding the altered data back into the table, you will use an update query (instead of an insert query), based on that same user id. A basic update query will look something like this: update tablename set name = '$name', email = '$email' where userid = '$userid' the $name and $email will be the posted variables from the form, just like how you did with the insert query, and the $userid will be the user's id that you can have carried over from a hidden form field or a session variable or whatever.
  23. Like rondog said, use php.
×
×
  • 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.