Jessica
Staff Alumni-
Posts
8,968 -
Joined
-
Last visited
-
Days Won
41
Everything posted by Jessica
-
This may be the most hysterical thread I've read in a while. <?php echo '<div class="discountborder">'.$result['product_id'].'</div>'; ?> Look at this and figure out WHY it works before just copying and pasting it into your code.
-
1 Line of Code: Printing results of query but from encrypted AES
Jessica replied to phpretarded's topic in PHP Coding Help
As you were told before, you would do it in your query. What is the query to select it? -
try print_r instead then as it will show you what's in the arrays. Also, put this in code tags. You know the first key in an array will be 0, not 1, right? See how it's [0] as the first and not [1]? So when you try to access $match[1] I think you mean to do [0].
-
[Database Design] Comments in multiple locations?
Jessica replied to JoeyH3's topic in Application Design
Sounds good to me. -
I'd have done it the way you did, I don't think there is any basic function in php that would work here.
-
It means there is nothing at the key of 1 in $match. What was the result of your var dump? I find print_r a bit easier to read than var_dump, so if you are confused by the output try print_r. (within <pre> tags)
-
No, it has nothing to do with PHP. You're putting a <br> in an invalid location within a table. Different browsers may interpret this differently, but it looks like the one you used puts the <br> before the table. What you wrote is basically this in plain HTML: <table> <tr> <br> <td>Text</td> </tr> <br> </table> What were you trying to do? You don't need <br> between your rows, they automatically are new rows by virtue of the <tr> (table row) tag.
-
I think the new site needs more color.
-
How is that easier than an incrementing number?
-
And if you read beyond the title, you can easily tell the OP is not talking about GUID.
-
Put it in the form as a hidden input, or use a session.
-
Any example how to do that? I did some searching, but didn't find anything I could get my head around to apply to this case. Not Tested. This is very basic and can be improved on very much. <?php Class Person{ public $id; public $name; public $pets = array(); function __construct($id, $name, $pets=NULL){ $this->id = $id; $this->name = $name; if($pets !== NULL){ $this->pets = $pets; } } } Class Pet{ public $type; public $id; function __construct($id, $type){ $this->id = $id; $this->type = $type; } } $people = array(); $people['Sally'] = new Person(1, 'Sally'); //Could also use key of 1 $people['Debbie'] = new Person(2, 'Debbie', array(new Pet(0, 'Snake'), new Pet(1, Rabbit)); //Could do array keys here as well. ?>
-
use objects.
-
What is the House column used for?
-
<?php $count = 1; for($i=1; $i<=20; $i++){ if(($count-1)%4 == 0){ echo 'Alpha'; }else if($count %4 == 0){ echo 'Omega'; }else{ echo 'False'; } echo '<br />'; $count++; } ?> Result: Alpha False False Omega Alpha False False Omega Alpha False False Omega Alpha False False Omega Alpha False False Omega
-
Why?
-
Well, do it that way then. Loops are not fancy. Using if and for is one of the most basic things you can learn in PHP.
-
Loops are fancy? Seriously? There's a lot of ways you could structure that information, but the most obvious is to me is <?php $data = array(); $data[] = array('user'=>1, 'name'=>'Debbie'); $data[] = array('user'=>2, 'name'=>'Sally', 'pets'=>array(array('pet_id'=>0, 'pet'=>'Snake'), array('pet_id'=>1, 'pet'=>'Rabbit')); ?> However, you should be storing this data in a DB and selecting it out. You could also use objects instead of an array.
-
Try using position: relative.
-
in his example he used list, did you read what it does?
-
Don't you have to define $system first, and include the class for it? Or is $system some magic global? Either way: echo 'Hello World'; seems a hell of a lot simpler
-
Can't account for spaces in my database when echoing out data?
Jessica replied to mcc_22ri's topic in PHP Coding Help
Do this: $sql = "SELECT State, City FROM cars WHERE City='$city'" ; echo $sql; $data = mysql_query($sql); What do you get? -
You need to be more specific about what doesn't work. Do you get errors? What do you see?
-
Can't account for spaces in my database when echoing out data?
Jessica replied to mcc_22ri's topic in PHP Coding Help
http://whatsmyowncarworth.com/auto/las-vegas <--- not echoing city name http://whatsmyowncarworth.com/auto/Las%20Vegas <--- not echoing city name For the first one, you'd want to strreplace '-' with ' ' For the second, when you do the urldecode, make sure your comparison is case insensitive.