Jump to content

michellephp

Members
  • Posts

    34
  • Joined

  • Last visited

    Never

Posts posted by michellephp

  1. Hi everyone,

     

    I am searching for an invoice template for excel (or better, openoffice spreadsheet as that's what I have - but excel docs should work fine). I thought this would be a sinple task - but i have been searching for a couple of hours now and all the templates I have come across either don't work or are just hopeless. Anyone know where I can find one (for free?). I just want it to add up my totals, work out tax etc.

     

    Thanks :)

    Michelle.

  2. Hi,

    Thanks for your reply.

    Because this would mean a crazy amount of work, and I would prefer them to stay in html for search engines etc. And for existing links to me on other websites (I have many links to my tutorials etc).

     

    Is there anything I can do?

     

    I thought:

    # Use PHP4 as default

    AddHandler application/x-httpd-php4 .php

     

    Was meant to fix it? But it doesn't. I do appreciate your help.

  3. Hi everyone,

     

    Suddenly my website has gone a little bonkers. I think it has something to do with my webhost and their php configuration.

     

    Firstly, the index.html page was coming up with this weird pop-up:

    File Download - Security Warning

    Do you want to save this file , or find a program online to open it?

    Name: mybeads_com_au

    Type: Unknown File type, 35.4kb

    From: Mybeads.com.au

    Find Save Cancel

     

     

    My webhost fixed that, however all the php elements in all .html pages are not working. Things such as:

    <?php include("inc/viewcontents.php"); ?></td><td bgcolor="#F7D6FE" height="35" align="right"><?php include("inc/search.php"); ?>

     

    They just don't work in the .html pages such as www.mybeads.com.au/beads.html

    But they do work in the .php pages, such as www.mybeads.com.au/catalog.php

    (see top menu bar, search and view contents).

     

    Not to mention that my shopping cart admin now doesn't work - I log in, but as soon as I try to change anything it tells me my password is incorrect.

     

    Please help.

     

    Thanks,

    Michelle.

     

  4. I'm sorry for bumping, but I really need some help with this. I am willing to pay (see freelancing section). Surely someone out there has done heaps of paginations and knows what I am doing wrong? Even if I have to start over, seriously I need your help and it would mean so much to me to fix this.

    Thank-you,
    Michelle.
  5. Hi Barand,

    I'm not sure I understand... what does that mean?

    [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]So you should be able to determine whether property is sold or not.[/quote]

    It is working so far as it updates the db... it's just when the button is clicked it updates the db to 'no' first (i want 'yes' first).

    I thought maybe this was happening because of this line is sold.php

    $update = "update items set sold = '".$sold."' where id = ".$_REQUEST['id'];

    See i thought there should be another " at the end.... but I get this error when I add one:
    Parse error: syntax error, unexpected '"' in /home/homebuy/public_html/sold.php on line 23

    But when I take the " out (ie where id = .$_REQUEST)
    I get: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /public_html/sold.php on line 23

    Do you think this could have something to do with it?
  6. OK, I have found some code, which sort of makes it work, however it is not pulling the search results. This is the new code - how do I adapt my exisiting code to use this new stuff?

    $query_p = "SELECT * FROM items WHERE mid = ".$_SESSION['memberID'].".$sort"; [!--coloro:#33CC00--][span style=\"color:#33CC00\"][!--/coloro--]So query_p needs to be the results of the form, eg sql... right?[!--colorc--][/span][!--/colorc--]
    //echo $query_p; //debug output
    $query_limit_p = sprintf("%s LIMIT %d, %d", $query_p, $startRow_p, $maxRows_p);
    $p = mysql_query($query_limit_p, $myconn) or die(mysql_error());

    if (isset($_GET['totalRows_p'])) {
    $totalRows_p = $_GET['totalRows_p'];
    } else {
    $all_p = mysql_query($query_p);
    $totalRows_p = mysql_num_rows($all_p);
    }
    $totalPages_p = ceil($totalRows_p/$maxRows_p)-1;

    $queryString_p = "";
    if (!empty($_SERVER['QUERY_STRING'])) {
    $params = explode("&", $_SERVER['QUERY_STRING']);
    $newParams = array();
    foreach ($params as $param) {
    if (stristr($param, "pageNum_p") == false &&
    stristr($param, "totalRows_p") == false) {
    array_push($newParams, $param);
    }
    }
    if (count($newParams) != 0) {
    $queryString_p = "&" . htmlentities(implode("&", $newParams));
    }
    }
    $queryString_p = sprintf("&totalRows_p=%d%s", $totalRows_p, $queryString_p);

    If you have any idea, I'd really appreciate ANY hints or ideas you have. Thank-you.

    [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]By the way, if I take out WHERE mid = ".$_SESSION['memberID'].".$sort from the very first line (above), it says it has ALL properties, (ie showing 1 - 3 of 52 properties), but still shows the 16 that are in the search criteria only (on the first page, ie showing more than the limit of 3!!). But then if you click next, you get "showing 3 -6 of 52" but you see the same 16 properties as on the first page.[!--colorc--][/span][!--/colorc--]


    I think the code just above is similar to:
    [a href=\"http://www.phpfreaks.com/quickcode/Pagination/164.php\" target=\"_blank\"]http://www.phpfreaks.com/quickcode/Pagination/164.php[/a]

    someone must have an idea?
  7. hi again,

    I think it definitely has something to do with:

    $sql .= $sort . $limit;

    and

    //Add column sorting
    if($_REQUEST['sort'] != '')
    $sort = ' order by price asc ';
    else
    $sort = $_REQUEST['sort'];

    and

    $limit

    Please help!!! It's absolutely driving me crazy!!!!!!!!!!!!!!!!!!!!!!!!

    <EDIT> I forgot to mention, it's a search page that send the results to the page in which contains the code above.

    Eg search.php --- > properties.php

    Do I need to enter the limit stuff on the search page instead... maybe?
  8. Hi,

    the buttons are in the backend, where the people can add their homes to be sold. There's a button in one of teh columns that they can click to say whether or not the property has sold.

    At the moment, the button initially comes up empty (which I think looks dodgy). Then if you click it once, it says 'no' and the database knows it is not sold (although if the button has never been pressed the database does not say the property has been sold either).
    If you click it again, the button says 'yes'.

    But really, if the person has just listed their property, it won't be sold yet. So the button should come up saying 'no' rather than blank. And then, the person should only have to click it once to say the property has been sold = "yes"

    At the moment, I have it so the button comes up saying "no" which looks better. But the person still has to click it twice to get to "yes"
    ie
    comes up saying (but with no real value) = "no"
    first click = "no"
    2nd click = "yes"

    so if the db could assume if not yes, = no, that would be good. But I can't get it to do that.
  9. Hi everyone again!

    I have partially fixed this, by adding the 'if' as suggested. However I still have a problem. It comes up as 'no' is there has been no value assigned for it. It comes up as yes if it has 'yes' assigned to it. But still, the person has to click the 'no' button twice to get to use.

    I.e.
    First No = "no"
    second No = "yes"

    Code:
    if ($row_p['sold'] == "Yes")
    $sold = "Yes";
    else
    $sold = "No"; ?><button onclick="window.location='sold.php?id=<? echo $row_p['id']; ?>'" value="No"><? echo $sold; ?></button>

    And the sold.php:

    if($_REQUEST['id'] != "") {
    $sql = "select * from items where id = ". $_REQUEST['id'];
    $result = mysql_query($sql,$myconn) or die(mysql_error());

    if (mysql_num_rows($result) > 0) {// if found

    //fetch results in assoc array
    $row_item = mysql_fetch_assoc($result);

    if ($row_item['sold'] == "No")
    $sold = "Yes";
    else
    $sold = "No";

    //build update sql string
    $update = "update items set sold = '".$sold."' where id = ".$_REQUEST['id'];
    $result = mysql_query($update,$myconn) or die(mysql_error());

    Now logically, you would think that you would change the "no" to "yes" in the button link. And then the no in
    "if ($row_item['sold'] == "No")" to yes. BUt when I do that, when the button is clicked it doesn't change tp yes (even if clicked twice) and doesn't update the db.

    I thought maybe by adding an ORDER BY somewhere (because my only thought at the moment is that "no" is always the first option submitted as it comes first in the alphabet....). But if this might be the case, where do I stick the ORDER BY desc??

    Thanks again,
    Michelle
  10. Hello again everyone!

    I simply cannot work it out, after going through tutorial after tutorial, it just aint working :( The problem is:

    <EDIT> Ok, solved some of the problem. But now, ALL results are showing on the one page, even though it accurately says
    "Showing: 1 to 10 of 16 Listings"

    I know it has something to do with $limit (because later in the page I have: $sql .= $sort . $limit;)
    but when I include:

    $limit = ' LIMIT '.$startRow_p.', '.$maxRows_p;

    it makes it say, "showing result 1 to 10 of 10 listings" and only shows 10 listings and no option of 'next page', regardless of how many listing I have.

    <EDIT> HMMM, it seems as if the $limit is limiting the ACTUAL results that show up at all. I think that might be because of this:
    $all_p = mysql_query($sql.$sort);
    $totalRows_p = @mysql_num_rows($all_p);

    and above that I have: $sql .= $sort . $limit;

    I really really really would apprectae some help. I've been at this one little thing for about 6 hours. No matter what I cut out, or put back in, I have one of two results:
    1). I get the correct 'showing 1-10 of 16' but all the results are on the first page. or,
    2.) I get 'showing 1 - 10 of 10' with only 10 showing but without being able to see the rest of the results (eg it thinks there are only 10 there)



    This is the code:

    #### BUILD SEARCH SQL BASED ON SEARCH TYPE ####

    #defauts

    $maxRows_p = 10;
    if(!isset($_GET['page'])){
    $pageNum_p = 1;
    } else {
    $pageNum_p = $_GET['page'];
    }
    $startRow_p = (($pageNum_p * $maxRows_p) - $maxRows_p);
    $sql = mysql_query("SELECT * FROM pages LIMIT $startRow_p, $maxRows_p");





    ## Start building sql for GET varables for advanced search

    //Add Price From
    if(isset($_REQUEST['pfrom']) && ($_REQUEST['pfrom'] != '-1'))
    $search[] = ' price >= '.$_REQUEST['pfrom'];
    //Add Max Price
    if(isset($_REQUEST['pto']) && ($_REQUEST['pto'] != '-1'))
    $search[] = ' price <= '.$_REQUEST['pto'];

    ETC ETC (more search options here)

    //implode to search string on ' and ';
    $searchStr = @implode(' and ',$search);

    $sql = 'select * FROM items WHERE (expires > NOW()) and active = "Yes" and ';
    $sql .= $searchStr;

    //Add column sorting
    if($_REQUEST['sort'] != '')
    $sort = ' order by price asc ';
    else
    $sort = $_REQUEST['sort'];


    ### DEBUG
    if($debugP) echo 'Advanced Search Sql<hr>'.$sql;

    $error['Results'] = 'No results found, please search again';




    ### Finished Building search sql and execting #####
    $sql .= $sort . $limit;

    //Perform search
    $searchResults = $mysql->exSql($sql);

    ### BUILD OUTPUT ####

    if (isset($_GET['totalRows_p'])) {
    $totalRows_p = $_GET['totalRows_p'];
    } else {
    $all_p = mysql_query($sql.$sort);
    $totalRows_p = @mysql_num_rows($all_p);
    }
    $totalPages_p = ceil($totalRows_p/$maxRows_p)-1;

    // Build Page Number Hyperlinks
    echo "<center>Select a Page<br />";

    // Build Previous Link
    if($page > 1){
    $prev = ($page - 1);
    echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\"><<Previous</a> ";
    }

    for($i = 1; $i <= $totalPages_p; $i++){
    if(($pageNum_p) == $i){
    echo "$i ";
    } else {
    echo "<a href=\"".$_SERVER['PHP_SELF']."?pageNum_p=$i\">$i</a> ";
    }
    }

    // Build Next Link
    if($page < $totalPages_p){
    $next = ($pageNum_p + 1);
    echo "<a href=\"".$_SERVER['PHP_SELF']."?pageNum_p=$next\">Next>></a>";
    }
    echo "</center>";


    ?>
  11. For the first one I got: Parse error: syntax error, unexpected T_VARIABLE in /home/homebuy/public_html/towns.php on line 77

    and for the second i got:
    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/homebuy/public_html/towns.php on line 77

    and for this:
    <?php

    //fetch details for county
    $sql = 'select * from counties where id = '.$_REQUEST['CountyID'];
    $R = mysql_query($sql,$myconn) or die(mysql_error());

    while ($country = mysql_fetch_array($R)) { //and this is line 69? or try mysql_fetch_assoc($R);

    echo $country['title'];

    }

    ?>

    I get: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
  12. hi!

    Do you mean leave the:

    //fetch details for county
    $sql = 'select * from counties where id = '.$_REQUEST['CountyID'];
    $R = mysql_query($sql,$myconn) or die(mysql_error());
    $county = mysql_fetch_assoc($R);


    in? Because I always seem to get this error:
    You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

    But when I take it out and put this in:
    <? while ($county = mysql_fetch_assoc($R)) { ?>
    <? echo $county['title']; ?><?
    }
    ?>

    I get: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/homebuy/public_html/towns.php on line 66

    Thanks :)
  13. Hi Barand,

    Thanks for that :) So now I have the id number displaying (eg 10). Do you know how I can change that into the correspong title, eg Sydney?

    I tried: <? echo $county['title']; ?>

    But i think I need to fetch the info for the county first. But like I said, the code:

    //fetch details for county
    $sql = 'select * from counties where id = '.$_REQUEST['CountyID'];
    $R = mysql_query($sql,$myconn) or die(mysql_error());
    $county = mysql_fetch_assoc($R);


    Just causes an error. Any ideas?

    Thanks again!
    Michelle.

  14. hi

    yes it does :)

    [!--quoteo(post=359368:date=Mar 28 2006, 12:50 PM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ Mar 28 2006, 12:50 PM) [snapback]359368[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    Does the text field (or whatever) on your form have the name='countyID' ? Note it is case-sensitive.
    [/quote]
×
×
  • 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.