Jump to content

Ch0cu3r

Staff Alumni
  • Posts

    3,404
  • Joined

  • Last visited

  • Days Won

    55

Everything posted by Ch0cu3r

  1. Why are you passing the array to utf8_encode? It expects a string not an array.
  2. You have a ` (angled quote) before the $Method_Of_Travel variable in your query too. That should be a straight quote
  3. Your query is fine. The problem is with the use of $offset which is defined here $offset = ($page - 1) * $limit; Here it takes away one from $page and then multiplies that by $limit (which is 10). Problem is if no page has been requested $page will be 0. This will cause ($page - 1) to return -1 and then that is multiplied by $limit (which is 10). This will result in $offset being set to -10 and that is the cause of the error You only want to calculate the offset if $page is not 0. $offset = 0; // default offset value // if $page greater than zero, calculate the offset if($page > 0) $offset = ($page - 1) * $limit;
  4. Ok now I am confused... Why are you returning the usernames and passwords? I though you wanted to return the latest phone calls? The reason why you are only getting the last result is because you are redefining the $userArray within your while loop. What you need to do is add [] (square brackets) to the end of the variable to add each row to the array. This will cause $userArray to contain a multidimensional array containing your data from your query. In your javascript when you have parsed the json, You would use jquery's $.each method to loop over the data.
  5. What do you mean by update?
  6. Line 51 should be (name starts with a capital letter) echo $tag->tagName; Variable/property names are case sensitive
  7. Ugh? Could you please take the time to explain what is you are trying to do.
  8. You are getting that notice because there is no variable defined called $user. You do have a variable called $_user though
  9. No... The code given by Psycho uses PDO for interacting with the database. You are using MySQLi, so you cant just copy and paste the code and expect it to work. What you need to do now is change it so it queries the database using mysqli Basically what the code is doing is querying the Countries table returning the CID and Country fields. It loops over the results and populates an array, using the CID field as the key and the Country field as the value. Once array has been populated it is passed to the buildSelectOptions() function which will then generate the <option>'s for the dropdown menu.
  10. Maybe use a word boundary? /\b(cc|creative commons|copyright|by|sa|nc|nd)\b/i
  11. Are you sure that is the exact string stored in $exifmeta['copyright'] What does var_dump($exifmeta['copyright']) show?
  12. What does your clean url look like? Your rewriteRule will match the following url site.com/newsid/identifier Also make sure you have added RewriteEngine On before any Rewrite directives.
  13. Could you post example json data
  14. Why is that? Maybe wrap $ul in curly braces? Are generating css dynamically? Maybe you should look at SASS.
  15. Use parse_url to get the query string. Then use parse_str to get the cid parameter $query_string = parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY); parse_str($query_string, $param); echo $param['cid']; // return cid value
  16. You need to debug your script. Basic way to do this is to echo something out at various stages in your script to see where it is failing. Example echo 'Check if $_POST[\'progress\'] is not empty... '; if (!empty($_POST['progress'])) { echo 'TRUE<br />'; echo 'Check Input::exists()...'; if(Input::exists()) { echo "TRUE<br />"; echo 'Check Token::check(Input::get(\'token\')) passes...'; if(Token::check(Input::get('token'))) { echo "TRUE<br />"; $adminprogress = Input::get('admin'); $adminidprogress = Input::get('adminid'); $memberprogress = Input::get('member'); $projectprogress = Input::get('project'); $statusprogress = Input::get('status'); $timestamp = date('Y-m-d H:i:s'); $data = array( 'admin' => $adminprogress, 'adminid' => $adminidprogress, 'member' => $memberprogress, 'project' => $projectprogress, 'status' => $statusprogress, 'timestamp' => $timestamp ); echo "Values passed to the database"; printf('<pre>%s</pre>', print_r($data, 1)); $progressupdate = DB::getInstance()->insert(progress, $data); echo "Query inserted data into the progress table... " . ($progressupdate ? 'TRUE' : 'FALSE'); // for debug purposes only the following lines has been commented. //Redirect::to('memberattire1.php'); } } else { echo "FALSE"; } } else { echo "FALSE"; }
  17. The data is not stored in the session cookie. The cookie only contains the session id. PHP uses this to fetch the data from the session. All data stored in a session is stored on the server in the file system To remove the user_id from the session you need to unset it from $_SESSION unset($_SESSION['user_id']); // removes user_id from session If you delete the actual session cookie, then all data in the session will be destroyed.
  18. You are already passing the indexes to the getCardValues function when you are calling it. So what purpose does this function serve?.
  19. On line 6 add a semi-colon at the end of the line echo "<p>My name is $myname</p>"; Remember all statements must end with a semi-colon.
  20. Yes you can use an image as a submit button.
  21. Decode what? It would be nice if you actually took the time to explain what is you are wanting to do.
  22. @Noxin the original code you posted in line 1 was fine the problem was with the word and on line 3. All you needed to was remove that word and this would of solved the error. and is a logical operator they should only be in control structures, ie when comparing values
  23. On top of what was said above you cant place PHP code with a heredoc statement. Before the for loop you will need to close the heredoc statement and then inside the for loop you can concatenate the string to the $output variable using the concatenation assignment operator .= Example $output = <<<_HTML ... HTML; // close heredoc statement // start for loop for( ... ) { // concatenate html to $output $output .= <<<_HTML <tr> ... html for row ... </tr> HTML; } $output .= <<<_HTML ... rest of html for the page ... _HTML_; Now you may find you'll get the same error after you have done what has been suggested. This is because the getCardValues() function is returning an array. PHP wont know what you want to do with that. What should be returned from that function?
  24. You could use simpleHTMLDom to modfiy the HTML Example code require 'simple_html_dom.php'; $html = <<<HTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> Hello world </body> </html> HTML; $dom = new simple_html_dom(); // load html dom $dom->load($html); // get the body element $body = $dom->find('body',0); // wrap contents of the body in a div element with the class of container $body->innertext = '<div class="container">' . $body->innertext . '</div>'; // return the new html structure $html = $dom->save();
  25. You will be better of with a JOIN SELECT ud.User_club_ID, ud.fname, ud.lname, ud.email, ud.club_No c.CLUBCODE, c.club_id FROM user_details AS ud JOIN club AS c ON ud.club_No = c.CLUBCODE WHERE c.club_id = ? AND ud.user_status = ?";
×
×
  • 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.