Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. DOH! I didn't read your query properly. INSERT statements do not have a WHERE clause. Are you inserting a new record or are you wanting to update an existing record? For updating existing records you should use an UPDATE query.
  2. No, but to see if your query is failing due to an error use mysql_error.
  3. To move the decimal place by one multiply by 10 echo (309 / 397) * 10; 7.78% is not smaller than 0.778%
  4. Need to see more code than that. Where is you form?
  5. Change $newArray = to $newArray[] = You will also want to add $newArray = array(); before the for loop
  6. You have an extra ( at the start of your statement
  7. The use of isset is incorrect here if (isset($_POST['regname']) | $_POST['regstate'] | $_POST['regcity'] | $_POST['regemail'] | $_POST['username'] | $_POST['password'] | $_POST['confirmpass'])) You should read up on the proper use of isset. Your not listing your variables properly, you should separate each variable with a coma not a pipe character. Also statements which span multiple lines must be wrapped in curly braces {}. Read up on the use of if
  8. You have an extra comma at the end of your query Remove that and the error will be resolved. However you should not place raw _POST data into your query, as you'll be prone to SQL injection attacks. You should pass your _POST variables through to mysql_real_escape_string to help prevent such attacks.
  9. What was the full error? There is nothing wrong with the first three lines of PHP code that you said was causing an error. However this is in correct syntax. You should place a semi-colon after the if. if (!$con); That will cause an error or a blank screen. I think the error you saw was a MySQL error not a PHP error. Remove the semi colon from the if statement and post the error message you get in full.
  10. You're not processing your query correctly. When processing MySQL queries you need to pass them to the mysql_query function first. You'd then pass the result to one of the mysql_fetch_* functions, eg mysql_fetch_assoc
  11. Use > instead of > and < instead of <
  12. To get your results from your query you need to use ond of the mysql_fetch_* functions, such as mysql_fetch_assoc. This function will return each row as an associative array $query = "SELECT SUM(total) FROM account"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { echo $row['SUM(total)']; }
  13. Something must of changed with the configuration of your HTTP server. How have you configured your HTTP server with PHP?
  14. If you're using MySQL database then you can calculate this within your query using the MySQL SUM() function, example usage can be found here
  15. PHP cannot identify forms by their ids. You'll want to give your submit buttons unique names, for example name your submit buttons like form1_submit, form2_submit etc. Now to see which form has been submitted use if(isset($_POST['form1_submit'])) { // code for form1 here } elseif(isset($_POST['form2_submit'])) { // code for form2 here } etc
  16. You can use strtotime to convert your mysql timestamp into a unix timestamp. Using the unix timstamp you can pass this into the secound parameter for the date function to reformatted your date. Example $mysqlTimestamp = '2010-01-19 17:01:11'; $unixTimestamp = strtotime($mysqlTimestamp); echo date('l jS Y h:i:s a', $unixTimestamp);
  17. You don't use $_GET, you use the actual variable name $id To learn more about include read up on the manual http://php.net/manual/en/function.include.php
  18. Have a read of this article http://www.phpfreaks.com/tutorial/working-with-dates-in-php
  19. Correct way is if ($_SESSION['trackBrowsing'] != "value01" || $_SESSION['trackBrowsing'] != "value02"){
  20. Move this block of code function parseString( $start, $end, $string ) { $before = explode( $start, $string ); $return = explode( $end, $before[1] ); return $return[0]; } Outside of your function_name() function declaration
  21. You need to be setting the content type header("Content-type: image/png"); On the first line of head.php and body.php You'd display your images like so <?php echo"<img src='head.php' /> <br /> <img src='body.php' />"; ?>
  22. You could just use exec with the following command, eg exec('cp -r /path/to/xxx/folder /path/to/zzz/folder') However the above will only work for *nix based systems. Alternatively you can create a recursive function, such as the one posted in the user submitted comments for the copy function.
  23. You'll want to use $votes = $userinfo['votes']; after this line $userinfo = mysql_fetch_array($result); //put friends row into an array $userinfo
  24. I cant tell from just those two snippets. Where is the variable $votes originally defined? Can I see more code. EDIT: Ignore
×
×
  • 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.