Jump to content

Maq

Administrators
  • Posts

    9,363
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by Maq

  1. I agree, pointless. Why not just Google this question?
  2. This really isn't the proper way to do things but if it worked it worked. You should have deleted your old column (the full name) and created additional columns for the names according to whatever you need (first name, middle name, last name etc...). Then you could just SET last_name = pieces[0] and first_name = pieces[1].
  3. Have you done any research? Surely you have heard of the $_GET method, I mean you have a decent amount of posts... You have to tack it onto the end of the URL. $s = "hit"; ?> Google I already know the next question... You retrieve it on the next page by doing: $ported_var = $_GET['var1'];
  4. Very minor: OOP icon shows up for database guru.
  5. For example: $result = mysql_query("SELECT * FROM table") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { $old_name = $row['full_name']; //take original column data (full_name) $pieces = explode(" ", $old_name); //explode it with a space, to get the first and last name $new_name = $pieces[1]. " " .$pieces[0]; //concatenate the pieces to create the new name $result = mysql_query("UPDATE table SET full_name='$new_name' WHERE id = {$row['id']}") or die(mysql_error()); //insert it where the id is where you got it from echo $row['id'] . " Changed from " . $old_name . " to: " . $new_name . " "; //make sure it worked... } *** Have not tested it. Should give you an idea. You only have 3,000 records so this shouldn't be a problem on your resources, although if you had 10's of thousands it could put your server to its knees.
  6. Are they all in that same exact format? Cause you could explode that column, switch them and update. *This isn't the safest way...
  7. Why can't you use a multi-dimensional array?
  8. Did you want us to say something specific? I just wrote that I was from phpfreaks...
  9. It amazes me every time...
  10. Yeah shouldn't $_row be: $row ?
  11. Well done CV. "marajuanettes", I like that. I'm going to make this short and sweet. First off, I'm not a supporter of pot smokers but I do think that it's less harmful than alcohol, cigarettes, and most other drugs. I agree, the implications are far greater than what most PPP's think. If anything does happen it will be a very long process. Especially with huge multi-billion dollar businesses fighting against it. (I think I just summarized what CV said... ) I think it has to do with a lot more than 'bad image', but that is certainly part of it.
  12. Don't. This means he will have a lot of time and motivation to make it better I said it because it's his only source of income. :-\
  13. Found this little function online that can be used with any associative array and can sort by any dimension... I already applied it to your scenario: (if your arrays are really big you can pass by reference to save memory) $Menu=array(); $Menu = array( array( "id" => 1, "titolo" => "titolo1", "weight" => 2), array( "id" => 2, "titolo" => "titolo2", "weight" => 1), array( "id" => 3, "titolo" => "titolo3", "weight" => 3) ); cmp($Menu, "weight"); function cmp($arr, $key){ //we loop through the array and fetch a value that we store in tmp for($i = 0; $i $tmp = $arr[$i]; $pos = false; //we check if the key we want to sort by is a string $str = is_numeric($tmp[$key]); if(!$str){ //we loop the array again to compare against the temp value we have for($j = $i; $j if(StringManip::is_date($tmp[$key])){ if(StringManip::compareDates($arr[$j][$key], $tmp[$key], $type = 'asc')){ $tmp = $arr[$j]; $pos = $j; } //we string compare, if the string is "smaller" it will be assigned to the temp value }else if(strcasecmp($arr[$j][$key], $tmp[$key]) $tmp = $arr[$j]; $pos = $j; } } }else{ for($j = $i; $j if($arr[$j][$key] $tmp = $arr[$j]; $pos = $j; } } } if($pos !== false){ $arr[$pos] = $arr[$i]; $arr[$i] = $tmp; } } print_r($arr); } ?>
  14. lol. Sorry to sound so harsh but you need to redo the whole site. Everything I want to say has been said again and again. Seems like you haven't tried much yet. Come back when you make a significant change. You can't possibly think that's good, do you? I feel bad for you...
  15. :P
  16. -I like how you keep it simple and easy to read. -I don't like the plain, black font. -Color scheme is a little off, as yellow and dark gray (?) don't go together. -The header looks good.
  17. Sorry Snoobs, as these guys have steered into their own thread. The number you have is a timestamp. You have to use the date function like so... $your_date = 1228745009; echo date("d-m-Y", $your_date)); Check out the manual - date() for more date formats. Hope this is what you're looking for because I don't know what this means:
  18. Use javascript, check to see if the selection == 0, if so display an alert or w/e you want to do. You should have a function that returns either true or false depending on your error checking. I just found this on google real quick, there is a client side check for non-selections. You should also check server side in-case the user has JS disabled. If you have specific trouble please post it.
  19. Could you post your code?
  20. That sucks... Do you have a question or something?
  21. $sql="INSERT INTO student (name, idNumber, mark) VALUES ('{$_POST['NAME']}','{$_POST['ID_NUMBER']}','{$_POST['MARK']}')"; echo $sql; // add this line and post it The error is saying that the $_POST['ID_NUMBER'] is blank, not sure why...
  22. I'm confused, your form tells me that you want to insert Student data, not Person data. Here is your table structure that YOU created (and assume you want to use): $sql = "CREATE TABLE student ( name varchar(30), idNumber int( NOT NULL, mark int )"; So your query has the wrong names (I have no clue where the table Persons came from, along with its fields ???). The INSERT query should be this: $sql="INSERT INTO student (name, idNumber, mark) VALUES ('{$_POST['NAME']}','{$_POST['ID_NUMBER']}','{$_POST['MARK']}')";
  23. Shouldn't you be inserting NAME, ID_NUMBER, and MARK from these fields: AND NOT: ('$_POST[firstname]','$_POST[lastname]','$_POST[age]')"; I don't even see these input fields anywhere...
  24. I used to say the same thing, it's a hopeless cause...
  25. Number of projects? I don't see how that is being displayed. Can you show me the relevant code? To display the category just do: $rows[cat_name] You did, right here: SELECT projects.*, categories.cat_name
×
×
  • 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.