Jump to content

Pikachu2000

Staff Alumni
  • Posts

    11,377
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by Pikachu2000

  1. It may seem like more work, but separating the query string from the query execution all the time is worth the few extra seconds it takes to type it that way. It gives you more options when it comes to debugging.
  2. Where exactly are you having problems? Post the code you've tried and any errors that it generated.
  3. Just noticed that in your original query string, you have 19 fields specified, but are trying to insert 20 values. That won't work that way. As PFM suggested, get the query string out of the query execution sou you can echo it, and set it up to report errors. $query = "INSERT INTO automobile_stat (stock_number, model_year, make, model, miles, price, body_style, length, description, engine, doors, trans, gvw, int_color, ext_color, car_fax_owner, title_desc, main_picture_src, vin ) VALUES ('$stk', '$my', '$mak', '$mod', '$mil', '$pri', '$mpri', '$bst', '$len', '$desc', '$eng', '$dor', 'tra', '$gvw', '$inc', '$exc', '$cfo', '$titl', 'img', '$vin')"; $tresult = mysql_query($query) or die( 'Query string: ' . $query . '<br />Produced error: ' . mysql_error() . '<br />');
  4. Yes. Use file() to read the text file into an array,then use the array elements to populate the form fields. If it's only one field, you can use file_get_contents() to read the file into a string.
  5. There are different length limits for the URL string depending which browser you're using, so using $_GET may be the problem in this case.
  6. It's something you'd be better off using a third party application or API for. Let them have the liability of dealing with the credit card info.
  7. Try this path statement, then try using a filename without spaces in it. $target_path = $_SERVER['DOCUMENT_ROOT'] . "/file_uploads/";
  8. It appears to be attempting to move the file to a directory /file_uploads/ at the root of the disk. Is that the correct path?
  9. Then you need to list them all explicitly, which you should always do anyhow.
  10. Missing line terminating semicolon on previous line . . .
  11. You should be able to do it with exec() and touch, if it's a linux server.
  12. if( $_GET['do'] == 'login' ) { // do this } else { // do something else }
  13. There's nothing stopping the rest of the code from executing if the value is 0. Basically, it's working exactly as written. while($row2 = mysql_fetch_assoc($res2)){ $active = $row2['active'] } // only allow script to continue to login if $active != 0; if( $active == 0 ) { echo 'You haven\'t confirmed yourmembership, whatever, yada, yada'; } else { // continue login }
  14. Not tested, but try this. <?php include("include/session.php"); if( $_POST['submitted'] == 'true' ) { $subwebsite_name = mysql_real_escape_string(trim($_POST['subwebsite_name'])); if( !empty($subwebsite_name) ) { if( $database->updateUserField($session->username,"website_name",$subwebsite_name) ) { echo 'Query succeeded.'; } else { echo 'Query failed.'; } } } ?> <form name="form" method="post" action=""> <input name="subwebsite_name" type="text" value="<?php echo $subwebsite_name; ?>"> <input type="hidden" name="submitted" value="true" /> <input type="submit" name="button" id="button" value="Submit"> </form>
  15. MATCH (col1, col2) AGAINST ($keyword) should work fine as long as the index spans both columns.
  16. I'd have to look it up to be certain, but if I recall correctly, you'll need to establish a FULLTEXT index that spans both fields . . .
  17. Post all of the relevant code, and let's see what we can do here . . .
  18. This assigns the entire $_POST array to $subwebsite_name, which I'm sure is not what you want to do. $subwebsite_name = $_POST; Should be $subwebsite_name = $_POST['subwebsite_name'];
  19. And what part isn't working? What are the error messages you're getting?
  20. What errors are produced? $result = mysql_query($sql) or die( '<br />Query string: ' . $sql . '<br />Produced error: ' . mysql_error() . '<br />' );
  21. It would probably be easier if you'd say what kind of problem you're having, what errors are being produced, etc., but if it's what I suspect it is, get rid of the lazy quick echo syntax <?=$subwebsite_name;?> and use the proper tags [tt]<?php echo $subwebsite_name; ?>
  22. It's an abbreviation for boolean (TRUE/FALSE or 1/0). You can usually enter any term you aren't familiar with in the search box in the upper right of the manual page, and narrow things down a bit. It can be a little confusing for a beginner, but you'll find it easier as you progress.
  23. Read the manual for the mail() function, and it should be apparent what the problem is.
  24. If all you are doing is getting the number of entries, COUNT() is much more efficient. You should explicitly list the fields you want to select in the query, rather than use the * wildcard (unless you actually need the contents of every field). To debug DB query problems, you should be able to echo the query, and display any errors. You can 't echo the query when the query string is part of the query execution. Separate the two, and echo the query with any errors. $query = "SELECT COUNT(`pk_id_field`) FROM `customers` WHERE `sid` = '$sid' AND `month` = '$m' AND `year` = '$y'"' $result = mysql_query($query, $link) or die( '<br />Query string: ' . $query . <br />Produced error: ' . mysql_error() . '<br />'); $count = mysql_result($result); echo "$count";
  25. Sheesh. Everyone's fast tonight . . .
×
×
  • 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.