[PHP] Function Not Working...Little help
Hello, I am trying to get this function working but it gives me a PHP error (blank page): function Validate_Page_Nav($LastPage, $ErrorPage) { $trimmed = str_replace($staffroot, '', $_SERVER['SCRIPT_NAME']); $resul = $db->query("SELECT * FROM Page_Access WHERE URI = '$trimmed'") or die("failed to get access data"); $page_access = $resul->fetch_assoc(); $URI_access = explode(",", $page_access['User_Level']); if($_SESSION['Last_Page'] != $LastPage}) { header("location: {$ErrorPage}?message=Unable to update user information."); exit(); } if(in_array($_SESSION['Staff_level'], $URI_access)) { echo "Access"; exit(); }else{ echo "No Access"; //header("location: {$ErrorPage}?message=Unable to update user information."); exit(); } } Validate_Page_Nav("user_list.php", "user_list.php"); There are parts of the code I was trying to debug. Any help would be appreciated. Don Wieland D W D a t a C o n c e p t s ~ d...@dwdataconcepts.com Direct Line - (949) 305-2771 Integrated data solutions to fit your business needs. Need assistance in dialing in your FileMaker solution? Check out our Developer Support Plan at: http://www.dwdataconcepts.com/DevSup.html Appointment 1.0v9 - Powerful Appointment Scheduling for FileMaker Pro 9 or higher http://www.appointment10.com For a quick overview - http://www.appointment10.com/Appt10_Promo/Overview.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function not working after header call
Well, what can I say??? Magic windows Reboot the system or post a message and it works! johannes ""Johannes Janson"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 9d93c3$7d8$[EMAIL PROTECTED]">news:9d93c3$7d8$[EMAIL PROTECTED]... > Hi, > > I just don't get it...I have a form where the user enters name, surname > and a personal code. The action page checks for correct input which > is only letters for the two names and only numbers for the code. > If there is a wrong input in one of the fields a variable is set > which is then (amongst others) passed in the URL to the page containing > the form. > > formscript.php?code=1&name=1&surname=1&.. // for all three fields wrong, > if they are ok they aren't passed > > Now in order to highlight the fields with worng input I worte a > function. > > function wrong_input($var) > > global $var; > echo isset($var) ? " color=\"#FF\">" : ""; > } > > This function is called in the like this: > Code > > It is executed the first time but if the input is wrong and the user is sent > back to the form page it is not. > Desperately trying to get it to work I tried lots of combinations like using > print in the function or use > echo function($var) in the but nothing worked out. > > I'm completely stuck. > Any hlep is greately appreciated > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] function not working after header call
Hi, I just don't get it...I have a form where the user enters name, surname and a personal code. The action page checks for correct input which is only letters for the two names and only numbers for the code. If there is a wrong input in one of the fields a variable is set which is then (amongst others) passed in the URL to the page containing the form. formscript.php?code=1&name=1&surname=1&.. // for all three fields wrong, if they are ok they aren't passed Now in order to highlight the fields with worng input I worte a function. function wrong_input($var) global $var; echo isset($var) ? "" : ""; } This function is called in the like this: Code It is executed the first time but if the input is wrong and the user is sent back to the form page it is not. Desperately trying to get it to work I tried lots of combinations like using print in the function or use echo function($var) in the but nothing worked out. I'm completely stuck. Any hlep is greately appreciated -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] function not working?
your function function display_contents($table,$session) { $count = 0; $result = mysql_query( "SELECT * FROM $table WHERE session = '$session'"); while($row = mysql_fetch_array($result)) { $result_inv = mysql_query( "SELECT * FROM retailseafood WHERE pid = '{$row['items']}' "); $row_inventory = mysql_fetch_array($result_inv); $contents['items'][$count] = $row_inventory['pid']; $contents['price'][$count] = $row_inventory['price']; $contents['total'][$count] = $row_inventory['price'] * $row['quantity']; $count ++; } $total = $this->cart_total($table, $session); $contents['final'] = $total; return $contents; } looks ok, there are some code snippits missing ($this->cart_total()) but I'll assume its rudamentry. the code you are missing is how your accually calling your function View Contents Of Cart is a url, you forgot to include the src of cart.php to see where you are accually calling the function. cart.php please email me if you have more questions or comments. -- Chris Lee Mediawaveonline.com ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 [EMAIL PROTECTED] "Kurth Bemis" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... i can't get his function to work. i pass the correct data to it...but no results heres the function function display_contents($table,$session) { $count = 0; $result = mysql_query( "SELECT * FROM $table WHERE session='$session'"); while($row = mysql_fetch_array($result)){ $result_inv = mysql_query( "SELECT * FROM retailseafood WHERE pid='$row[items]'"); $row_inventory = mysql_fetch_array($result_inv); $contents[ "items"][$count] = $row_inventory[pid]; $contents[ "price"][$count] = $row_inventory[price]; //$contents[ "quantity"][$count] = $row[quantity]; $contents[ "total"][$count] = ($row_inventory[price] * $row[quantity]); $count ++; } $total = $this->cart_total($table,$session); $contents[ "final"] = $total; return $contents; } // return number of items in cart and heres what i do to call the function View Contents Of Cart what or where am i doing/going wrong? ~kurth -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] function not working?
i can't get his function to work. i pass the correct data to it...but no results heres the function function display_contents($table,$session) { $count = 0; $result = mysql_query( "SELECT * FROM $table WHERE session='$session'"); while($row = mysql_fetch_array($result)){ $result_inv = mysql_query( "SELECT * FROM retailseafood WHERE pid='$row[items]'"); $row_inventory = mysql_fetch_array($result_inv); $contents[ "items"][$count] = $row_inventory[pid]; $contents[ "price"][$count] = $row_inventory[price]; //$contents[ "quantity"][$count] = $row[quantity]; $contents[ "total"][$count] = ($row_inventory[price] * $row[quantity]); $count ++; } $total = $this->cart_total($table,$session); $contents[ "final"] = $total; return $contents; } // return number of items in cart and heres what i do to call the function View Contents Of Cart what or where am i doing/going wrong? ~kurth -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]