Search the Community
Showing results for tags 'variable'.
-
The following code is from chapter 5 of this book. if (!comments || !comments.value || (comments.value.indexOf('<') != -1) ){ okay = false; alert ('Please enter your comments, without any HTML!'); My question is why do we have to both put !comments and also !comments.value. Aren't they the same?? Why check comments if it doesn't have a value. I just learned php with Larry's book, and am new at javascript.
-
In Chapter 19, the $_SESSION['customer_id'] variable is often used for things like isset($_SESSION['customer_id']) why though can't we use other table columns that are like customer_id in the $_SESSION[] for example $_SESSION['order_id'] In chapter 19 also, the $_GET['id'] is the same id as the customer's. Why is it the same? Where does it get declared as the same, I have searched through the scripts and I don't see it. I am trying to create a script where users can view their past orders. The trouble I am having is calculating the total amount of the order in the checkout.php script, because there is no customer_id field in the order_contents table. Here is where I am at with that in the checkout.php script: $u = "SELECT price * quantity AS amount FROM order_contents WHERE order_id=?not sure what to put here"; $total = mysqli_query($dbc, $u);
-
My question is why in the following mysql statement does the $id at the end, not have to be in single quotes, whereas other variables in this statement are in quotes. $u = "UPDATE customers SET first_name='$fn', last_name='$ln', email='$em', address='$add', zipcode='$zip', city='$city', state='$state', country='$coun' WHERE customer_id = $id";
-
I am almost finished the book, and I am not totally clear on how to use the $page_title variable that appears throughout the book, do we have to include the following code in the title tag of each php script in order to use $page_title. <?php echo $page_title; ?>. In most of the examples in this book the $page_title variable is used in the script without showing the code used in the title tag. Also since the $page_title variable appears below the title tag when I load the php script in my browser I get an error message saying that $page_title isn't a valid variable. Can someone explain to me how to properly use the $page_title variable when writing php scripts. Or is it just easier to write the title in the title tag without using this variable.
-
This statement works fine as it is echo '<p>'.$query_row['name'].'</p>'; But how would it be possible to turn '<p>'.$query_row['name'].'</p>' into a variable that could be called back by a print or echo statement ? A not working example $myvar = '<p>'.$query_row['name'].'</p>'; echo $myvar; Does anyone know how this is possible?