Jump to content

moselkady

Members
  • Posts

    131
  • Joined

  • Last visited

    Never

Everything posted by moselkady

  1. You should do it like this: $query = mysql_query("UPDATE websites SET exelent=exelent+1 WHERE url='$url'") or die(mysql_erro r());
  2. Try this one: $sql = "INSERT INTO i_usr VALUES (NULL, '$username, '$password, '$email', '$handle')";
  3. You need to do it all in one query. This example will nor work: DELETE FROM messages WHERE ID != 1; DELETE FROM messages WHERE ID != 2; The first query deletes all (including id 2) except id 1 then the second deletes id 1. I think you can modify your code to something like this: <?php foreach($_POST as $a => $b){ if(preg_match("/x/",$a) && $b == 'y'){ $ids[] = str_replace("x","",$a); } } $id = join(",", $ids); $note_query = $db->query("DELETE FROM `" . DBPREFIX . "messages` WHERE `ID` NOT IN (".$id.") AND `ReciverID` = '".$_SESSION['user_id']."' "); ?>
  4. Use explode to split the string into several array elements: <?php $string = "first, second, thid, fourth, fifth"; $array = explode(", ", $string); ?>
  5. One other thing, try to print $rename (or whatever you sql variable) in case you get an error to better figure out the problem.
  6. A small fix to ohdang888's solution: $rename = 'alter table Element_'.trim($title).' change '.$column_name.' '.$check_item.' varchar(50)';
  7. My understanding is that you cannot upload a file using AJAX and that the only way to upload a file is to submit a form that contains <input type='file'> field. This is the only way you php script will receive $_FILE variable. I may be wrong though
  8. You can try this: <?php $line = '[CISC26907] Digits are not heard properly over H.323'; echo ereg_replace(".*(\[CISC[0-9]+\]).*", "\\1", $line); ?>
  9. Try modifying your if statement: if (sizeof($lines) == 0){
  10. You can make a loop similar to this one: <?php $i = 1; while(true) { if (!isset($_POST["white_move_".$i])) break; // do whatever you'd like with $_POST["white_move_".$i] $i++; } ?>
  11. Could you post the output the you get and also the output that you want to see?
  12. Well, this is only possible if your HTML is generated by PHP. If you form is in regular HTML files, then I think you have to go with DarkWater's solution.
  13. Maybe you can add this hidden field: <input type='hidden' name='src_file' value='<?php echo $PHP_SELF?>'>
  14. I just clicked on both "you welcome" and "good luck" buttons
  15. I am not sure in what order AND and OR are evaluated in MySQL but it looks like your query is behaving like this: SELECT * FROM members WHERE (PHArea='$areaCode' OR MOArea='$areaCode' OR FXArea='$areaCode') AND PaidID!=' ' Try to use parenthesis to formulate the conditions you want.
  16. You can replace the string '\n' with the character "\n" <?php $replace = array("\r", "\n"); $order = array('\r', '\n'); $newstring = str_replace($order, $replace, $newstring); ?>
  17. The new-line character is escaped in $newstring due to mysql_real_escape_string(). Therefore $newstring doesn't have new-line character and nl2br($newstring) will return $newstring as it is. Try the un-escaped string: nl2br($string)
  18. You are using the variable $newstring in nl2br() and in your first str_replace(). $newstring is escaped and no longer has line-feed. You should use $string and $str instead: <?php print nl2br($string); .. .. $newstr = str_replace($order, $replace, $str); ?>
  19. Maybe you can try something like this: <?php // remove blank elements foreach ($result as $a) { if (!ereg("^[[:space:]]+$", $a)) $b[] = $a; } $b = array_chunk($b, 5); print_r($b); ?>
  20. My suggestion is to put echo statements inside the other include files (config.php and global.php) to able to determine where the code breaks, then print the variables in the statement that causes the break.
  21. It is possible that your problem is in 'user.php'. Maybe you can add couple of print statements at the beginning of that file and see if they show.
  22. Have you checked for errors after your mysql_query using mysql_error()? Maybe you can print the query as well
  23. You will still use mysql_fetch_array as you usually do except that you will use an index number instead of a field name <?php $result = mysql_fetch_array ($runqueries1); $count = $result[0]; ?>
  24. You can try this SQL SELECT job_id, reg_date, SUM(tender_price) AS price FROM (SELECT job_id, reg_date, tender_price FROM `tenders` LEFT JOIN jobs ON (jobs.id=tenders.job_id) WHERE jobs.status='won') AS p GROUP BY job_id
  25. Maybe array-count-values() could help you. See http://us3.php.net/manual/en/function.array-count-values.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.