Jump to content

taquitosensei

Members
  • Content Count

    675
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by taquitosensei

  1. a boolean is 1 or 0, true or false. Usually a column labelled as "unread" would be a boolean telling you whether it had been read or not. If it's supposed to hold the user's id, you should rename it. But after looking at your table here is what the query should look like. $stmt = $this->db->prepare("SELECT unread FROM pm WHERE unread=1 and receiver_id=:id") This would get all of the results that were sent to your user that have not been read. You don't need the bind_result line. I believe that's a mysqli function and not needed with pdo.
  2. What does the unread table look like. You only need to bind when you're putting user submitted data in your query. You don't have to do that with unread=1. Also unread shouldn't ever equal an id, because it's probably a boolean. Your query should probably look more like this if($stmt = $this->db->prepare("SELECT unread FROM pm WHERE unread=1 and id_field=:id")) { $stmt->bindParam(':id', $id, PDO::PARAM_INT); }
  3. The PR_END_OF_FILE_ERROR is either an issue with the format of your certificate or you might have an older version of nss.
  4. You would need to involve javascript. You could do this almost all in javascript then do an ajax call to send the data to php. Here's a guide that shows how to listen for sound and make a reactive page. It should give you an idea of how to start. https://hackernoon.com/creative-coding-using-the-microphone-to-make-sound-reactive-art-part1-164fd3d972f3
  5. You don't need to decode. Store the users info in your database. Pre-fill the form. Let them change the info. Then generate a new QRCode and update your database.
  6. $dt4->add($dif); I think that gives the result expected. Not sure why. 2019-07-15 12:30:00 | 2019-07-17 14:15:30 | 0 0 2 1 45 30<br>2019-08-17 01:45:30 | 2019-08-19 03:31:00 | 0 0 2 1 45 30<br>
  7. Need more info. What is it supposed to do, what is it not doing. I 2nd foreach. $files = array("file1.php","file2.php","file3.php"); foreach($files as $file) { include($file); }
  8. there is something wrong with $query->wheres, it's not countable. So it's not an array or not an object. Do var_dump($query->wheres); after the $query = to find out what it is and what it does contain.
  9. I usually echo at the end of the script instead of in the loop and also send 200 http response. $result = $page->read($_GET['pageid']); //check for data if ($result) { //page array $page_arr['pages'] = array(); while ($row =$result->fetch(PDO::FETCH_ASSOC)) { extract($row); $page_item = array( 'id'=> $id, 'title' => $title, 'pageid' => $pageid, 'pagecontent' =>html_entity_decode($pagecontent), 'mdkeywords' => $mdkeywords, 'description' =>$description, 'date_added' =>$date_added, 'hasAudio' => $hasAudio, 'excludeSearch' =>$excludeSearch ); //push to data array_push($page_arr['pages'], $page_item); } http_response_code(200); } else { $page_arr['message']="Nothing Here!!!"; } echo json_encode($page_arr);
  10. I didn't even think about using the max function. $numbers = array(1,3,7,8,10,12); foreach($numbers as $number) { if($number%2==0) { $evens[]=$number; } } $max_number = max($evens); echo $max_number;
  11. $numbers = array(1,3,7,8,10,12); foreach($numbers as $number) { if($number%2==0) { if($number > $old_number) { $max_number = $number; } $old_number = $number; } } echo $max_number; Not sure what nodejs has to do with anything. This is a php forum. Something like this would do it in php.
  12. If you're not seeing the results you expect in console. I use postman for troubleshooting. You can put in the URL and the post data in json format, and run it to see what the result actually is. You could have an error in my_cart.php. You could be outputting something along with your json. Your json may not be formatted properly. I would add this ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); to the beginning of my_cart.php and either view the results in development tools or download postman and try it that way.
  13. A white screen could be a fatal error. I would turn on error reporting put ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); at the top of your index.php, if it is a fatal error, the error should display instead of the white screen.
  14. When you use the $row variable in your form action you're not in the $row loop yet and that wouldn't make sense anyways because you'd be creating your form repeatedly, as many times as there are results in your query. Also selecting an option with the value of the URL you want to be redirected to won't work. The value would just get passed with the other form data. For this to work you would need javascript to get the url from the selected option and redirect you.
  15. Just curious would this be any more efficient? SELECT entry_id, votes FROM entries group by entry_id order by votes ASC
  16. Along with everything else. You need to echo a properly formatted json string. echo "{'message':'correct'}"; then if(data.message === 'correct')
  17. So you want tracking information but want it refreshed on a regular basis? Is it always shipped through the same shipping company? ie FedEx, UPS, etc? If not you'll have to come up with a solution for each tracking company. Just deal with pulling tracking information first, then worry about refreshing it. So you have to pull the shipping provider and tracking # out of your database, then based on the shipping provider use an api to get the tracking info, then parse that info and display it.
  18. Try this. <form id="main-search-form" method="POST" action="<?= $baseurl; ?>/_searchresults.php" role="search"> <select id="query-input" name="city_id" style="width:28.8%" style="height:69px" required> <option value="">Select Area</option> <option value="3,1">Ches & VB</option> <option value="3">Chesapeake , VA</option> <option value="9">Hampton , VA</option> <option value="10">Newport News , VA</option> <option value="2">Norfolk , VA</option> <option value="12">Poquoson , VA</option> <option value="4">Portsmouth , VA</option> <option value="5">Suffolk , VA</option> <option value="1">Virginia Beach , VA</option> <option value="11">Williamsburg , VA</option> <option value="0">All Active US Cities</option> </select> then if($_SERVER['REQUEST_METHOD'] == 'POST'){ if(isset($_POST['city_id']) && $_POST['city_id']!="") { $city_ids=explode(",", $_POST['city_id']); $query = "SELECT city_name, state FROM cities"; switch($_POST['city_id']) { case 0: Default: $query.=" WHERE city_id IN (:" . implode(',:',$city_ids) . ")"; } $stmt = $conn->prepare($query); foreach($city_ids as $city_id) { $stmt->bindValue(":query_city_id",$city_id); } $stmt->execute(); $cities = $stmt->fetchAll(PDO::FETCH_ASSOC); foreach($cities as $city) { } } } Haven't tested it. But something like this.
  19. If your domain's reverse lookup isn't setup correctly that could cause this. If the spf records aren't configured correctly. If the return address isn't a valid e-mail, ie you haven't created it yet on your mail server. It could be any of those and more. E-Mail is very finicky.
  20. I had a boss who had an 80/20 rule. Program for the 80%. He would have told me not to worry about people with their cookies disabled. Make sure it works for everyone else.
  21. I would personally go for #2 I don't know if it's safer. I just like the idea of setting a flag then using that flag.
  22. I just tried the syntax and it works. Have you tried it? Without knowing where $ARR and $NEEDLE come from and what they look like. It's hard to know what the problem is.
  23. $counter = 0; while ($row = fgetcsv($fp)) { if ($counter > 9) { $stmt->execute(array_slice($row,3)); } $c++; }
×
×
  • 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.