irkevin
-
Posts
295 -
Joined
-
Last visited
Posts posted by irkevin
-
-
I'll try this bro ! Will let u know in 10 mins or so
-
Yes sure, but then, how do I tell php to make use of the largest one?
-
Hi,
I'm lost, I don't know if this is possible using PHP, guess I will have to ask. Here it goes. Below are some array:
Array ( [0] => 1 [1] => ps2 [2] => game ) Array ( [0] => 2 ) Array ( [0] => 3 [1] => game )
As you can see, the first array has more data in it, how do I tell PHP to use only the array with more data?
I hope this is possible. Please help guys.
-
Hi,
I have a problem that's occuring when using cookie in IF statement..
below is the code
if(isset($_COOKIE['login']) && $_COOKIE['login'] == '3'){ header('location:index.php'); }
When I run this, I get
The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. * This problem can sometimes be caused by disabling or refusing to accept cookies.
Any Idea? it the same with all browsers. It's like a loop than never ends.. I don't understand why this is happening. My browser accepts COOKIES.
Can someone Help?
-
I know this is solved,
but suppose i will like to pass in the ID also, how do i alter this ?
-
Phhheeeww thanks sensei sama XD
-
Hello
I'm having a little problem, where I'm selecting categories from mysql, along with it's subcategories. The problem is, whenever there are multliple SUBcat for a category, it keeps repeating the category name.
Here an example of what's happening:
Array ( [0] => stdClass Object ( [cat_name] => computers [sub_name] => Mouse ) [1] => stdClass Object ( [cat_name] => computers [sub_name] => Keyboard ) )
I would prefer it to be like so:
Array ( [0] => stdClass Object ( [cat_name] => computers [sub_name] => Mouse [sub_name] => Keyboard ) )
The mysql query is like so
$query = "SELECT category.cat_name,sub_cat.sub_name FROM sub_cat LEFT OUTER JOIN category ON sub_cat.cat_id = category.id";
Table category has those fields
CATEGORY
id
cat_name
SUB_CAT
id
cat_id
sub_name
Can someone please explain how to achieve this? I'm stuck :S Thank you
-
@ lemmin : I didn't write the query yet, I just fired up phpMyAdmin, and entered 44.50, but when saved, it become 45 :s :s
@PFMaBiSmAd : I didn't write any code, but as you said, I entered it directly into the table, and came up with this problem.
Finally
@ jonsjava : setting it to DECIMAL(15,2) did the trick... Thanks a lot man XD
Thanks for your hepl everyone.. topic marked as solved I guess!
-
Hi
This is quite confusing me.. I've searched here but can't find an answer, please help
I have a table called products.. In which there is a price field. It's set to DECIMAL.
So, when i store money in it.. Say $44.50 , it cut off the .50 . Why is it so? How can I store the cents also?
I heard that using FLOATS isn't the good way to go, but then again, if DECIMAL doesn't display the cents, what should I do?
Any Advice guys or gals?
Thanks
-
Oops, sorry neil.johnson .. You were fastert than me XD
-
Try
<?php echo "<div>".date("M j, y g:i a", strtotime($ad->date_submit))."</div>"; ?>
-
Oh i see, but the problem is i don't have a clue of how to assign the otpion to the link..
-
Sorry to say this. But i don't really understand something.
$_POST['multifield'] ! What is multifield reffering to and what is option1 reffering to?
-
Ignace, your solution is working.
But lets say, i have different link which will execute different action. How do i tell the php code which link was pressed?
Hope that makes sense. lol
-
Ah the title says, I want to have a link acting as a submit button.
I made it. Like below:
<script type="text/javascript"> function submitForm(type){ for(i = 0;i < post_form.lenght;i++) document.post_form.post[i].value = type; document.post_form.submit(); } <form method="post" action="test.php" name="post_form"> <input type="checkbox" name="post[]" value="1" /> 1 <input type="checkbox" name="post[]" value="2" /> 2 <input type="checkbox" name="post[]" value="3" /> 3 </form> <a href="javascript:submitForm('delete');">Delete</a> </script>
But, when using a submit button, you specify the <name> attribute to use it with php. Like below
<input type="submit" name="submit" value="submit" /> <?php if(isset($_POST['submit']){ code there }
The name submit will be use in php. But when using a link, how do I specify a name to refer it to php?
Can someone please help?
-
Ah the title says, I want to have a link acting as a submit button.
I made it. Like below:
<script type="text/javascript"> function submitForm(type){ for(i = 0;i < post_form.lenght;i++) document.post_form.post[i].value = type; document.post_form.submit(); } <form method="post" action="test.php" name="post_form"> <input type="checkbox" name="post[]" value="1" /> 1 <input type="checkbox" name="post[]" value="2" /> 2 <input type="checkbox" name="post[]" value="3" /> 3 </form> <a href="javascript:submitForm('delete');">Delete</a> </script>
But, when using a submit button, you specify the <name> attribute to use it with php. Like below
<input type="submit" name="submit" value="submit" />
The name submit will be use in php. But when using a link, how do I specify a name to refer it to php?
Can someone please help?
-
What i tried to do since this morning, you did it in less than 15 minutes :wtf:
Thanks a lot for this info and yeah it's working just fine . !
-
I've been searching for a solution about this but im stuck. Here's is a problem..
I have this code:
$new_users = User::find_by_date(); echo "<pre>"; print_r($new_users); echo "</pre>";
The result is :
Array ( [0] => User Object ( [id] => [firstname] => [lastname] => [username] => jkjkjkjkjkjk [password] => [dob] => [email] => [location] => [date_created] => ) [1] => User Object ( [id] => [firstname] => [lastname] => [username] => tester [password] => [dob] => [email] => [location] => [date_created] => ) )
When i do a foreach to get the data, i do it like this:
$new_users = User::find_by_date(); foreach($new_users as $users){ echo $users->username.'<br />'; }
It outputs the username like it should. EG:
jkjkjkjkjkjk
tester
What i really want is to seperate then with comma using the implode function.
I tried this:
foreach($new_users as $users){ echo implode(", ",$users); }
But i get
Warning: implode() [function.implode]: Invalid arguments passed in C:\wamp\www\mu-anime\var.php on line 8
Warning: implode() [function.implode]: Invalid arguments passed in C:\wamp\www\mu-anime\var.php on line 8
I dont know what to do anymore, can someone help me plz?
-
Thats perfect. Exactly what i needed. Thanks bro
Below is the code. for those who might need it
$make_date = mktime(0,0,0,date("m"),date("d")+5,date("Y")); $remove_after = date('Y-m-d',$make_date); $today = strftime('%Y-%m-%d'); "SELECT * FROM tableName WHERE date_added >= '$today' AND date_added <= '$remove_after' ORDER BY date_added ASC"
-
Hi,
I'm stuck with this now.
I have a field in my table call date_added
I want to retrieve data from the latest date added and output it for only 5 days on a page.
I can't figure out how to do this.
Can someone please explain how to proceed?
My query look like this:
SELECT * FROM tableName ORDER BY date_added ASC
But then, i Don't have a clue how to proceed with this date thing :s
-
Grrrrrrrrr im such a .......... !! Earlier i was doing
$list = ''; $list .= etc etc return $list;
But then when calling the function, i was just typing generate_menu(0)... it should have been
echo generate_menu(0)
Anyways, thanks.. Tcare
-
Hello everyone,
I have a function that return some links from mysql DB. Below is the actual code
function generate_menu($parent){ $has_childs = false; global $show_menu; foreach($show_menu as $key => $value){ if($value['parent_id'] == $parent){ if($has_childs === false){ $has_childs = true; } if($value['parent_id'] == '0'){ echo '<div id='.$value['class_id'].$value['class'].'>'; echo '<div id='.$value['class_id'].$value['style_id'].'>'.$value['title'].'</div>'; echo '<ul id='.$value['class_id'].$value['list_style'].'>'; }else{ echo '<li><a href="">'.$value['title'].'</a>'; } generate_menu($key); echo '</li>'; } } if($has_childs === true){ echo '</ul>'; echo '</div>'; } }
As you can see. I'm echoing html inside the function. Is there a way i can return the values instead of echoing it straightly into the function?
-
Yeah, thats what i was going for.. And it's actually working..
Thank you so much for this little example!
-
try using stripslashes()
Updating based on array of checked boxes
in PHP Coding Help
Posted
It might be what your looking for. let me know