SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 48 of 48
  1. #26
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://localhost/home/test.php?category_id=731
    thats what shown in address bar
    but it still show the categoryid is not set
    about the php.ini
    its set to
    post_max_size = 8M

  2. #27
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i think all move to diffrent side first what i mean is
    all create the database and the admin panel
    then all go to the way to display them
    coz this problem is educating about the php
    but i need to move with the development untel i fine a way to solve this problem
    may be there is diffrent method to do a product catelog
    thanks though guys

  3. #28
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    by the way do you think its ok to install php.exe and add the extentions latter
    or shall i install the manual instulation.?

    am reading more about mysqli
    i think it should be used from now own
    as they clam its more secured method for database connectivity.

  4. #29
    SitePoint Wizard holmescreek's Avatar
    Join Date
    Mar 2001
    Location
    Northwest Florida
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, I uploaded the following script on my server here : http://www.ngcomputing.com/test.php

    Code:
    <title>$_POST test</title><?php
    
      $category_id = $_GET['category_id'];
      
      if($category_id){
        echo "category_id : $category_id <br><br>";
      } else {
        echo "category_id is not set...<br><br>";
      }
      
      $some_value = rand(1,999);
      
      echo "<a href=\"test.php?category_id=$some_value\">click here to set category_id to $some_value</a>";
      
    
    ?>
    intragenesis, llc professional web & graphic design

  5. #30
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    aaaaaaaaaaaaaaaaaaaaaahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
    its working
    !!!!!!!???????????????
    wwoooooooooooooooooooooowwwaaaaaaa

  6. #31
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    $category_id = $_GET['category_id'];
    i see you added this variable

    now its the bigger headach how am gouing to implimanted in my
    product category.

    thanks man thumbs up

  7. #32
    SitePoint Wizard holmescreek's Avatar
    Join Date
    Mar 2001
    Location
    Northwest Florida
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by hisham777
    aaaaaaaaaaaaaaaaaaaaaahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
    its working
    !!!!!!!???????????????
    wwoooooooooooooooooooooowwwaaaaaaa

    Now take the code above and run it on your server. If it doesn't work, then again, it is a problem with either your PHP 5 or IIS setup.
    intragenesis, llc professional web & graphic design

  8. #33
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hahahahahhahahahah

    by the way cool website you got there

    specially the image gallery its simple thats what i like about it

  9. #34
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,788
    Mentioned
    153 Post(s)
    Tagged
    3 Thread(s)
    Just out of interest, do ANY $_GET requests work as expected?
    eg:
    PHP Code:
    <?php
    if(isset($_GET['var'])) {
    echo 
    $var;
    }
    ?>
    <a href="<?php echo $_SERVER['PHP_SELF']; ?>?var=1">test</a>
    Try that

  10. #35
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i added the code directly
    first execution state this
    <body>
    <a href="/home/tttt.php?var=1">test</a>
    </body>

    when i click the link test
    i get this
    <body>
    <br />
    <b>Notice</b>: Undefined variable: var in <b>D:\home\tttt.php</b> on line <b>11</b><br />
    <a href="/home/tttt.php?var=1">test</a>
    </body>

    ?

  11. #36
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    when i work with code inself page it works fine
    like add records to the table
    her is the code i got from Zend website
    using mysqli

    <head>
    <basefont face="Arial">
    </head>
    <body>

    <?php

    if (!isset($_POST['submit'])) {
    // form not submitted
    ?>

    <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
    Category ID:
    <input type="text" name="country">
    Category Name:
    <input type="text" name="animal">
    <input type="submit" name="submit">
    </form>

    <?php
    }
    else {
    // form submitted
    // set server access variables
    $host = "";
    $user = "";
    $pass = "";
    $db = "joke";

    // get form input
    // check to make sure it's all there
    // escape input values for greater safety
    $country = empty($_POST['country']) ? die ("ERROR: Enter a country") : mysql_escape_string($_POST['country']);
    $animal = empty($_POST['animal']) ? die ("ERROR: Enter an animal") : mysql_escape_string($_POST['animal']);

    // open connection
    $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");

    // select database
    mysql_select_db($db) or die ("Unable to select database!");

    // create query
    $query = "INSERT INTO category (category_id, category) VALUES ('$country', '$animal')";

    // execute query
    $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());

    // print message with ID of inserted record
    if ($result) {
    echo "New record inserted with ID ".mysql_insert_id();
    }
    // close connection
    mysql_close($connection);
    }
    ?>

    </body>
    </html>

  12. #37
    SitePoint Wizard holmescreek's Avatar
    Join Date
    Mar 2001
    Location
    Northwest Florida
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    replace occurances of var with my_var

    ( var is a reserved word, the poster intended on you to replace it with your own variable name )
    intragenesis, llc professional web & graphic design

  13. #38
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    after writing it to this
    PHP Code:
    <?php
    if(isset($_GET['var'])) {
    echo 
    $var;
    }
    ?>
    <a href="<?php echo $_SERVER['PHP_SELF']; ?>?my_var=1">test</a>
    when i click test
    i get test
    and the address bar shows
    /tttt.php?my_var=1

    ??

    i get this in the address bar

  14. #39
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i dont get the code

  15. #40
    SitePoint Wizard holmescreek's Avatar
    Join Date
    Mar 2001
    Location
    Northwest Florida
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if(isset($_GET['my_var'])) {
    intragenesis, llc professional web & graphic design

  16. #41
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    when click the link the address bar change from
    /tttt.php
    to
    /tttt.php?var=1

  17. #42
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    i go back to my Q

    this is the code to display the categorys
    getcategorys.php
    PHP Code:
    <?php

    $conn 
    mysql_connect("""""");

    if (!
    $conn) {
       echo 
    "Unable to connect to DB: " mysql_error();
       exit;
    }
     
    if (!
    mysql_select_db("joke")) {
       echo 
    "Unable to select mydbname: " mysql_error();
       exit;
    }

    $sql "SELECT  category, category_id
           FROM  category"
    ;

    $result mysql_query($sql);

    if (!
    $result) {
       echo 
    "Could not successfully run query ($sql) from DB: " mysql_error();
       exit;
    }

    if (
    mysql_num_rows($result) == 0) {
       echo 
    "No rows found, nothing to print so am exiting";
       exit;
    }

    while (
    $row mysql_fetch_assoc($result)) {
    echo 
    '<a href="displaypage3.php?category_id=' 
    '">' 
    $row['category_id']  
    '</a>'
    ' '
    $row['category'
    '<br />';

    //echo '<a href="displaypage.php?category=' .'">'  .$row['category']     .$row['category']    .'</a><br />';




    mysql_free_result($result);

    ?>
    and it works fine i think
    it display the the category ID with a link and the Category

    when the link clicked should fatch the records from table products
    and display the products with that category
    the idea was to make it fatch
    the name of the product
    the product pic
    the product discreption

    the code (with a help of holmescreek and spikeZ thank you guys) to fatch the product discription is
    PHP Code:
    <?php 
    $conn 
    mysql_connect("""""");

    if (!
    $conn) {
       echo 
    "Unable to connect to DB: " mysql_error();
       exit;
    }
     
    if (!
    mysql_select_db("joke")) {
       echo 
    "Unable to select mydbname: " mysql_error();
       exit;
    }


    $category_id $_GET['category_id']; 
    $sql "select * from products where category_id = "$category_id;
    // --- debug
    echo "category_id    : $category_id"<br>"
    echo 
    "sql statement :  $sql"
    exit;
    // --- end debug
    $query mysql_query($sql) or die(mysql_error()); 
    while(
    $rows mysql_fetch_assoc($query)) { 
    echo 
    $rows['description'] .'<br />'

    ?>
    after executing it display's
    category_id :
    sql statement : select * from products where category_id =

    no notes no warnings or error. !

    so far it seams that the getcategorys.php is not passing the variable i think.

  18. #43
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    aahhhh
    i give up at the moment
    am starting with a book.
    going to book shop today.

    thanks any way guys.

  19. #44
    SitePoint Wizard holmescreek's Avatar
    Join Date
    Mar 2001
    Location
    Northwest Florida
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's not the code, it's a problem with your php and/or IIS configuration. Remeber, I posted the code on my site and it worked, setting category_id, and gave you the exact code that was running.

    Keep your head up. If programming was easy, prostitutes would still make more money per hour.
    intragenesis, llc professional web & graphic design

  20. #45
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi homescreek
    the code you gave me that pass the category_id it works on my server
    but when i execute the code above why its not taking the category_id and quirying the quiry ????
    still dont understand the problem
    and if i happen to fine the problem one day i think its a very simple one
    its just cant be notised.
    any way holmescreek if you dont mind me asking
    how do you estimate the charges for a service you give to you client
    like building a website for them?

  21. #46
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    in php.ini what safe mode
    there are few options to change
    ???

  22. #47
    SitePoint Guru hisham777's Avatar
    Join Date
    Dec 2005
    Posts
    802
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    its working the bug is in the first code

    PHP Code:
    while ($row mysql_fetch_assoc($result))
    {
      echo 
    '<a href="displaypage3.php?category_id= . $row['category_id'] .'">'
      . 
    $row['category_id'] . ' '
      . 
    $row['category_name'] . '</a><br />';

    any comments or suggesting are apriciated on how to make the code better.

  23. #48
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,788
    Mentioned
    153 Post(s)
    Tagged
    3 Thread(s)
    PHP Code:
    while ($row mysql_fetch_assoc($result)) 

      echo 
    '<a href="displaypage3.php?category_id=' $row['category_id'] .'">' 
      
    $row['category_id'] . ' ' 
      
    $row['category_name'] . '</a><br />'



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •