Jump to content

182x

Members
  • Posts

    179
  • Joined

  • Last visited

    Never

Everything 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. 182x

    syntax error

    Still getting the same syntax error seems to be with this part of the code WHERE techId= $temp['Id']"; any ideas?
  3. 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());
  4. Hey guys just wondering where I went wrong? Thanks. $del="DELETE FROM tr, ts WHERE tr.Id = $Id AND ts.user = tr.user";
  5. 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>"; }
  6. 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>"; }
  7. 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>"; }
  8. Thanks, so it won't matter that the temp column is not in both database tables?
  9. 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>"; }
  10. 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.
  11. I still can't figure this one out. Is there a chance that getting the variable from the array is wrong in terms of syntax?
  12. Thats the weird thing everything seems right.
  13. yeah thats weird though, when I check the database with phpmyadmin it indicates that the information is there.
  14. Just gave it a try nothing was displayed
  15. Thanks, It still doesn't remove the file just removes the database record as before. Anymore suggestions?
  16. 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.
  17. 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); }
  18. Hey guys in the following code structure would the ELSE only apply to the second IF statement or is there any change it could be affected by the first IF? Structure IF ... IF ... ELSE .... IF
  19. DOH! I was looking at that for ages and didn't even notice. Thanks!
  20. 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()); }
  21. 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.
  22. 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
  23. You were right that fixed it. Thanks
  24. The type is varchar, does that make a difference. I pretty new to all this.
×
×
  • 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.