Search found 87 matches

by TheBrandon
Tue May 25, 2010 5:16 pm
Forum: PHP - Code
Topic: Array only returning one result? (Should return 2)
Replies: 6
Views: 430

Re: Array only returning one result? (Should return 2)

Thank you for the help and explanation. I really appreciate it.
by TheBrandon
Tue May 25, 2010 4:52 pm
Forum: PHP - Code
Topic: Array only returning one result? (Should return 2)
Replies: 6
Views: 430

Re: Array only returning one result? (Should return 2)

That did it. So mysql_fetch_assoc only returns a single entry?
by TheBrandon
Tue May 25, 2010 4:44 pm
Forum: PHP - Code
Topic: Array only returning one result? (Should return 2)
Replies: 6
Views: 430

Re: Array only returning one result? (Should return 2)

I thought that would dump all of the results into an associative array?

Can you please give me an example of how the code should be modified?
by TheBrandon
Tue May 25, 2010 4:35 pm
Forum: PHP - Code
Topic: Array only returning one result? (Should return 2)
Replies: 6
Views: 430

Array only returning one result? (Should return 2)

Hello all, This is my first time toying with functions returning arrays so I'm sure the answer is simple, but please help. I have a function doing my query: function fetch_category_discounts($cat_ID) { mysql_connect(SQL_HOST_NAME, SQL_USER_NAME, SQL_PASSWORD) or die(mysql_error()); mysql_select_db(S...
by TheBrandon
Tue May 04, 2010 10:30 am
Forum: PHP - Code
Topic: PHP Session Help (Single Page)
Replies: 4
Views: 217

Re: PHP Session Help (Single Page)

Do you have any recommendations on achieving the desired functionality?
by TheBrandon
Tue May 04, 2010 9:56 am
Forum: PHP - Code
Topic: PHP Session Help (Single Page)
Replies: 4
Views: 217

PHP Session Help (Single Page)

Hello all, The client wants to display a flash intro page (preferrably once a week). I wrote a solution using cookies, but I realized if they weren't allowing cookies they would never get past the front page. So I figured I could set a $_SESSION token to get them in anyways, they would just see the ...
by TheBrandon
Wed Apr 28, 2010 12:41 pm
Forum: PHP - Code
Topic: Display list of how many times a # appears in a database
Replies: 12
Views: 1037

Re: Display list of how many times a # appears in a database

Got it. This is the final code: <?php $select = $db->query("SELECT zip_code, COUNT( zip_code ) FROM surveys GROUP BY zip_code"); while ($select_array = mysqli_fetch_array($select)) { if($select_array['1'] > 1){ echo $select_array['zip_code']; echo '( x'.$select_array['1'].'), '; }else{ ech...
by TheBrandon
Wed Apr 28, 2010 12:20 pm
Forum: PHP - Code
Topic: Display list of how many times a # appears in a database
Replies: 12
Views: 1037

Re: Display list of how many times a # appears in a database

I didn't see that post, my mistake. I'll give it a shot. Thank you.
by TheBrandon
Wed Apr 28, 2010 12:11 pm
Forum: PHP - Code
Topic: Display list of how many times a # appears in a database
Replies: 12
Views: 1037

Re: Display list of how many times a # appears in a database

I made some more motifications. It's getting closer but it's still not there: <?php $select = $db->query("SELECT * FROM surveys"); while ($select_array = mysqli_fetch_array($select)) { $count = $db->query("SELECT COUNT(zip_code) FROM surveys WHERE zip_code = '$select_array[zip_code]'&...
by TheBrandon
Wed Apr 28, 2010 12:03 pm
Forum: PHP - Code
Topic: Open New Window _Blank
Replies: 4
Views: 227

Re: Open New Window _Blank

No problem. I still make that mistake all the time. I find it's easier to always use ' with echo statements because it helps keep the HTML syntax (which mainly uses ") separate.
by TheBrandon
Wed Apr 28, 2010 11:47 am
Forum: PHP - Code
Topic: Display list of how many times a # appears in a database
Replies: 12
Views: 1037

Re: Display list of how many times a # appears in a database

<?php $select = $db->query("SELECT * FROM surveys"); while ($select_array = mysqli_fetch_array($select)) { echo $select_array['zip_code']; // the next query counts the amount of times the value of 'zip_code' // appears in the database. $count = $db->query("SELECT COUNT(zip_code) FROM...
by TheBrandon
Wed Apr 28, 2010 11:07 am
Forum: PHP - Code
Topic: Open New Window _Blank
Replies: 4
Views: 227

Re: Open New Window _Blank

Code: Select all

echo '</td><td align="left"><a href="http://bfbcs.com/stats_ps3/'.$player['name'].'" target="_blank">';
Try that.
by TheBrandon
Wed Apr 28, 2010 10:29 am
Forum: PHP - Code
Topic: Display list of how many times a # appears in a database
Replies: 12
Views: 1037

Re: Display list of how many times a # appears in a database

Hmm, I did and it still outputs this: 32578(x0)32578(x0)32578(x0) <?php $select = $db->query("SELECT * FROM surveys"); while ($select_array = mysqli_fetch_array($select)) { echo $select_array['zip_code']; // the next query counts the amount of times the value of 'zip_code' // appears in th...
by TheBrandon
Wed Apr 28, 2010 10:06 am
Forum: PHP - Code
Topic: Passing Variable Using Session
Replies: 3
Views: 295

Re: Passing Variable Using Session

Are you passing the GET variable on next.php? You're saying: $_SESSION['prod_id'] (which is 12) = $prod_id (which has no value yet) = $_GET['prod_id'] So if you don't have a get value set, you're setting the session to be nothing. Try removing: $_SESSION['prod_id'] = $prod_id = $_GET['prod_id']; $_S...
by TheBrandon
Wed Apr 28, 2010 9:59 am
Forum: PHP - Code
Topic: Display list of how many times a # appears in a database
Replies: 12
Views: 1037

Re: Display list of how many times a # appears in a database

Hmm, that just output "(x0)(x0)(x0)" I had to modify it slightly to make it work with my database class: <?php $select = $db->query("SELECT * FROM surveys WHERE zip_code = '32578'"); while ($select_array = mysqli_fetch_array($select)) { echo $select_array['32578']; // the next qu...