Jump to content

cyberRobot

Moderators
  • Posts

    3,145
  • Joined

  • Last visited

  • Days Won

    37

Everything posted by cyberRobot

  1. Are you getting the information from a MySQL database? If so, you could indicate an offset and the number of rows you want in the LIMIT clause. More information can be found here: http://dev.mysql.com/doc/refman/5.7/en/select.html Of course, you would need to figure out what that offset should be. You could determine that using the number of results per page (3000) and a variable that indicates which page the user is on...assuming that you are talking about a pagination script.
  2. Note that the above string contains a variable. If you enclose the string within single quotes, the variable will not work.
  3. To get the first element in an array, you could use array_shift(). More information can be found here: http://php.net/manual/en/function.array-shift.php With that, you probably don't need the foreach loop. But I'm not sure if that solves the second part of your question.
  4. It looks like you are binding the parameters before preparing the statement. Try changing this $statement->bindparam(":mail",$email); $statement->bindparam(":uname",$username); $statement = $this->Db->prepare("UPDATE users SET userEmail=:mail WHERE UzRI=:uname"); To this $statement = $this->Db->prepare("UPDATE users SET userEmail=:mail WHERE UzRI=:uname"); $statement->bindparam(":mail",$email); $statement->bindparam(":uname",$username);
  5. Depending where the mileage comes from, you will want to make sure you are dealing with numbers...as suggested by Psycho in Reply #2. The ctype_digit() function can help with that. http://php.net/manual/en/function.ctype-digit.php
  6. I was wondering that myself. Apparently there was a 6, but they ended up going a different direction. More information can be found here: https://wiki.php.net/rfc/php6
  7. You're missing a few quotes around the values. Try this: $sql = "INSERT INTO permohonan VALUES ( NULL, '$Jabatan', '$unit', '$lain2', '$nama_pemohon', '$destinasi', '$tujuan', '$maklumat_', '$datedepart_', '$timedepart_', '$datearrive_', '$timearrive_' )"; $query1 = mysql_query($sql);
  8. Side note: the original post was made nearly two years ago...and the OP hasn't been back since.
  9. You would use a class property. More information can be found here: http://php.net/manual/en/language.oop5.properties.php
  10. Ah...that's a much better interpretation then mine.
  11. Perhaps I misunderstood the question, but search engines don't see the PHP code. They just see the HTML output.
  12. Does the regular search box work as you want it to? In other words, if you type the letter A in the search box, does it return the artists that start with A. Or do you get a list like: Alice in Chains Aerosmith Jane's Addiction ...
  13. As far as I can tell, that isn't the code which performs the search. I imagine that the code is found within the InputText() function. Or maybe the actual search happens within PHP and then the page gets re-displayed. It's difficult to know what's happening with what has been shown so far.
  14. So are you looking for help modifying your search code? If so, what does the search code look like now?
  15. You could try adding something like this: nav ul ul li:first-child { padding-top:10px; }
  16. The OP is using the required attribute. <select id='JOBFINISH1a' name='JOBFINISH1a' required> @EricOnAdventure - Have you looked into adding/removing the attribute dynamically. Perhaps you could use these: http://api.jquery.com/prop/ https://api.jquery.com/removeProp/
  17. Ahh...the error is likely coming from lines like this: $rs_result = mysqli_query($con,"SELECT COUNT(product_id) FROM products WHERE category=$recordID") or trigger_error("Query Failed! SQL: $con - Error: ".mysqli_error(), E_USER_ERROR); In the call to trigger_error(), you are trying to display $con which is an object. Objects cannot be outputted this way. However, I imagine that you actually want to output the query which caused the error. To do that, you'll need to modify the code. You could do something like this: $query = "SELECT COUNT(product_id) FROM products WHERE category=$recordID"; $rs_result = mysqli_query($con, $query) or trigger_error("Query Failed! SQL: $query - Error: ".mysqli_error(), E_USER_ERROR); Once you get the script working, you'll want to do something else with the error, such as logging it. Otherwise, you provide too much information to the bad guy. And you will want to look into protecting your queries from SQL injection attacks. The $recordID variable, for example, can be tampered with by a user since it comes from a GET variable. The value needs to be escaped before using it in a query. More information can be found here: http://php.net/manual/en/mysqli.real-escape-string.php And/or here: http://php.net/manual/en/mysqli.quickstart.prepared-statements.php
  18. What the line number does the error occur on? Did you try running a search on your the code for "mysql_"? You could also tell PHP to show all errors and warnings. If you add the following to the top of your script, PHP should show deprecated warnings for any calls to mysql_* functions. error_reporting(E_ALL); ini_set('display_errors', 1); Side note: You'll want to avoid outputting the raw value of PHP_SELF to the screen. Lines like the following open your page up to XSS attacks: echo "<span class='rest'><a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> </span>"; For what it's worth, the above line could be replaced with the following: echo "<span class='rest'><a href='?currentpage=$x'>$x</a> </span>";
  19. The topic has been marked solved. For future reference, the "Mark Solved" button is in the lower-right corner of each post within the topic.
  20. Is the "id" column set to auto increment? If so, you could leave it out of the query. INSERT INTO `sportsapp`.`exercises` (`image_path`, `name`, `category`) VALUES ('exercises/biceps/barbell_curls_lying_against_an_incline.jpg', 'Barbell Curls Lying Against An Incline', 'Biceps'), ('exercises/biceps/cable_hammer_curls_-_rope_attachment', 'Cable hammer Curls - Rope Attachment', 'Biceps');
  21. Yay!
  22. I'm glad you figured it out. Note that I marked the topic as solved. If you need anything else, you can start a new topic...or mark this one as unsolved (if it's directly related).
  23. Does $wpdb->get_row() return a string...or some other type of variable like an array or object? What is the exact output of var_dump($image); It should look something like this, if it's a string: string(40) "http://somewebsite.com/images/image1.jpg" Also, is PHP set to display all errors and warnings? Note that you can add the following to the top of your script during the debugging process: <?php error_reporting(E_ALL); ini_set('display_errors', 1); ?>
  24. I just added the $image variable to test the code. What does your current code look like? Note that you'll want to make sure that strrchr() isn't being called twice and the $image variable isn't enclosed with single quotes. Could you also post the line that defines $image?
  25. For what it's worth, this worked for me: <?php var_dump(substr(strrchr('http://somewebsite.com/images/image1.jpg', '/'), 1)); $image = 'http://somewebsite.com/images/image1.jpg'; var_dump($image); var_dump(substr(strrchr($image,'/'),1)); ?>
×
×
  • 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.