Jump to content

jazzman1

Staff Alumni
  • Posts

    2,713
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by jazzman1

  1. Start coding the script from scratch. There are so many errors, I hardly could count them.
  2. Everything in your script is a little mess. You want to be something like this: $arr_title = array("Colours","Values","Test","Something else"); $arr_opt = array("Black","76",'',"something else"); $arr_res = array_combine($arr_title, $arr_opt); foreach ($arr_res as $key => $value) { if($value == ''){ // skip empty values continue; } echo "Title: ".$key."\n"."Value: ".$value.'<br />'; }
  3. Kill me with something heavy. I was forget to put the php open tags in my bash file Everything is fine, I got a result. Nice response.
  4. Ok, I'm doing something wrong. I am going to post a result later
  5. B/s I've created a bash file and put the script inside it, but I cannot execute the script from php command line. See what I've done: #!/usr/bin/php5 echo shell_exec(curl -s 'http://forums.phpfreaks.com/index.php?topic=364198.0' | grep 'description' | awk -F 'content="' '{print $2}' | awk -F '"' '{print $1}'); // php command line php -f shell_exec.php // echo shell_exec(curl -s 'http://forums.phpfreaks.com/index.php?topic=364198.0' | grep 'description' | awk -F 'content="' '{print $2}' | awk -F '"' '{print $1}') PS. There is something wrong
  6. @Mahngiel, have you ever tried to execute the scripts?
  7. Yes, it should be much better. I belong to old generation
  8. I think, the sql logic in that case could be this : $query = "SELECT `q`.`poll_question` FROM `poll_questions` as `q` WHERE `q`.`ID_poll` NOT IN (SELECT `a`.`poll_answers.ID` FROM `poll_answers` AS `a` WHERE `a`.`respondent_id` = 2)"; Tip: The integer 2 comming from $_SESSION['resp_id']. Give back the result, please.
  9. In addition, check for overhead values, if so "OPTIMIZE TABLE(s)" . OPTIMIZE TABLE `tbl_name`
  10. WHERE taskid = 'taskid' to be WHERE taskid = $taskid
  11. Ok, the question is, now to convert 0.123 to number -.123? PS, Pika good spotting my friend
  12. Hm.....you are right $num = -.123; var_dump($num);
  13. Maybe in China is a valid number
  14. The easiest way is to use RegEx to exclude any links that are in quotes.
  15. I don't know who is wrong and who is not. I just said that this is invalid number - -.124 If the OP wants to return a string from number, why should defined $num = 0.124 as decimal, does not make any sense for me, right?
  16. @Christian, the problem is that's invalide integer. See your example: $num = 0.123; if (preg_match ('/(\\-?)0(\\.\\d+)/', $num, $matches)) { $num = $matches[1].$matches[2]; } var_dump(intval('-'.$num));
  17. I'm thinking, that could be easily done, but you need to put a dot between it. Create a new variable as string and add it a dot symbol. I don't have too much ideas about it // negative number $num = 0.124; print intval('-'.strval($num*1000)); // prints -124
  18. It should be worked, i use this
  19. I don't know,it's the best way to solve this issue, but I found one few months ago. Check out in php.net, there are lots of examples... $num = 0.123; print intval(strval($num*1000)); // prints 123
  20. I'll give you the correct table, but.... you have to know that I don't like this You have to learn every day, step by step. You don't need to use extract() in this particular case. /* Create a table to hold the data */ echo "<table width='1024' border='0' align='center' cellpadding='25' cellspacing='0' class='main_bdr'>"; echo "<tr><th>ID</th><th>Name</th><th>Cat</th><th>Description</th><th>Price</th><th>Pix</th></tr>"; /*Run a loop to retrieve all rows from the database */ while ($rows = mysqli_fetch_assoc($result)) { /* Extract all rows of data from the result */ //extract($rows); echo "<tr>"; echo "<td> {$rows['Id']}</td> <td> {$rows['Name']}</td> <td> {$rows['Cat']}</td> <td> {$rows['Description']}</td> <td> {$rows['Price']}</td> <td width='150' align='center'><img src='{$rows['Pix']}' width='150' height='150' /></td> "; echo "</tr>"; } echo "</table>";
  21. You don't know how to display this result in html table, is it your problem ?
  22. Okay, now get rid off exit; from my code, and post the result, again.
  23. Why did you loop the same row 4 times ? Put this piece of code immediately after extract($rows); echo '<pre>'.print_r($rows, true).'</pre>'; exit; Post the result, please. /* Extract all rows of data from the result */ extract($rows); echo '<pre>'.print_r($rows, true).'</pre>'; exit;
  24. I'm not sure why you'd want to do this, but.... anyway, this could be work if the id table is auto_increment. Check this out -> http://stackoverflow.com/questions/740358/mysql-reorder-reset-auto-increment-primary-key SET @count = 0; UPDATE `tbl_name` SET `tbl_name`.`id` = @count:= @count + 1;
  25. First of all, I have to admit that your expressions about the answers given from you, there are very impressive - I like this. I've seen lots of English people in this forum, which don't express themselves very well in a proper English. The computer's language is named English as medicine's language named Latin. That's why, all computer languages named computer languages, not for example computer typing. Secondly, that's the power of the forum, me or someone wrote something wrong and others members correct or give him a better solution. I've supported one site wrote in PHP 4.3, there are lots of old-school server side scripts inside of it. If I have to redesign it, i need to write everything from scratch
×
×
  • 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.