Maq
Administrators-
Posts
9,363 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Maq
-
I agree, pointless. Why not just Google this question?
-
[SOLVED] Switch text around thats in the same column?
Maq replied to Solarpitch's topic in MySQL Help
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]. -
[SOLVED] how can I get to open a new page on a new window
Maq replied to oceans's topic in Applications
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']; -
Very minor: OOP icon shows up for database guru.
-
[SOLVED] Switch text around thats in the same column?
Maq replied to Solarpitch's topic in MySQL Help
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. -
[SOLVED] Switch text around thats in the same column?
Maq replied to Solarpitch's topic in MySQL Help
Are they all in that same exact format? Cause you could explode that column, switch them and update. *This isn't the safest way... -
[SOLVED] Creating Buttons and Lables with two arrays
Maq replied to Pjack125's topic in PHP Coding Help
Why can't you use a multi-dimensional array? -
Did you want us to say something specific? I just wrote that I was from phpfreaks...
-
[SOLVED] Conditional Statement Not Triggering, Dont Know Why...
Maq replied to thndr's topic in PHP Coding Help
It amazes me every time... -
[SOLVED] Conditional Statement Not Triggering, Dont Know Why...
Maq replied to thndr's topic in PHP Coding Help
Yeah shouldn't $_row be: $row ? -
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.
-
Kindly dont spoil my site but try to find flaws and report to me
Maq replied to om's topic in Beta Test Your Stuff!
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. :-\ -
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); } ?>
-
Kindly dont spoil my site but try to find flaws and report to me
Maq replied to om's topic in Beta Test Your Stuff!
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... -
xboxpremiumthemes.com would like opinions
Maq replied to skatermike21988's topic in Website Critique
-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. -
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:
-
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.
-
Could you post your code?
-
That sucks... Do you have a question or something?
-
Insert Data From a Form Into a Database - not working???
Maq replied to wblati's topic in MySQL Help
$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... -
Insert Data From a Form Into a Database - not working???
Maq replied to wblati's topic in MySQL Help
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']}')"; -
Insert Data From a Form Into a Database - not working???
Maq replied to wblati's topic in MySQL Help
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... -
I used to say the same thing, it's a hopeless cause...
-
[SOLVED] Display name from one table based on ID of another table
Maq replied to TechMistress's topic in MySQL Help
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