Jump to content

182x

Members
  • Posts

    179
  • Joined

  • Last visited

    Never

Posts posted by 182x

  1. Hey guys, just wondering is there a limit to the size of variable names? I am using the name  'employeeTechProblemId' for the field in a database but I keep getting the following error. However the variable name is correct.

     

    Unknown column 'employeeTechProblemId' in 'where clause'

  2. hey guys,

     

    just wondering where I went wrong with this syntax?

     

    Thanks

     

    $get= "SELECT * FROM use WHERE Id = $Id AND acc= $acc";
    $query= mysql_query($get, $link_id) or die(mysql_error());
    
    
    $temp=mysql_fetch_array($query)
    $del="DELETE FROM tech WHERE techId= $temp['Id']";
    $mysql_query($del, $link_id)or die(mysql_error());
    

  3. Here it is.

    $test=select * from tableA, tableB where tableAId = tableBId;
    $query=mysql_query($test, $link_id) or die(mysql_error());
    
    while($get=mysql_fetch_array($query))
    {
    
         echo "<tr class='style4'><td>".$query['tableA.ds']."</td><td>".$query['tableB.hy']."</td></tr>";
    }
    
    

  4. I think i got the join working but how is this data displayed in a table for example in the code below i don't think the array elements can be accessed like tableA.ds and tableB.hy

     

    while($s1=mysql_fetch_array($query1))
    {
    
    $s2=mysql_fetch_array($query2); 
         echo "<tr class='style4'><td>".$s1['ds']."</td><td>".$s2['hy']."</td></tr>";
    }
    

  5. Hey guys,

     

    In order to display data from sql queries in a table I have had to create two different queries and then put the results into different arrays so this can be achieved as when I preform a join query it does not seem to work.

     

    I was just wondering can this be achieved with queries which make use of more than one table or are two different arrays the only way to go?

     

    thanks.

     

    example:

    while($s1=mysql_fetch_array($query1))
    {
    
    $s2=mysql_fetch_array($query2); 
         echo "<tr class='style4'><td>".$s1['ds']."</td><td>".$s2['hy']."</td></tr>";
    }
    

  6. Hey guys,

     

    I have two database tables which both have information I am displaying in a html table, however one of these database tables has an additional field called 'temp' so I was wondering what is the best way to decide if temp can be shown or not as it only appears in only one of the database tables but the column temp has to appear in the html table?

     

    I am not at a machine where I can currently test this so i was also wondering if this code will work?

    if (empty($st['temp])) {
    
            $temp = "<td>No entry</td>";
    	  
    
    	  
         }
         else {
              $temp = "<td>$display['path']</td>";
    
         }
    

  7. Can you post your most recent code?

     

    Also what kind of paths are being stored? Is it an absolute path or a relative path?

     

    Hi Its a relative path, it seems to be a permission error not sure how to fix this in vista and I have ensured the folder has all te necessary access rights.

  8. Thanks for the replies, It does remove the record from the database just not the file.

     

    How do I print out the name as it is in an array, I tried using echo but I kept getting syntax errors.

  9. Hey guys, the following code removes a record from the database but it wont remove the file related to the record which is obtained form the fileLocation field which is a path such as ../files/test.doc. I was just wondering how to fix this? Thanks.

     

    $del="SELECT fileLocation  FROM em WHERE emp = $pr";
    	$re = mysql_query($de, $link_id)or die(mysql_error()); 
    
    	$g=mysql_fetch_array($re);
    
    	if (empty($g))
    
    	{
    	$de="DELETE FROM em WHERE emp = $pr;
    	$re= mysql_query($de, $link_id)or die(mysql_error());
    
    	}
    	else{
    	$de="DELETE FROM em WHERE emp = $pr";
    	$re = mysql_query($de, $link_id)or die(mysql_error());
    	unlink($g);
    
    	}
    

  10. hey guys the following code is giving me this error:

    Parse error: syntax error, unexpected '{' in C:\xampp\htdocs\a\te.php on line 62

     

    just wondering whats up with it? Thanks.

     

    
    $ge= "SELECT * FROM t WHERE em= $pro";
    	$qu= mysql_query($ge, $link_id) or die(mysql_error());
    
    	if (mysql_num_rows($qu==0 )
    	{
    
    	$st=mysql_fetch_array($qu);
    	$st="INSERT INTO ta VALUES ('','','{$st['emp']}','{$st['te']}',
    	'{$st['y']}','{$storeInfo2['up']}','{$st['up']}')";
    	$r = mysql_query($st, $link_id)or die(mysql_error());
    	}
    

  11. Hey guys,

     

    I have made a small page where users can upload files and then download them from another, however if there is a space in the filename the download will not work properly. I was just wondering if thats how things are or if there is a way round this?

     

    Thanks.

  12. Hey guys,

     

    Just wondering what is wrong with the following syntax, I was also wondering id there a way to split the insert statement so it can appear over multiple lines?

     

    Thanks

     

     

    $st=mysql_fetch_array($query2)
    $sto="INSERT INTO em VALUES ('','$st['1]','$st['2']','$st['2']','$st['2']','$st['2']','$st['2']','$st['2']','$st['2']')";
    

     

    error: Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\a\t\te.php on line 55

  13. echo "<option value = '".$r['Id']."'>".$r['Id']."</option>\n";

     

    i havent a clue what that might do to help, but i know that if i sometimes rewrite my code again, the error disapears.... its really weird

     

    You were right that fixed it. Thanks :)

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