Jump to content

Deepzone

Members
  • Posts

    23
  • Joined

  • Last visited

Deepzone's Achievements

Member

Member (2/5)

0

Reputation

  1. I debugged it and found the slash was generated by real_escape_string function. I use this function to sanitize the capture to prevent sql injection. So shall I use the stripslashes after this function? But then if user does need to input a slash, what do I do?
  2. Can anyone tell me how to prevent a slash from auto-generated when inserting a string that has a apostophe. Example can't become can\'t. Thanks,
  3. I'm trying to use ajax to show upload progress bar. I downloaded a plugin and created a single php file and it works fine. However it doesn't work if the code is being included by another php file. Does anybody have an idea what the problem might be? Thanks.
  4. I have the following code the lookup data from a database. It runs okay on my llocal machine but it give me "Fatal error: Allowed memory size of 33554432 bytes exhausted" whenit runs on hosting server. It indicates fatal error at line of $r[field3]); I googled the error and found the response for similar situation is to re-code to prevent memory leak. Can anyone point out how the following can be improve to prevent the error from happening. Thanks a lot. $stmt = $database_connection->stmt_init(); if ($stmt->prepare("SELECT keyA, field1, field2, field3 FROM tableA JOIN tableB ON tableA.field1 = tableB.keyB JOIN tableC ON tableA.field2 = tableC.keyC WHERE field3 LIKE ?")) { $stmt->bind_param('s', $likeString); $stmt->bind_result($r['keyA'], $r['field1'], $r['field2'], $r['field3']); if (!$stmt->execute()) { echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error; exit(); } while($stmt->fetch()){ foreach( $r as $key=>$value ) { $row_tmb[ $key ] = $value; } $r[] = $row_tmb; } return $r;
  5. Hi there, I have a PHP site development on Windows XP. I'm currently using XAMPP 1.8.1 php 5.4.7. I tried to install APC to php extension but either getting message and system hung. Can anyone tell if this is possible and which version should I download? Thanks a lot.
  6. Hi there, I use ACTION="xxx.php" in form tag to move to another page. Is it possible, in php, for me to remain on the same page if error occur else then post to xxx.php page? Thanks.
  7. Hi my php is coded to handle two situations. One is to show all records without a parm and the other is to narrow down the number of records if parm is supplied. My problem is not able to clear the content of the $_GET after the page is rendered. So everything there is a postback, it still picks up the value in $_GET to. I googled the solution and people said use unset but it doesn't seem to be working. Can anyone help
  8. Is this the only way? What happened if javascript is disabled?
  9. Hi there, Is it possible to do a postback (without click on a button) as soon as user selected a value from a dropdown list? Thanks.
  10. Is that right? ... I've posted somehow to ask if mysql and mysqli can co-exist but most people said no. As I'm new in both, I greatly count on support from such forum. Thanks a lot.
  11. Sorry, I don't get it. Whats that mean?
  12. Thank you. That's the problem.
  13. How am I be able to get the errors?
  14. I have the following to update database but somehow it is doing so. Anyone has an idea? I added break point inside this function to check the parms passed in and they are correct. function edit_book($book_id, $book_title) { $conn = mysqli_connect('localhost', 'user', 'pwd', 'db') or die('Could Not Connect' . mysql_error()); $book_id = (int)$book_id; $book_title = $conn->real_escape_string($book_title); $stmt = $conn->stmt_init(); //***************** Break point - examine the value of book_id and book_title if ($stmt->prepare("UPDATE book SET book_title=? WHERE book_id=?")) { $stmt->bind_param('si', $parm_book_id, $parm_book_title); $parm_book_id = $book_id; $parm_book_title = $book_title; $stmt->execute(); $stmt->close(); } mysqli_close($conn); }
×
×
  • 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.