Jump to content

paul2463

Members
  • Posts

    955
  • Joined

  • Last visited

    Never

Posts posted by paul2463

  1. you could try this

    $db->query("SELECT item.id, item.name, order.amount, order.item_id FROM `order` LEFT JOIN `item` ON order.item_id = item.id WHERE order.user_id='$user_id'") or die(mysql_error());
    

     

    note the double quotes arround the query string and single quotes around the php variable

     

    print_r($iteminf); should tell you whats exactly in the returned array

  2. I used this in one of my sites and the pop up window opened in the middle of the page

     

    function PopupMe(num){
    myleft=(screen.width)?(screen.width-800)/2:100;
    mytop=(screen.height)?(screen.height-600)/2:100;
    settings='top=' + mytop + ',left=' + myleft + ',width=500,height=400,location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=no,fullscreen=no, titlebar=no'
    var address = "designmode.php"; //put this in for you
    popupwin=window.open(address,'', settings);
    popupwin.focus();
    }
    

     

    then call the function onClick

  3. thye only way you can do that is to stipulate the height and width of the window, work out the minimum size the window has to be ot show all the information then use those sizes when you create the window

    onClick = "window.open('designmode.php', '', 'chrome=yes, resizable=yes,width=350,height=250')
    

     

  4. when you wrote the function you stipulated that you would supply it with $menu

     

    function get_menu_id($menu) {
    

     

    and when you call it you dont give it that information

     

    echo get_menu_id()
    

     

    it fails because it wants to know what $menu is, you dont use it in the function anyway so I am confused as to why you want it

  5. it is telling you that the query cannot run because the variable $user does not exist

     

    try echo out the query instead of running it and see what I mean

     

    try

    $update = "UPDATE `user` SET `weight` = 'weight' + $weight WHERE `username` = '$user'";
    echo $update;
    

     

    you will find that there is no information for $user

  6. you could try and change the check line to read

     

    if (XMLreq)
    

     

    because the "if" statement returns either true or false, if the item exists the it is true (code above) if it does not exist then it will fail

  7. you could change this line

    $data.= "\")";
    

     

    to

    $data.= "\") or die ("error in query " . mysql_error))";
    

     

    and see what errors come up, i think the main problem will be in the following code

     

    $data = "mysql_query(\"SELECT * FROM music WHERE";
    if ($composition != "") {
    $data.= " composition LIKE '$composition'";
    }
    if ($origin != "") {
    $data.= " AND origin LIKE '$origin'";
    

     

    if you have a composition and an origin your query string will be

    SELECT * FROM music WHERE composition LIKE blah AND origin LIKE blah "
    

     

    whereas if you dont have a composition but have an origin your query string will be

     

    SELECT * FROM music WHERE AND origin LIKE blah "
    

     

    and will fail big style

     

    HTH

  8. I kno wnothing about AJAX, you are wondering why I am answering here then, I will try and explain using a small amount of programming knowledge

    I have been looking around on the web for information....

     

    1.  xxx.open is a function call, that is fact

    2.  for your function to fail it must be that your XMLreq is not an object that .open works with...

    3.  this tells me that it was not created properly in the first place.

    4.  something has to be there or the "!= null" would have failed

    5.  I cant seem to find a function call named "new AJAX()", I have found a xmlReq = new XMLHttpRequest(); ..

     

    I might be way off but thats what I thought ....

  9. <?php
    function Encrypt($text) {
    $length=strlen($text);
    for ($i = 0; $i < $length; $i++) {
    $char = ord($text[$i]); //gets the ascii character number of the letter
    $char1 = chr($char +1); //adds 1 onto the ascii charachter a=b f=g etc
    $output .= $char1; //remakes the string
    }
    return $output;
    }
    
    $text = "hello world";
    echo Encrypt($text); //prints out ifmmp!xpsme
    ?>
    

     

    rewrite it slightly to decrypt the line by making it minus1

  10. echo $err;
    
    $multivar = func("blah");
    
    function func($func) {
    
    $returnArray[0] = "bar";
    $returnArray[1] = $func;
    
    return $returnArray;
    
    }
    
    echo $multivar[0]; //prints out "bar"
    echo $multivar[1]; //prints out "blah"
    

     

    HTH

  11. = assigns a value to a variable...

    == checks to see if two values are equal

    === checks to see if two things are exactly the same value and type

     

    in an if statement you are checking for equality and not assignation - use == not =

     

    HTH

  12. try this

    <?php  
    	  $sql = "SELECT * FROM articles";
    	  $run = mysql_query($sql) or die ("error in query " . mysql_error()); //just in case you query is duff
    	  while($data = mysql_fetch_assoc($run))
    	  {
    	  echo "<a href=\"index.php?p=articles&name=".$data['name']."\">".$data['name']."</a>";
    	  }
    	   ?>
    

     

    if you are using fetch_array you have to use the numbered key of the data you wish to get (i.e $data[1]), using fetch_assoc allows you to use the name of the column for the data(i.e $data['name']), but either way unless you use $data it wont understand you are calling for information from an array object

     

    hope that helps

  13. ok here we go,  will try for you

     

    array('First Name'=>$row['FirstName'],'Last Name'=>$row['LastName']);
    

     

    means

     

    1. create an array object

    2. lets say that $row['FirstName'] is "Fred"

    3. create a key called 'First Name' and make the value of that key equal Fred (that's what => means)

     

  14. the whole idea is to reduce the size of data that is stored, if you have 5 tables that are normalised and dont produce any duplicated information then it is quite all right to use a query that joins the five tables to get the dynamic information

  15. it could be if you have set your due_date column as a datetime then it will be expecting it to come at it in the format yyyy-mm-dd, you could try

     

    $sql = "INSERT INTO invoices SET client_id='$_POST[c_id]', service_name='$_POST[s_name]',
    total_price='$_POST[t_price]', current_date='$date' , due_date=DATE_fORMAT('$_POST[d_date]' , '%Y-%m-%d')";
    

×
×
  • 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.