Search found 11 matches

by princeofvegas
Wed Dec 15, 2010 5:48 pm
Forum: PHP - Code
Topic: PHP Session Variable and MySQL INSERT INTO Trouble
Replies: 2
Views: 327

Re: PHP Session Variable and MySQL INSERT INTO Trouble

I was able to get it working by passing the business_id as a variable to the page like upload.php?business_id=XX and changing the mysql_query from: mysql_query("INSERT INTO account_pictures (business_id, picture) VALUES ('{$_SESSION['business_id']}','$newfile')"); to: mysql_query("INS...
by princeofvegas
Wed Dec 15, 2010 5:29 pm
Forum: PHP - Code
Topic: PHP Session Variable and MySQL INSERT INTO Trouble
Replies: 2
Views: 327

PHP Session Variable and MySQL INSERT INTO Trouble

I have a photo upload script that I am working on and I have never run into this problem before. Everything on the script works fine, however on the insert into command the business_id session variable is not being posted to the database. It is showing up as empty. I do not know what I am doing wron...
by princeofvegas
Sun Oct 24, 2010 4:35 pm
Forum: Databases
Topic: Mutiple AND in MYSQL Query not working
Replies: 5
Views: 1662

Re: Mutiple AND in MYSQL Query not working

Hello again. Thank you for all of your help. I have been learning more and more about the different types of joins and I have recreated the tables similar to what you have recommended. I now have 3 different tables, coupons, coupons_categories, and business_locations. This is the query that I am usi...
by princeofvegas
Sat Oct 16, 2010 1:28 pm
Forum: Databases
Topic: Mutiple AND in MYSQL Query not working
Replies: 5
Views: 1662

Re: Mutiple AND in MYSQL Query not working

Thank you very much for your help and input. That is making more sense to me now. I am still in the learning proces of implementing databases with PHP. I have one more question on that topic. If I create a new table (i.e. coupons_category), how do I join that table into my query so that it searches ...
by princeofvegas
Fri Oct 15, 2010 9:16 pm
Forum: Databases
Topic: Mutiple AND in MYSQL Query not working
Replies: 5
Views: 1662

Mutiple AND in MYSQL Query not working

I am running an SQL query and everything is working great with it just the way that it is supposed to. However I just had to ass the coupon_status = 'ACTIVE' portion to it and for some reason the query is ignoring that part of it. Is it possible to have multiple AND statements in a query and if so w...
by princeofvegas
Wed Jun 30, 2010 1:58 pm
Forum: PHP - Code
Topic: Run query inside a loop statement
Replies: 6
Views: 1595

Re: Run query inside a loop statement

The parentheses was there, I must not have copied it. I actually just got it working with this: while($searchrow = mysql_fetch_array($searchresult)){ $biz_info_query = mysql_query("SELECT * FROM businesses WHERE business_id={$searchrow['business_id']}"); while ($bizrow = mysql_fetch_array(...
by princeofvegas
Wed Jun 30, 2010 1:47 pm
Forum: PHP - Code
Topic: Run query inside a loop statement
Replies: 6
Views: 1595

Run query inside a loop statement

Basically what I am trying to do is this. I have results that I am fetching from a query and displaying on my site. I want to be able to take one of the results from that query and do another query on a seperate table for results that will be displayed in the same loop. What I have: while($searchrow...
by princeofvegas
Wed Jun 30, 2010 1:36 pm
Forum: PHP - Code
Topic: Make MySQL query meet multiple requirements
Replies: 4
Views: 221

Re: Make MySQL query meet multiple requirements

Hello thank you for you help with this. That worked perfectly. I also found that this line worked as well:

Code: Select all

$searchresult = mysql_query("SELECT * FROM coupons WHERE category_id IN (5, 6) AND coupon_zip IN (89118, 91361)");
Finally hours of headache are gone. :D
by princeofvegas
Wed Jun 30, 2010 1:34 pm
Forum: PHP - Code
Topic: Zip code radius database needed
Replies: 3
Views: 433

Re: Zip code radius database needed

Take a look at this. I just used it for a school project that I am putting together and it works GREAT
http://www.micahcarrick.com/04-19-2005/ ... ation.html
by princeofvegas
Wed Jun 30, 2010 1:55 am
Forum: PHP - Code
Topic: Make MySQL query meet multiple requirements
Replies: 4
Views: 221

Re: Make MySQL query meet multiple requirements

I just tried breaking it down and it works perfectly when I run the query like that.. However, I just noticed that the problem starts and I get unexpected results when I run the query like this: $searchresult = mysql_query("SELECT * FROM coupons WHERE category_id='5' OR category_id='6' AND coup...
by princeofvegas
Wed Jun 30, 2010 1:24 am
Forum: PHP - Code
Topic: Make MySQL query meet multiple requirements
Replies: 4
Views: 221

Make MySQL query meet multiple requirements

I have had a heck of a time figuring this out and it is driving me crazy!! lol. I am trying to make an SQL query meet several requirements from the table before the results are displayed. Here is the statement I am working with: $searchresult = mysql_query("SELECT * FROM coupons WHERE category_...