Jump to content

182x

Members
  • Posts

    179
  • Joined

  • Last visited

    Never

Everything posted by 182x

  1. sorry that was a typo when changing variables its Id
  2. Hey guys, I was trying to get the list box to display the id numbers in ascending order however the code below does not work, just wondering how to fix it? thanks. <?php $g = "SELECT * FROM em ORDER BY iD ASC"; $q = mysql_query($g, $link_id) or die(mysql_error()); if (mysql_num_rows($q) > 0) { ?> <select name="d"> <?php while($r = mysql_fetch_assoc($q)) { ?> <option value="<?php echo $r['Id']; ?>"><?php echo $r['Id']; ?></option> <?php } } ?>
  3. I'm getting the following error with this line of code now, just wondering where the syntax is wrong with it. $f = "<td><a href=\"$display['p']\">".$display['p']."</a></td>"; error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\xampp\htdocs\a\tec.php on line 83
  4. Thanks I have used that for the following code which is used to display file links but only if a fiile is available for that record but its not displaying the file links. Where did I go wrong? Thanks again <?php while($display=mysql_fetch_array($q)) { if (empty($display['p'])) { $f = "<td></td>"; } else { $file = "<td>".$display['p']."</td>"; } echo "<tr class='style4'><td>".$display['Id']."</td><td>".$display['s']."</td><td><a href=".$display['f'].">test</a></td></tr>"; } ?>
  5. Hey guys, Just wondering whats wrong with the following part of a table I am creating. Thanks. <tr><td><a href='$display['file']\">File Available</a></td></tr>";
  6. Hey guys, I have been using the following code to put data from a query into the arrays as shown below. However there will be some cases where the data will have to be calculated from the one or more queries and stored in an array before the while loop can be performed. So I was wondering how do you perform the same while loop but with the results stored in an array as the mysql_fetch_array would not work? mysql_select_db("gra",$db) or die(mysql_error()); $query = mysql_query("SELECT name, count(*) FROM gra group by name") or die(mysql_error()); while($getData = mysql_fetch_array($query)){ $points[] = $getData[1]; $months[] = $getData[0]; }
  7. I am using the following structure but no matter what I do now it calls the last else and does not upload even if a file has been selected. Have I used the empty function in the wrong way? <?php session_start(); if(strlen($_POST['description']) > 4000) { //error msg } else{ if (!empty($_FILES)) { //upload } else { //don't upload } } ?>
  8. hey thanks for the reply im a total newbie does that mean if there is not a file then do whatever? thanks again
  9. Hey guys, I have created an upload file script for a form however if the user does not upload a file I do not want the file upload part of the script to be used. Is there a way to check if the file type on the form is empty? Thanks.
  10. 182x

    header error

    Thanks, does this apply to all cases or is t here any instance where the HTML formatting would be lost?
  11. thanks but with that i get this error: Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')'
  12. thanks for teh reply when I upload the code to the server I now get thie following error, just wondering how to avoid it? Call to undefined function: date_default_timezone_set()
  13. hey guys just wondering why the below syntax only works with some versions INSERT INTO test VALUES ('', 'J', 'j', 'a', 't', 'e'), VALUES ('', 'J', 'h', 'e, 't', 'f'); but sometimes it has to be the following. Is the short hand method wrong? INSERT INTO test VALUES ('', 'J', 'j', 'a', 't', 'e'); INSERT INTO test VALUES VALUES ('', 'J', 'h', 'e, 't', 'f');
  14. thanks, what is the limit of text?
  15. Good tip could come in handy.
  16. Hey guys, For logging into a website and creating users I use the following encryption, I was just wondering can the '.v' parameter be anything and is this a good method of encryption? Thanks crypt($_POST['password'], '.v')
  17. Hey guys, I am using the following to display the date/time for the user, however I was wondering is there a way to automate the process of the daylight saving time so that the code does not have to be changed everytime the time changes? Thanks. <?php date_default_timezone_set('GMT+1');echo date('l dS \of F Y h:i:s A'); ?>
  18. Thanks, it was weird as it was overwriting the variables when I used the same browser but on if I used another. Is that normal as well?
  19. Hey guys, This may be a silly question but I was wondering if I have a login page with a single page to process its username and password that uses a switch to check for the user and then direct them to their home page. However with processing all the users on the same page does this mean that if another user logs in at the same time the first users session variables will be over written? For example if I login as admin and then login as a normal user without loggin the admin out, then try to access the admin page it claims the admin has logged out, so does this cause a problem for multiple users. Thanks.
  20. Hey guys, I am using the code below in order to log a user in and then based on their accesss level theres user id is stored as a session variable. That variable is then is checked when their redirected page loads to ensure they can have access and its not just a user typing in the url. However when i login as user two it can then access teh user 1 account by typing in the url. I was just wondering what I have done wrong? Thanks. switch($user) { case 1: $Id = "SELECT uId FROM u WHERE u = '$u' AND p= '$p"; $qu= mysql_query($Id, $link); if (mysql_num_rows($qu) > 0 ) { $st= mysql_fetch_assoc($qu); $_SESSION ["userId"] = $st["userId"]; header("location:test.php"); exit(); } break; case 2: $Id = "SELECT uId FROM u WHERE u = '$u' AND p = '$p'"; $query = mysql_query($getId, $link); if (mysql_num_rows($query) > 0 ) { $st2= mysql_fetch_assoc($qu); $_SESSION ["userId"] = $storeEmployee["userId"]; header("location:test2.php"); exit(); } break;
  21. Hey guys, Sorry for another newbie question but with the code below I get this error Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\a\processLogin.php on line 37 I was just wondering what ive done wrong. Today is not my day. line 37: if (mysql_num_rows($qu) > 0 ) solved now my bad.
  22. does it matter that I have not given the sessions names?
×
×
  • 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.