Jump to content

marcelobm

Members
  • Posts

    57
  • Joined

  • Last visited

Everything posted by marcelobm

  1. it seems like your query is not returning any rows, try to do this if(mysql_num_rows($query)){ $query_result = mysql_result($query,0); echo <<<OPT <meta http-equiv="REFRESH" content="0;url=http://www.mysite.com/view.php?id={$query_result}"> OPT; }else{ echo 'no records found'; }
  2. the query i posted will return all employees from a specific location that hasn't attended the specific course, but you can add SELECT table_1.* FROM table_1 LEFT JOIN table_2 ON table_1.emp_number = table_2.emp_number WHERE location = 'locaction' AND (course_title != 'title' OR course_title IS NULL); and that should give you what you are looking for.
  3. When you do // Update db for last login $id_mem = $_SESSION['id_mem']; // <<< SESSION member id has a value here because it's used in the redirect below $ip = $_SERVER['REMOTE_ADDR']; // Get ip address of person logging in $q = "UPDATE sn_members SET last_login = Now(), ip = '$ip' WHERE id_mem = '$id_mem' LIMIT 1"; $r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc)); it updates the database as expected? i mean if when you use $_SESSION['id_mem'] it returns the right value
  4. In this INSERT Statement you are passing 15 column names and only 11 column values, it must be the same $sql = mysql_query("INSERT INTO members (id, username, password, realname, phone, email, address, city, state, zip, country, accounttype, bio, resume, signupdate) VALUES('$username','$realname', '$address','$city','$state','$zip','$country','$accounttype','$email','$hashedPass', now())") or die (mysql_error()); for example INSERT INTO members (username, password, realname, phone, email, address, city, state, zip) VALUES ('$username', '$password', '$realname', '$phone', '$email', '$address', '$city', '$state', '$zip') Same number of parameters in the same order.
  5. try this $query_result = mysql_result($query,0); echo <<<OPT <meta http-equiv="REFRESH" content="0;url=http://www.mysite.com/view.php?id={$query_result}"> OPT;
  6. You can only use column aliases in GROUP BY, ORDER BY, or HAVING clauses
  7. probably this will work SELECT table_1.* FROM table_1 LEFT JOIN table_2 ON table_1.emp_number = table_2.emp_number WHERE location = 'locaction' AND course_title != 'title'; But anyways I think you should rethink the way your database is made.
  8. var uri = hash_value.split("/"); var page = uri[1] ? uri[1] : ''; var user_id = uri[2] ? uri[2] : ''; var page2 = uri[3] ? uri[3] : '';
  9. you probably are giving the div a height in the css, instead set it to min-height
  10. One of the problems i see right away is that when you implode the values, you need to do it so values are separated by a comma
  11. Because when you do $bar = "My name is $bar"; it replaces the contents of $bar, if you would like to echo Bob my name is it should be like this $bar .= "My name is"; or $bar = $bar." My name is";
  12. The reason it outputs "My name is Bob" is because when you assign $foo to $bar you are doing it with an & before the var name &$foo this means that $bar will be a reference to $foo instead of another var with foo's value, therefore any change you make to bar it's done actually for $foo.
  13. first I would recommend to use single quotes instead of double quotes, because from a resources point of view, double quotes takes more processing resources because PHP checks the string for a variable to resolve it's value inside the string, instead single quotes will be taken just as a string. So back to your question, the second option as is, it would take more resources than the first one, but if you use single quotes instead, should be the same.
  14. I would do something like this $title = 'MY FIRST WEB PAGE.php'; $title_no_white_space = str_replace(' ', '-', $title); echo $title_no_white_space; // echo MY-FIRST-WEB-PAGE.php
  15. I solved it this way: <?php <?php class creator{ private $objects = array(); public function __call($name, $args){ $func = ''; for($i=0; $i < count($args); $i++){ $func .= "\$arguments[{$i}], "; } $func = "new ".$name."(".substr($func, 0, -2).");"; eval("\$this->objects[] = $func"); } } ?> This work perfect, but if any of you have a better Idea i'll be glad to hear it
  16. Hi there every one, i'm writing a class that create instances of other classes and I want to use the __call() magic method to make it more compact and dynamic. here is a basic example of what I'm trying to achieve. The code bellow is the working code. <?php class creator{ private $objects = array(); public function createObj1($param1, $param2, $param3){ $this->objects[]=new Obj1($param1, $param2, $param3); } public function createObj2($param1, $param2){ $this->objects[]=new Obj2($param1, $param2); } } ?> Now I want the same functionality but using just the __call(), something like this <?php class creator{ private $objects = array(); public function __call($name, $args){ $this->objects[]=new $name($param1, $param2); } } ?> So, the main problem is, in the $args variable i get an array with all the args passed, How can I make the call to create a new object when in the object constructor are individual parameters needed and not an array of parameters. Thank you in advance.
  17. If you are having problems sending the email I strongly recommend you to use swiftmailer, it's a strong class for sending mails http://swiftmailer.org/
  18. do you mean remove the message and stay with the form?
  19. this is you script <?php foreach($topNav as $topNavs): if ($pageName == '.$topNavs->title.'){ echo' <li><a href="'.$topNavs->title.'" id="'.$topNavs->title.'">'.$topNavs->title.'</a></li>'; }else{ echo' <li><a href="'.$topNavs->title.'" id="'.$topNavs->title.'" class="selected">'.$topNavs->title.'</a></li>'; } endforeach; ?> change it to this <?php foreach($topNav as $topNavs): if ($pageName == $topNavs->title){ echo' <li><a href="'.$topNavs->title.'" id="'.$topNavs->title.'" class="selected">'.$topNavs->title.'</a></li>'; }else{ echo' <li><a href="'.$topNavs->title.'" id="'.$topNavs->title.'">'.$topNavs->title.'</a></li>'; } endforeach; ?>
  20. You´re welcome, don´t forget to mark the post as solved.
  21. if the form is posted to the phpmailer-fe.php, you should use this code in that file, so it's available to you for processing.
  22. if that is the function to calculate the volume in javascrip, the equivalen in php assuming you are sending the form via POST would be: <?php function write_this(){ $setteelarge = $_POST['LargeSettee']; $setteemedium = $_POST['MediumSettee']; $setteesmall = $_POST['SmallSettee']; $setteelarge2 = 45 $setteemedium2 = 31 $setteesmall2 = 22 $setteelargeresult = ($setteelarge * $setteelarge2); $setteemediumresult = ($setteemedium * $setteemedium2); $setteesmallresult = ($setteesmall * $setteesmall2); $total = ($setteelargeresult+$setteemediumresult+$setteesmallresult) echo $total; } ?>
×
×
  • 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.