Jump to content

jdavidbakr

Members
  • Posts

    271
  • Joined

  • Last visited

Everything posted by jdavidbakr

  1. $stop is assigned to false, and the loop is set to stop when $stop equals true so that isnt it, but it was my first thought at what was wrong. No, the loop will run as long as $stop == true Remember, a normal loop condition would be like this: for($i=0; $i<10; $i++) to loop 10 times, or as long as $i < 10.
  2. So you're not uploading your files to a web server? If the address location says "file://" you won't be able to do php. You have to be connecting to a server. If your laptop is a Mac or Linux box, you can set it up on your laptop; I don't know if you can on Windows or not (you probably can install Apache and PHP but I wouldn't know anything about that). Bottom line, though, is for PHP to work it has to be running on a web server, not just loading the file into Firefox.
  3. Do you have your own server or are you on a hosting plan? If you're on a hosting plan, they should have PHP installed. You might be using the wrong extension (i.e. using .html instead of .php or maybe they require .php5). If you can't figure out why it's not working, you'll probably need to contact tech support to see what you're doing wrong. If you have your own server, installing PHP is a bit out of scope for this forum, it depends on the OS and whether you have packages for your distro and what not.
  4. Hm, ok, I just looked up the curl_setopt() command and it appears that you're doing it correctly. Two thoughts: 1) Are you sure there's an uploaded file? Maybe do a var dump of $post_array to make sure that $myfile is defined. 2) Maybe the file size is too big and is being rejected by the destination server?
  5. The easiest way is to create a CSV file, Excel will open that.
  6. Does your web server have PHP installed? Firefox doesn't run PHP, the web server does, and then sends html to Firefox that is generated by the PHP code. If you're just loading the file on your local machine into Firefox, that won't do PHP. It has to be running on a server configured for PHP.
  7. $myfile=$_FILES['uploaded_file']['tmp_name']; What is the remote server going to do with that? Just trying to figure out why that's a parameter, since it's a local file that the remote server can't do anything with. My guess is that there's something that's messing up the post data between the '@' symbol an the file name, like an invalid character; unfortunately I'm really not too familiar with CURL.
  8. Look at your page source in your browser - do you see the <?php ?> tags? If so, your page is not being processed as a PHP page.
  9. Where is promptForDecision() defined? I've never done PHP interactively on the CL so I'm not familiar with getting user input.
  10. If you're using the mail() command, it's just the 4th parameter: http://us2.php.net/manual/en/function.mail.php
  11. I usually generate a random password by just putting together a random string of characters, or using a substr() of md5(uniqid(rand())) for the new password. Then just set the password to this new value (obviously the hash of it) and send them the new password in an e-mail.
  12. Most of the time you'll see a spash page on sites asking the visitor to choose their location. You can store their selection in a cookie and use that for future visits. You might try doing something with GeoIP, I have no idea how well that would work.
  13. The "Duplicate Entry" error means that you are performing an insert but the field 'usr' is defined with a unique (or primary) index, and the value 'SamJ' already exists in the table. Might change your die() to die("mysql error on statement ".$statement." - ".mysql_error()) to see what the query is that's dying.
  14. So you're copying the existing value of a1 into b1 and so forth for each row? I think this may be what you are looking for: update table set b1 = a1, b2 = a2, b3 = a3, b4 = a4 where store_id = '$value'
  15. I usually approach this type of a query by doing "select *" instead of "select count(*)" and get my joins worked out. Using "select *" in phpMyAdmin gives me the ability to see what rows are duplicates and usually clues me in to any missing WHERE conditions. Once that query returns the rows you want to count, change "select *" to "select count(*)". if your tables have appropriate keys linking them together you shouldn't have any problem doing that in one query. Most likely there's something wrong in your WHERE clause to join the two tables together.
  16. If your table structure is the same you should be able to: $insert = "INSERT INTO temp_wild SELECT * FROM pokemon_data WHERE pokemon_name = '$pkfind'" $result = mysql_query($insert) or die(mysql_error());
  17. So you want the same row ('a') returned three times and then the 4th row ('c') returned once? No, you can't do that, unless you are joining it against another table. What are you trying to accomplish?
  18. If I'm understanding you correctly, what you'll need to do is build an interface to perform the searches, and then apply some login code and possibly a separate database to track a user's usage of the system. What I think you're wanting to do is not exactly trivial, you're going to have to break it down into pieces and get up to speed on each of the elements required to do this. Some that come to mind.
  19. The foreign keys do not auto-increment. You have to enter the data into the first table, and then get the ID (that was created via autoincrement) using mysql_insert_id(). Then use that to insert into the table that contains the foreign key. So, in your case, you would insert into the user table and use mysql_insert_id() to get the user_id you just created. Then you'll use that to set the value of user_id in the insert statement to the contact and/or bill tables. If the user already exists, you look up that user and get the user_id, and again use that to insert into the other tables. The foreign key relations don't do that for you (the engine would have no way of knowing what record you want to link); the relations merely prevent you from having an invalid link and other automated management once the link exists.
  20. Mysql isn't case sensitive, regardless of whether you use = or LIKE. You actually have to use WHERE 'BINARY' to get it to look at case. Huh, sure enough - for some reason I have always thought that.
  21. Hm, can you find the threshold where it breaks? I.e, does it work with a 3MB file but not with a 4MB file? Try a var_dump($_FILES) on the submission form script to see if you get any clues.
  22. You can do that with a simple switch statement if it's that trivial, just assign $region from the logged in user's info: switch($region) { case 1: // Draw the buttons for region 1 break; case 2: // Draw the buttons for region 2 break; }
×
×
  • 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.