Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About farse

  • Rank
  1. In PHP 5, I conventionally opened my pages with <?php but within the pages I often used <? to open a php block, e.g., <?echo $variable; ?>. In PHP 7, I find it is necessary to always use <?php and follow it with a space, e.g., <?php echo $variable; ?> I haven't been able to find any reference to this syntax change so my question: Is this a new requirement of PHP 7? Can it be turned off? Otherwise, I will need to edit all of the sites where my earlier habit was used, which I think I can do but would feel compelled to spend some hours testing afterward.
  2. This code is excerpted from a larger form for editing values saved in the database. It was written by someone else who is no longer available and I am stymied by its behavior. The conditions are: artPrice can be any integer; the query returns more than one row and all three “allow" functions return true. As indicated, artPrice = 0 means not for sale; artPrice = 1 means price on request and all other values represent dollar values. For the first row returned, expected behavior occurs. A price can be changed in value or changed to POR or NFS; POR can be changed to NFS and vice versa and ei
  3. Here's the answer I found elsewhere: // You were really close! I think the issue was that when you called // mysqli_stmt_get_result in the if() you didn't realize it was consuming the // data set up by the execute and thus your second call to it didn't get any // records. // you should assign into $result immediately and then test that in the if() if ( $result = mysqli_stmt_get_result($stmt) ) { $row = mysqli_fetch_array($result); $col1 = $row[0]; echo phpversion(); echo "<p>$col1</p>"; exit; } else { echo '<p>We got nothing<
  4. We know the code works through mysqli_stmt_execute because it works fine when mysqli_stmt_get_result is replace with: mysqli_stmt_bind_result($stmt, $col1); mysqli_stmt_fetch($stmt) echo "$col1\n"; exit;
  5. When I saw: Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /Applications/MAMP/htdocs/TEST/accountinsert.php on line 188 I realized I had not changed the ini file when I downloaded the latest MAMP a few days ago--and have done that. Still, the error message seems to mean that mysqli_stmt_get_result is not returning data. Also, I'm coding in TextWrangler which colors the PHP code pretty consistently and does not seem to recognize get_result as legitimate.
  6. I probably should have put all the code up initially but here it is--with late edits: $query = "SELECT col1 FROM contactinfo WHERE col2 = ? && col3 = ? && (col4 = ? || col5 = ?) "; $stmt = mysqli_prepare($connect, $query); mysqli_stmt_bind_param($stmt, "ssss", $var1, $var2, $var3, $var4); mysqli_stmt_execute($stmt); if (!mysqli_stmt_get_result($stmt)) { report the result in a user message } else { $result = mysqli_stmt_get_result($stmt); $row = mysqli_fetch_array($result); $newvar = $row[0]; echo "$newvar\n"; exit; } I'm not getting the user message and g
  7. Adding echo "$newvar\n"; exit; I get a blank page. PHP error_display is on and working but nothing from that.
  8. I want to convert an existing site to use prepared statements. This will be much easier if I can get the result of a SELECT query as an array to replace the array returned by mysqli_fetch_array. I am using PHP 5.4 with mysqlnd activated and should be able to use mysqli_stmt_get_result(stmt) to get such an array. But that function does not work and does not seem to be available at all. But all the documentation I'be read says it should be available in PHP 5.4. $query = "SELECT col1 FROM contactinfo WHERE col2 = ? && col3 = ? && (col4 = ? || col5 = ?) "; $stmt = mysqli_prepar
  9. I'm adopting HTML5 and decided trying to apply it in one of my existing sites would be a good way to learn how it behaves. I am attaching a file that behaves in a way that I am trying to understand. I have excised all irrelevant code. It is an interactive site written in php. As you will see if you open the page in a browser, the HTML5 section element seems to reduce the size of my text as opposed to div. I have played with this for several hours trying unsuccessfully to figure out what's going on. Can anyone offer a reason or even a hypothesis? Incidentally, if you exchange main and s
  10. Details, details! Thank you. That works nicely. If I could just learn one new thing everyday... Farse
  11. This is too simple but I can't find the answer. I want to send multiple error messages in separate paragraphs in an email sent with mail(). I want to avoid using html. Here's what I tried as a test to see how to make separate paragraphs: mail('email@address', 'System Error','The error(s) relate to a purchase.nnPlease review the PayPal emails and IPN history to determine the correct status of the artwork./n/nMake whatever corrections to the database are needed.', 'FROM: email@address' ); and here's what I get: The error(s) relate to a purchase.nn Please review the PayPal emails and
  12. I took my cue from what must have been an earlier list of acceptable values and from the server's default php.ini timezone, which displayed as "Denver" with no "America/" prefix. I will certainly try "America/New_York" and will be delighted with the new functions available in 5.3 when it works. (I'll be back if it doesn't work.) Thank you much.
  13. A search on date.timezone produced no results on this forum, but I have seen this topic discussed somewhere---now forgotten site. In trying to set up PHP 5.3 with a 5.3 php.ini file, I got the following error message: "Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Denver' for 'MST/-7.0/no DST' instead in /
  14. You are wise beyond your years, Old Man from scene 24Thank you.
  15. Is it possible to use a non-alphanumeric character as the $glue string in the implode() function?e.g., implode('\v',$array)I am trying to join strings in an array with a vertical tab using \v. It simply uses the v as the $glue string.I also tried \x0B and it used x0B.I went in circles in the PHP Manual and got mixed messages.??
  • Create New...