huzi8t9's Profile User Rating: -----

Reputation: 23 Tradesman
Group:
Author w/DIC++
Active Posts:
330 (0.13 per day)
Joined:
11-July 07
Profile Views:
13,102
Last Active:
User is offline May 16 2014 04:51 AM
Currently:
Offline

Previous Fields

Country:
GB
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
AMD
Favorite Gaming Platform:
XBox
Your Car:
Hyundai
Dream Kudos:
275

Latest Visitors

Icon   huzi8t9 Enjoying LEGO Batman way too much for the 360....

Posts I've Made

  1. In Topic: [SOLVED] MySQL Syntax - unable to correctly populate

    Posted 8 Apr 2014

    View PostArtificialSoldier, on 08 April 2014 - 06:52 PM, said:

    You need parentheses in the WHERE clause. If any of those conditions surrounded by OR match then the record will be returned regardless of whether or not the AND conditions match. Use parentheses to tell it exactly what you mean.


    Nailed it - thank you! The query ended up being SELECT * FROM posts, users WHERE (users.user_id=posts.post_id AND posts.post_replyto='0' AND posts.post_removed='0' AND posts.post_privacy='World') OR (posts.post_replyto='0' AND posts.post_removed='0' AND posts.post_user='2' AND users.user_id=posts.post_user) OR (posts.post_replyto='0' AND posts.post_removed='0' AND posts.post_user='3' AND users.user_id=posts.post_user) ORDER BY posts.post_date DESC;. The parentheses did the trick.

    Thank you again.

    ~huzi
  2. In Topic: Not able to pass $_Session variables

    Posted 28 Jan 2014

    <?php
       session_start();
       // get the product id
       $DVDID = isset($_GET['DVDID']) ? $_GET['DVDID'] : "NOT_SET";
       $name = isset($_GET['NameOfTheDVD']) ? $_GET['NameOfTheDVD'] : "NOT_SET";
       $Quantity = isset($_GET['Quantity']) ? $_GET['Quantity'] : "NOT_SET";
       require "connect.php";
       $query = "SELECT `DVDID`, `NameOfTheDVD`, `Quantity` FROM `DVD`";
       $stmt = $dbhandle->prepare($query);
       $stmt->execute();
       
       /* 
        * check if the 'cart' session array was created
        * if it is NOT, create the 'cart' session array
     . */
       if(!isset($_SESSION['cart'])){
         $_SESSION['cart'] = array();
         
        }else{
        array_push($_SESSION['cart'][], $DVDID);
        // !!- The above line WAS aray_push($_SESSION['cart'][] = $DVDID); - it should be coma separated. In the first parameter, you're telling the function WHICH array you're pushing to, the SECOND parameter is the value you want adding to the array(the FIRST parameter).
        // redirect to product list and tell the user it was added to cart
        header('Location: shop.php?$action=add&DVDID=' . $DVDID . '&NameOfTheDVD=' . $name);
        }
    ?>
    


    Try setting the values where you're initially assigning them to a variable. It appears they're coming from $_GET on your first section of code. I've changed some of it to work, see the comments.

    Secondly, I see you're querying the database but doing nothing with the result?


    Hope this helps

    ~huzi

    edit changed a typo
  3. In Topic: Not able to pass $_Session variables

    Posted 28 Jan 2014

    View Postmfredy92, on 28 January 2014 - 08:14 PM, said:

    May I confirm are you talking about in the syntax in the address>



    Yes, when you're using header("location: ...");, are the values being filled out by the variables in the next page, on the address bar? If they are, but aren't showing up later on, make sure they're not being nulled or overwritten.

    Try using print_r($_GET); exit;, see what's being passed.

    ~huzi
  4. In Topic: Not able to pass $_Session variables

    Posted 28 Jan 2014

    That syntax looks OK; in the address bar, are the variables being set as expected?

    ~huzi
  5. In Topic: Not able to pass $_Session variables

    Posted 28 Jan 2014

    View Postmfredy92, on 28 January 2014 - 07:48 PM, said:

    I don't know what part of post 7 makes it interesting because Andrew asked me to remove the $ sign before action, which I did. According to you, DVDID is not defined, but I have defined it in the shop page and the AddToCart.

    Yes, I did follow your instructions which was to use the function session_start() on all the scripts which I did. I think it is very important for you to know that while I have been stuck ion this problem for 2 weeks, I have been making progress as I was able to track the error and today thanks to your expertise in PHP, I have realised there is a problem in the URL.

    Now with the URL, can you be sepcific on what I am doign wrong. Is it because I am not using the variables correctly or what?

    Thank you for you advice.


    When attempting to echo variables in a string, you either have to escape the string or use correct syntax, such as

    $mystring = "Welcome, ". $_SESSION['user_name'] ."!";
    //OR
    $mystring = "Welcome, {$_SESSION['user_name']}!";
    
    


    When your passing parameters through the URL, you shouldn't use, or be aware that you are using, special characters, such as the dollar sign.

    When you're redirecting through the header, ensure you're setting the correct variables, ensure they're typed as you expected.

    header("Location: page.php?$action=MY_ACTION");
    //page.php
    $action = $_GET['$action'];
    
    


    As I said previously, when using strings, if you mix up the syntax, you may end up with an error, such as:

    $action = $_GET["$action"];
    
    


    Since the PHP interpreter is now looking for a variable named $action, but it's not defined.

    I hope this makes some sense and you can use it in the future, and hopefully, to help you with the current problem.

    Thanks

    ~huzi

My Information

Member Title:
D.I.C Regular
Age:
25 years old
Birthday:
August 30, 1989
Gender:
Location:
Nottinghamshire, England
Interests:
Programming, Rock Climbing, Programming.
Full Name:
Mark Hughes
Years Programming:
12
Programming Languages:
HTML, JavaScript, jQuery, Visual Basic, C++, PHP, ASP, ActionScript 2/3

Contact Information

E-mail:
Private
AIM:
AIM  Glitcher 04
Website URL:
Website URL  http://www.clan-hq.co.uk/
Yahoo:
Yahoo  gOoDnPlEnTy83
Skype:
Skype  huzi8t9
Facebook:
http://facebook.com/huzi8t9
Twitter:
huzi8t9

Friends

Comments

Page 1 of 1
  1. Photo

    jesicalbaby Icon

    16 Sep 2013 - 14:34
    Hello
    My name is Miss jesical,
    i saw your profile today
    and,i fill more interest to contact you ,
    i will like you to please send me
    an email via (jesicalduncan22@yahoo.com)
    for me to send you my picture
    jesicalduncan22@yahoo.com
  2. Photo

    ahmed12345 Icon

    19 Feb 2012 - 12:09
    i am having problem in under standing with this assignment, can any one out there help me to better under stand
    Goals:

    1. Demonstrate knowledge of abstract classes and interfaces,
    2. Show how to handle exceptions.

    Design:

    This is an assignment about Assignments and Grades. Some Assignments in this class are Gradab...
Page 1 of 1